GCC 8 LTO fails on Windows with -g/-g3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Arm Embedded Toolchain |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
GCC 8-2018-q4
Windows 10 64-bit
Errors:
ELF section name out of range
ld: lto-wrapper failed
The project(s) are generated with the GNU MCU Eclipse STM32F4 template.
I tried both C and C++ projects, both fail if I enable LTO, and build properly if I disable LTO.
They also build properly if I remove -g/-g3.
The console reads:
c:/users/
collect2.exe: error: ld returned 1 exit status
lto-wrapper.exe: fatal error: arm-none-eabi-g++ returned 1 exit status
compilation terminated.
c:/users/
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:64: f4b-lto.elf] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
Both the original Arm binary and the similar GNU MCU Eclipse ARM Embedded GCC binary behave the same.
The problem seems to affect only the Windows binary; on Linux and macOS, projects created with exactly the same procedure, pass the build as expected.
Building target: f4b-lto.elf
Invoking: GNU ARM Cross C++ Linker
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -flto -Wall -Wextra -g -T mem.ld -T libs.ld -T sections.ld -nostartfiles -Xlinker --gc-sections -L"../ldscripts" -Wl,-Map,
Finished building target: f4b-lto.elf
I did further tests and the previous version (7-2018-q2-update) builds my projects (both C and C++) properly with -flto.
So the problem was introduced in the latest release.
I would call this a major bug.