Page 2 of 2

Re: missing newlib stubs

Posted: Wed Aug 12, 2015 6:25 pm
by JoVM
Depends you want to use syscalls.o or libg.a?

Kr,Jo

Re: missing newlib stubs

Posted: Fri Nov 13, 2015 11:15 pm
by bnewbold
I ran in to basically the same problem:

Code: Select all

`_sbrk_r' referenced in section `.text._malloc_r' of /home/bnewbold/bin/gcc-arm-none-eabi-4_9-2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/libg.a(lib_a-mallocr.o): defined in discarded section `.text' of build/obj/syscalls.o (symbol from plugin)
`_sbrk_r' referenced in section `.text._malloc_r' of /home/bnewbold/bin/gcc-arm-none-eabi-4_9-2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/libg.a(lib_a-mallocr.o): defined in discarded section `.text' of build/obj/syscalls.o (symbol from plugin)
`_sbrk_r' referenced in section `.text._malloc_trim_r' of /home/bnewbold/bin/gcc-arm-none-eabi-4_9-2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/libg.a(lib_a-freer.o): defined in discarded section `.text' of build/obj/syscalls.o (symbol from plugin)
`_sbrk_r' referenced in section `.text._malloc_trim_r' of /home/bnewbold/bin/gcc-arm-none-eabi-4_9-2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/libg.a(lib_a-freer.o): defined in discarded section `.text' of build/obj/syscalls.o (symbol from plugin)
`_sbrk_r' referenced in section `.text._malloc_trim_r' of /home/bnewbold/bin/gcc-arm-none-eabi-4_9-2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/libg.a(lib_a-freer.o): defined in discarded section `.text' of build/obj/syscalls.o (symbol from plugin)
collect2: error: ld returned 1 exit status

With GCC version:

Code: Select all

bnewbold@ent$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20141119 (release) [ARM/embedded-4_9-branch revision 218278]


As a cross-reference, I found discussion on this Sourceforge bug: http://sourceforge.net/p/chibios/bugs/571/

which led me to add "-fno-use-linker-plugin" to "USE_OPT", which seems to have worked. I'm not sure what the impact on LTO was.