bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LD Bug : 253 Exit Status


From: David Ledger
Subject: LD Bug : 253 Exit Status
Date: Wed, 21 Nov 2018 13:29:41 +1100

Hello,

For the last 3 days I’ve been trying to work around a bug in the ld.exe linker. 
I’m hoping I can resolve the issue.
The project is a C++ project for the ArmV6-m, cortexM0, I’m using “GNU ARM 
Cross C++ Linker”.

The issue is that as I enable various sections of the code the linker suddenly 
stops working and begins reporting the following error:
       collect2.exe: error: ld returned 253 exit status
There is no additional helpful messages, nothing useful comes out of verbose 
either.

This is the information that comes out of the linker on verbose:

Invoking: GNU ARM Cross C++ Linker
arm-none-eabi-g++ -mcpu=cortex-m0 -march=armv6-m -mthumb -Os -fmessage-length=0 
-ffreestanding -flto -Wall -Wextra -T "../ldscripts/mem.ld" -T 
"../ldscripts/sections.ld" -T "../ldscripts/libs.ld" -nostartfiles -Xlinker 
--gc-sections -L"../ldscripts" -Wl,-Map,"uSupply Firmware V1_0.map" 
--specs=nano.specs -v -o "uSupply Firmware V1_0.elf"  
./system/src/stm32f0-stdperiph/stm32f0xx_adc.o 
./system/src/stm32f0-stdperiph/stm32f0xx_can.o 
./system/src/stm32f0-stdperiph/stm32f0xx_cec.o 
./system/src/stm32f0-stdperiph/stm32f0xx_comp.o 
./system/src/stm32f0-stdperiph/stm32f0xx_crc.o 
./system/src/stm32f0-stdperiph/stm32f0xx_crs.o 
./system/src/stm32f0-stdperiph/stm32f0xx_dac.o 
./system/src/stm32f0-stdperiph/stm32f0xx_dbgmcu.o 
./system/src/stm32f0-stdperiph/stm32f0xx_dma.o 
./system/src/stm32f0-stdperiph/stm32f0xx_exti.o 
./system/src/stm32f0-stdperiph/stm32f0xx_flash.o 
./system/src/stm32f0-stdperiph/stm32f0xx_gpio.o 
./system/src/stm32f0-stdperiph/stm32f0xx_i2c.o 
./system/src/stm32f0-stdperiph/stm32f0xx_iwdg.o 
./system/src/stm32f0-stdperiph/stm32f0xx_misc.o 
./system/src/stm32f0-stdperiph/stm32f0xx_pwr.o 
./system/src/stm32f0-stdperiph/stm32f0xx_rcc.o 
./system/src/stm32f0-stdperiph/stm32f0xx_rtc.o 
./system/src/stm32f0-stdperiph/stm32f0xx_spi.o 
./system/src/stm32f0-stdperiph/stm32f0xx_syscfg.o 
./system/src/stm32f0-stdperiph/stm32f0xx_tim.o 
./system/src/stm32f0-stdperiph/stm32f0xx_usart.o 
./system/src/stm32f0-stdperiph/stm32f0xx_wwdg.o  ./system/src/newlib/_cxx.o 
./system/src/newlib/_exit.o ./system/src/newlib/_sbrk.o 
./system/src/newlib/_startup.o ./system/src/newlib/_syscalls.o 
./system/src/newlib/assert.o  ./system/src/diag/Trace.o 
./system/src/diag/trace_impl.o  ./system/src/cortexm/_initialize_hardware.o 
./system/src/cortexm/_reset_hardware.o 
./system/src/cortexm/exception_handlers.o  
./system/src/cmsis/system_stm32f0xx.o ./system/src/cmsis/vectors_stm32f0xx.o  
./src/peripherals/Interrupt.o  ./src/_write.o ./src/main.o   
Using built-in specs.
Reading specs from 
c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/nano.specs
rename spec link to nano_link
rename spec link_gcc_c_sequence to nano_link_gcc_c_sequence
rename spec cpp_unique_options to nano_cpp_unique_options
COLLECT_GCC=arm-none-eabi-g++
COLLECT_LTO_WRAPPER=c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1/lto-wrapper.exe
Target: arm-none-eabi
Configured with: /Host/Work/arm-none-eabi-gcc-7.2.1-1.1/gcc/configure 
--prefix=/Host/Work/arm-none-eabi-gcc-7.2.1-1.1/install/win64/arm-none-eabi-gcc 
--libexecdir=/Host/Work/arm-none-eabi-gcc-7.2.1-1.1/install/win64/arm-none-eabi-gcc/lib
 
