public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Riccardo Manfrin <riccardomanfrin@gmail.com>
To: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: link issue for libc stubs
Date: Tue, 11 Jun 2013 21:36:00 -0000	[thread overview]
Message-ID: <51B79854.5060506@gmail.com> (raw)

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

                 reply	other threads:[~2013-06-11 21:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51B79854.5060506@gmail.com \
    --to=riccardomanfrin@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).