GCC-5.2 Toolchain breaks LTO build for ChibiOS

Asked by Mahavir

Please see below build failure for ChibiOS with latest GCC-5.2 toolchain,

Steps to reproduce:

Download ChibiOS from,
http://sourceforge.net/projects/chibios/?source=typ_redirect

$ cd ChibiOS_3.0.4/demos/STM32/CMSIS-STM32F407-DISCOVERY
$ make

Compiler Options
arm-none-eabi-gcc -c -mcpu=cortex-m4 -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -ffunction-sections -fdata-sections -fno-common -flto -Wall -Wextra -Wundef -Wstrict-prototypes -Wa,-alms=build/lst/ -DCORTEX_USE_FPU=FALSE -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -MD -MP -MF .dep/build.d -I. -I../../../os/common/ports/ARMCMx/devices/STM32F4xx -I../../../os/ext/CMSIS/include -I../../../os/ext/CMSIS/ST -I../../../os/rt/include -I../../../os/rt/ports/ARMCMx -I../../../os/rt/ports/ARMCMx/compilers/GCC -I../../../os/hal/osal/rt -I../../../os/hal/include -I../../../os/hal/ports/common/ARMCMx -I../../../os/hal/ports/STM32/STM32F4xx -I../../../os/hal/ports/STM32/LLD -I../../../os/hal/ports/STM32/LLD/DACv1 -I../../../os/hal/ports/STM32/LLD/GPIOv2 -I../../../os/hal/ports/STM32/LLD/I2Cv1 -I../../../os/hal/ports/STM32/LLD/OTGv1 -I../../../os/hal/ports/STM32/LLD/RTCv2 -I../../../os/hal/ports/STM32/LLD/SPIv1 -I../../../os/hal/ports/STM32/LLD/TIMv1 -I../../../os/hal/ports/STM32/LLD/USARTv1 -I../../../os/hal/ports/STM32/LLD/FSMCv1 -I../../../os/hal/boards/ST_STM32F4_DISCOVERY -I../../../test/rt -I../../../os/rt/ports/ARMCMx/cmsis_os -I../../../os/various main.c -o main.o

Compiling crt0_v7m.s
Compiling chcoreasm_v7m.s
Compiling crt1.c
Compiling vectors.c
Compiling chsys.c
Compiling chdebug.c
Compiling chvt.c
Compiling chschd.c
Compiling chthreads.c
Compiling chtm.c
Compiling chdynamic.c
Compiling chregistry.c
Compiling chsem.c
Compiling chmtx.c
Compiling chcond.c
Compiling chevents.c
Compiling chmsg.c
Compiling chmboxes.c
Compiling chqueues.c
Compiling chmemcore.c
Compiling chheap.c
Compiling chmempools.c
Compiling chcore.c
Compiling chcore_v7m.c
Compiling osal.c
Compiling hal.c
Compiling st.c
Compiling hal_queues.c
Compiling hal_mmcsd.c
Compiling pal.c
Compiling serial.c
Compiling nvic.c
Compiling stm32_dma.c
Compiling hal_lld.c
Compiling st_lld.c
Compiling pal_lld.c
Compiling serial_lld.c
Compiling board.c
Compiling test.c
Compiling testthd.c
Compiling testsem.c
Compiling testmtx.c
Compiling testmsg.c
Compiling testmbox.c
Compiling testevt.c
Compiling testheap.c
Compiling testpools.c
Compiling testdyn.c
Compiling testqueues.c
Compiling testsys.c
Compiling testbmk.c
Compiling cmsis_os.c
Compiling main.c
Linking build/ch.elf
lto1: internal compiler error: in add_symbol_to_partition_1, at lto/lto-partition.c:158
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: fatal error: /home/work/toolchain/arm-gcc/arm-none-eabi-gcc returned 1 exit status
compilation terminated.
/home/work/toolchain/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [build/ch.elf] Error 1

Any pointers would be helpful.

Thanks...Mahavir

Question information

Language:
English Edit question
Status:
Expired
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#1

Hi Mahavir,

That's a known issue in GCC 5. It has been reported in [1] which mentions ChibiOS as well. Once it is fixed in FSF 5 branch, we will include the fix for the following release we make.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65380

Best regards.

Revision history for this message
Benjamin (bvernoux) said :
#2
Revision history for this message
Mahavir (mahavirpj) said :
#3

Any update on when this issue can be resolved?

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#4

Hi Mahavir,

There is no timeline for the resolution but I just confirmed that this happens also with latest GCC development version in the bugzilla ticket (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69866) so this should attract more attention.

Best regards.

Revision history for this message
Launchpad Janitor (janitor) said :
#5

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#6

Hi,

Just to let you know that a fix has been proposed to FSF community [1] and will hopefully make its way in our 2017Q2 release. Please follow Launchpad bug [2] for updates on this.

[1] https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00110.html
[2] https://bugs.launchpad.net/gcc-arm-embedded/+bug/1570613