--infodir=/Host/Work/arm-none-eabi-gcc-7.2.1-1.1/install/win64/arm-none-eabi-gcc/share/doc/info
 
--mandir=/Host/Work/arm-none-eabi-gcc-7.2.1-1.1/install/win64/arm-none-eabi-gcc/share/doc/man
 
--htmldir=/Host/Work/arm-none-eabi-gcc-7.2.1-1.1/install/win64/arm-none-eabi-gcc/share/doc/html
 
--pdfdir=/Host/Work/arm-none-eabi-gcc-7.2.1-1.1/install/win64/arm-none-eabi-gcc/share/doc/pdf
 --build=x86_64-unknown-linux-gnu --host=x86_64-w64-mingw32 
--target=arm-none-eabi --with-pkgversion='GNU MCU Eclipse ARM Embedded GCC\x2C 
64-bits' --enable-languages=c,c++ --enable-mingw-wildcard --enable-plugins 
--disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap 
--disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls 
--disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld 
--with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi 
--with-sysroot=/Host/Work/arm-none-eabi-gcc-7.2.1-1.1/install/win64/arm-none-eabi-gcc/arm-none-eabi
 --with-multilib-list=rmprofile --disable-rpath --disable-build-format-warnings 
--with-system-zlib
Thread model: single
gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] 
(GNU MCU Eclipse ARM Embedded GCC, 64-bits) 
COMPILER_PATH=c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1/;c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/;c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1/thumb/v6-m/;c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/;c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../arm-none-eabi/lib/thumb/v6-m/;c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1/;c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/;c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/;c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-mcpu=cortex-m0' '-march=armv6-m' '-mthumb' '-Os' 
'-fmessage-length=0' '-ffreestanding' '-flto' '-Wall' '-Wextra' '-T' 
'../ldscripts/mem.ld' '-T' '../ldscripts/sections.ld' '-T' 
'../ldscripts/libs.ld' '-nostartfiles' '-L../ldscripts' '-specs=nano.specs' 
'-v' '-o' 'uSupply Firmware V1_0.elf'
 
c:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1/collect2.exe
 -flto --sysroot=c:address@hidden/arm-none-eabi -X -o uSupply Firmware V1_0.elf 
-L../ldscripts 
-Lc:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1/thumb/v6-m
 
-Lc:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v6-m
 
-Lc:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../arm-none-eabi/lib/thumb/v6-m
 
-Lc:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1
 
-Lc:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc
 
-Lc:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib
 
-Lc:/users/david/appdata/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1.5/.content/bin/../arm-none-eabi/lib
 --gc-sections -Map uSupply Firmware V1_0.map 
