link issue for libc stubs

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

 



Hi list,
I use gcc 4.8.1 + newlib on a cortex-m3. I'm trying to link my app with libc and a library "libtlc.a" that I created out of a bunch of object files (init.o, tlc.o, cpu.o) as follows:

arm-none-eabi-ar rcs build/libtlc.a build/core_cm3.o build/cpu.o build/startup.o build/init.o build/tlc.o

Within tlc.o I have  the stubs implementation for _exit _sbrk ...
I can see the assembly with objdump ether in the .o and in the libtlc.a library.

I try linking with this command

arm-none-eabi-g++ -W -Wall -mcpu=cortex-m3 -mthumb -march=armv7-m -nostartfiles -Wl,-Map=maketest.map -Wl,-Tlinkerscript.ld main.o -lc -lstdc++ -lgcc -ltlc -o maketest.elf

but fail with these errors

... abort.c:63: undefined reference to `_exit' (same error for _sbrk, _getpid and _kill).

On the contrary, if I use the object file "tlc.o" in the linking phase, I'm able to produce the elf app:

arm-none-eabi-g++ -W -Wall -mcpu=cortex-m3 -mthumb -march=armv7-m -nostartfiles -Wl,-Map=maketest.map -Wl,-Tlinkerscript.ld main.o tlc.o -lc -lstdc++ -lgcc -ltlc -o maketest.elf

What is the difference? The functions defs are in either tlc.o as well as in libtlc.o, but I'm able to produce the binary app only with the object file, not with the library.

Thanks,
RM




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux