public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* link issue for libc stubs
@ 2013-06-11 21:36 Riccardo Manfrin
  0 siblings, 0 replies; only message in thread
From: Riccardo Manfrin @ 2013-06-11 21:36 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-06-11 21:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-11 21:36 link issue for libc stubs Riccardo Manfrin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).