./system/src/stm32f0-stdperiph/stm32f0xx_adc.o 
./system/src/stm32f0-stdperiph/stm32f0xx_can.o 
./system/src/stm32f0-stdperiph/stm32f0xx_cec.o 
./system/src/stm32f0-stdperiph/stm32f0xx_comp.o 
./system/src/stm32f0-stdperiph/stm32f0xx_crc.o 
./system/src/stm32f0-stdperiph/stm32f0xx_crs.o 
./system/src/stm32f0-stdperiph/stm32f0xx_dac.o 
./system/src/stm32f0-stdperiph/stm32f0xx_dbgmcu.o 
./system/src/stm32f0-stdperiph/stm32f0xx_dma.o 
./system/src/stm32f0-stdperiph/stm32f0xx_exti.o 
./system/src/stm32f0-stdperiph/stm32f0xx_flash.o 
./system/src/stm32f0-stdperiph/stm32f0xx_gpio.o 
./system/src/stm32f0-stdperiph/stm32f0xx_i2c.o 
./system/src/stm32f0-stdperiph/stm32f0xx_iwdg.o 
./system/src/stm32f0-stdperiph/stm32f0xx_misc.o 
./system/src/stm32f0-stdperiph/stm32f0xx_pwr.o 
./system/src/stm32f0-stdperiph/stm32f0xx_rcc.o 
./system/src/stm32f0-stdperiph/stm32f0xx_rtc.o 
./system/src/stm32f0-stdperiph/stm32f0xx_spi.o 
./system/src/stm32f0-stdperiph/stm32f0xx_syscfg.o 
./system/src/stm32f0-stdperiph/stm32f0xx_tim.o 
./system/src/stm32f0-stdperiph/stm32f0xx_usart.o 
./system/src/stm32f0-stdperiph/stm32f0xx_wwdg.o ./system/src/newlib/_cxx.o 
./system/src/newlib/_exit.o ./system/src/newlib/_sbrk.o 
./system/src/newlib/_startup.o ./system/src/newlib/_syscalls.o 
./system/src/newlib/assert.o ./system/src/diag/Trace.o 
./system/src/diag/trace_impl.o ./system/src/cortexm/_initialize_hardware.o 
./system/src/cortexm/_reset_hardware.o 
./system/src/cortexm/exception_handlers.o ./system/src/cmsis/system_stm32f0xx.o 
./system/src/cmsis/vectors_stm32f0xx.o ./src/peripherals/Interrupt.o 
./src/_write.o ./src/main.o -lstdc++_nano -lm --start-group -lgcc -lc_nano 
--end-group --start-group -lgcc -lc_nano --end-group -T ../ldscripts/mem.ld -T 
../ldscripts/sections.ld -T ../ldscripts/libs.ld
collect2.exe: error: ld returned 253 exit status
make: *** [makefile:65: uSupply Firmware V1_0.elf] Error 1
The map file appears to be cut off mid way through printing type information 
(it seems to crash half way, maybe the type name simply is too long).
Notice that it cuts out entirely half way through an incomplete type, in the 
middle of the word no less:
.text._ZNK7General6Parser6StatesIJNS0_4SCPI3EndINS2_15CommandInternalINS0_5ChainIJRKNS0_7KeywordILj5ELj3EEERKNS0_8OptionalINS0_8RequiredILj3EEEEEEEEJNS2_4NoneILj0EEENS2_5BlankILj0EEEEEEZNS2_7CommandISG_SI_SK_ZNS2_4SCPIIN11Electronics6System6SystemENSP_5CommsEEEKDaRT_RT0_EUlST_E7_EEDaOST_OSV_OT1_OT2_EUlSY_E_EENS3_ISL_ZNSM_ISG_SI_SK_ZNSN_ISQ_SR_EESS_SU_SW_EUlST_E8_EEDaSY_SZ_S11_S13_EUlSY_E_EENS3_INS4_INS5_IJRKNS6_ILj4ELj2EEESF_EEEJSI_SK_EEEZNSM_IS1C_SI_SK_ZNSN_ISQ_SR_EESS_SU_SW_EUlST_E9_EEDaSY_SZ_S11_S13_EUlSY_E_EENS3_INS4_INS5_IJRKNS6_ILj5ELj2EEESF_EEEJSI_SK_EEEZNSM_IS1K_SI_SK_ZNSN_ISQ_SR_EESS_SU_SW_EUlST_E10_EEDaSY_SZ_S11_S13_EUlSY_E_EENS6_ILj5ELj4EEENSB_ILj5EEES1Q_S1Q_S1Q_S1Q_S1Q_S1Q_S1Q_EE3RunIJLj0ELj1ELj2ELj3ELj4ELj5ELj6ELj7ELj8ELj9ELj10ELj11ELj12EELj256EEEDaSt16integer_sequenceIjJXspT_EEERKSt5arrayIcXT0_EEj
                0x0000000008009fdc       0xca ./src/main.o
                0x0000000008009fdc               

auto 
General::Parser::States<General::Parser::SCPI::End<General::Parser::SCPI::CommandInternal<General::Parser::Chain<General::Parser::Keyword<5u,
 3u> const&, General::Parser::Optional<General::Parser::Required<3u> > const&>, 
General::Parser::SCPI::None<0u>, General::Parser::SCPI::Blank<0u> >, auto 
General::Parser::SCPI::Command<General::Parser::Chain<General::Parser::Keyword<5u,
 3u> const&, General::Parser::Optional<General::Parser::Required<3u> > const&>, 
