Need to make customized newlib
Howland Craig D (Craig)
Thu Mar 20 00:20:00 GMT 2008
This is more a compiler (technically, linker) question than a library
To answer your questions:
Yes, it is possible. I don't know what gcc version you have, but the
linking stuff is pretty static, so this ought to apply:
You'll want to try the -nostdlib or -nodefaultlibs options (and maybe
-nostartfiles). (A slighty different approach would be to have a gcc
install directory just for your special application where you went in
removed the supplied libraries or replaced them with your own. See
for how to know where they might be.)
To know where things come from, examine the map file. (If you are not
already generating one during the link, add "-Wl,Map -Wl,BASENAME.map"
the gcc command that does the final linking, where BASENAME is
to you, of course. (And of course you can also use whatever file
that you want. The file made is plain text, so if you're Windows-based
might want something like map.txt rather than my something.map.) If you
are directly invoking ld rather than gcc for linking, then it would be
"-Map BASENAME.map".) It tells for each function linked the file that
it came from, among other things.
From: email@example.com [mailto:firstname.lastname@example.org]
On Behalf Of Rick Mann
Sent: Monday, March 17, 2008 2:07 AM
Subject: Need to make customized newlib
Hi. I need to start working on making a pared-down version of newlib.
I've got a build of binutils/GCC/newlib that work for our Xscale
target, but FAA regs require that we actually strip from all source
code any unused functions. So, I was hoping I could just build a
separate newlib, and link our application against that, in lieu of the
newlib that exists with the GCC installation.
Is this possible? I tried building newlib with ./configure --
target=xscale-elf, and then I built a test program that includes
<stdio.h> and links against printf. Then I found the printf.c and
commented out the implementation, and rebuilt, hoping that I'd get a
link error with my test program now. But I don't.
How can I ensure that I'm linking against my second newlib? Is it even
Does anyone have any other suggestions on how to approach this?
More information about the Newlib