[uClibc]gcc-uClibc botches -nodefaultlibs / -nostdlib

Erik Andersen andersen at codepoet.org
Tue Oct 22 12:42:26 UTC 2002


On Tue Oct 22, 2002 at 05:18:35PM +0900, Miles Bader wrote:
> The uClibc gcc wrapper screws up when you pass one of the above options:
> 
>   (1) They both suppress libraries specified on the command line, as
>       well as system libraries!

Hmm.  Thats bad.

>   (2) -nodefaultlibs should be translated into -nostdlib instead of just
>        being passed through, because the wrapper explicitly specifies
>        which crt0.o &c to use.

If we do this, doesn't that mean we are overriding things,
even if someone wishes to use not use crt0 (i.e. they have
their own)?

> Here's a patch to fix the above two problems, which works for me.  I
> edited it by hand to remove some other local changes, so there's a small
> chance that it may not apply cleanly, but you get the idea:

No problem.

> 
> BTW, another question I have is: why does the wrapper pass -lgcc
> _twice_, once before the user libs, and once after?

Because gcc does it that way too, presumable due to the GNU
assembler being single pass.

Check it out:
$ gcc -Os -v hello.c -o hello
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
[----------snip--------------]
 /usr/lib/gcc-lib/i386-linux/2.95.4/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 \
    -o hello /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i386-linux/2.95.4/crtbegin.o \
    -L/usr/lib/gcc-lib/i386-linux/2.95.4 /tmp/ccJw1eOz.o -lgcc -lc -lgcc \
    /usr/lib/gcc-lib/i386-linux/2.95.4/crtend.o /usr/lib/crtn.o

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list