We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have attempted to upgrade the toolchain on a project for a Cortex-M0+ that requires LTO to fit in flash. The project has built just fine up until now, but after upgrading to the latest 10.3-2021.07 version, the linking stage fails. Here's what the output looks like:
/tmp/cczekWsc.s: Assembler messages: /tmp/cczekWsc.s:2262: Warning: ignoring changed section attributes for .data /tmp/cczekWsc.s:2272: Warning: dwarf line number information for .data ignored /tmp/cczekWsc.s:2277: Warning: dwarf line number information for .data ignored (repeated hundreds of times) /tmp/cczekWsc.s:61406: Error: leb128 operand is an undefined symbol: .LVU708 /tmp/cczekWsc.s:61407: Error: leb128 operand is an undefined symbol: .LVU708 /tmp/cczekWsc.s:61425: Error: leb128 operand is an undefined symbol: .LVU730 (also repeated hundred plus of times)
Has anyone seen anything like this before? I tried searching for help on this, but came up blank. I'm unsure about how I should even start approaching this as I was unable to even keep the temporary assembler output from the LTO process.
This seems related to this bugreport: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103698
The combination of placing functions in the .data section (typically flash operations which by nature can not run through XIP), LTO and generating debug information by passing -g to the compiler leads to confusion somewhere down the toolchain here. I guess the suspected culprit is probably the binutils assembler.
My project builds just fine if I remove '-g' from the CFLAGS.
I tried to use LTO in a project with a size limitation.It turned out that the issues disappeared when I downgraded the toolchain to version 9.2.1.I am not sure if the problems are related.
[100%] Linking CXX executable C:\.....\Build\release\......elf C:\Users\.....\AppData\Local\Temp\ccc05Sxb.s: Assembler messages: C:\Users\.....\AppData\Local\Temp\ccc05Sxb.s:3544: Error: branch out of range lto-wrapper.exe: fatal error: C:\.....\bin\arm-none-eabi-g++.exe returned 1 exit status compilation terminated. c:/...../arm-none-eabi/bin/ld.exe: error: lto-wrapper failed collect2.exe: error: ld returned 1 exit status mingw32-make.exe[2]: *** [CMakeFiles\......elf.dir\build.make:1552: C:/...../Build/release/......elf] Error 1 mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:83: CMakeFiles/......elf.dir/all] Error 2 mingw32-make.exe: *** [Makefile:90: all] Error 2 The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command cmake --build . -j" terminated with exit code: 1.