General::Parser::SCPI::None<0u>, General::Parser::SCPI::Blank<0u>, auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(Electronics::System::System&, 
Electronics::System::Comms&)::{lambda(auto:1)#9}>(Electronics::System::System&&,
 Electronics::System::Comms&&, General::Parser::SCPI::Blank<0u>&&, auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(Electronics::System::System&, 
Electronics::System::Comms&)::{lambda(auto:1)#9}&&)::{lambda(auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(auto:1&, auto:2&)::{lambda(auto:1)#9})#1}>, 
General::Parser::SCPI::End<General::Parser::SCPI::CommandInternal<General::Parser::Chain<General::Parser::Keyword<5u,
 3u> const&, General::Parser::Optional<General::Parser::Required<3u> > const&>, 
General::Parser::SCPI::None<0u>, General::Parser::SCPI::Blank<0u> >, auto 
General::Parser::SCPI::Command<General::Parser::Chain<General::Parser::Keyword<5u,
 3u> const&, General::Parser::Optional<General::Parser::Required<3u> > const&>, 
General::Parser::SCPI::None<0u>, General::Parser::SCPI::Blank<0u>, auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(Electronics::System::System&, 
Electronics::System::Comms&)::{lambda(auto:1)#10}>(auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(Electronics::System::System&, 
Electronics::System::Comms&)::{lambda(auto:1)#9}, 
Electronics::System::System&&, General::Parser::SCPI::Blank<0u>, auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(Electronics::System::System&, 
Electronics::System::Comms&)::{lambda(auto:1)#10})::{lambda(auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(auto:1&, auto:2&)::{lambda(auto:1)#9})#1}>, 
General::Parser::SCPI::End<General::Parser::SCPI::CommandInternal<General::Parser::Chain<General::Parser::Keyword<4u,
 2u> const&, General::Parser::Optional<General::Parser::Required<3u> > const&>, 
General::Parser::SCPI::None<0u>, General::Parser::SCPI::Blank<0u> >, auto 
General::Parser::SCPI::Command<General::Parser::SCPI::End<General::Parser::SCPI::CommandInternal<General::Parser::Chain<General::Parser::Keyword<5u,
 3u> const&, General::Parser::Optional<General::Parser::Required<3u> > const&>, 
General::Parser::SCPI::None<0u>, General::Parser::SCPI::Blank<0u> >, auto 
General::Parser::SCPI::Command<General::Parser::Chain<General::Parser::Keyword<5u,
 3u> const&, General::Parser::Optional<General::Parser::Required<3u> > const&>, 
General::Parser::SCPI::None<0u>, General::Parser::SCPI::Blank<0u>, auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(Electronics::System::System&, 
Electronics::System::Comms&)::{lambda(auto:1)#10}>(auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(Electronics::System::System&, 
Electronics::System::Comms&)::{lambda(auto:1)#9}, 
Electronics::System::System&&, General::Parser::SCPI::Blank<0u>, auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(Electronics::System::System&, 
Electronics::System::Comms&)::{lambda(auto:1)#10})::{lambda(auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(auto:1&, auto:2&)::{lambda(auto:1)#9})#1}>, 
General::Parser::SCPI::None<0u>, General::Parser::SCPI::Blank<0u>, auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(Electronics::System::System&, 
Electronics::System::Comms&)::{lambda(auto:1)#11}>(auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(Electronics::System::System&, 
Electronics::System::Comms&)::{lambda(auto:1)#9}, 
Electronics::System::System&&, General::Parser::SCPI::Blank<0u>, auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, 
Electronics::System::Comms>(Electronics::System::System&, 
Electronics::System::Comms&)::{lambda(auto:1)#11})::{lambda(auto const 
General::Parser::SCPI::SCPI<Electronics::System::System, Elect
The bug seems unrelated to the code itself. I concluded that because of the 
following:
1. I have no issue linking on x86 with MSVC or clang, but I cannot use these as 
they don’t fully support my platform. 
2. If I enable code which triggers the error I can disable other unrelated code 
to make it work again.

I believe it to be related in some way to heavy template usage, I use template 
classes which call common functions in a safe manner.
The target has 128K of flash and I’m currently using around 50K.

I’ve written a post on stack overflow : 
https://stackoverflow.com/questions/53257425/undocumented-linker-issue-ld-returned-253-exit-status

How can I assist you in isolating this issue? This is for a commercial project, 
its open source ultimately but its for a physical product. 
This issue is holding up development, I would appreciate greatly any help.


David Ledger - Electronics Design Engineer 
 Skype: david.j.ledger



reply via email to

[Prev in Thread] Current Thread [Next in Thread]