Failed at -Wl,-nmagic
Jie Zhang
jie.zhang@analog.com
Wed Dec 2 03:55:00 GMT 2009
On 12/01/2009 05:25 PM, Pan ruochen wrote:
> Dear All,
>
> I wanted to turn off page alignment for sections in order to reduce
> the output ELF image size, but
> got errors:
> mips-linux-gnu-gcc -Os -mips32r2 -EL -pipe -W -c myapp.c -o myapp.o
> mips-linux-gnu-gcc -Wl,--nmagic -EL -o myapp.app myapp.o
> /opt/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/mips-linux-gnu/4.3.3/../../../../mips-linux-gnu/bin/ld:
> cannot find -lgcc_s
> collect2: ld returned 1 exit status
> make: *** [myapp.app] Error 1
>
This is because --nmagic disable linking against shared libraries (but
not mentioned in the ld manual). GCC doesn't know that and still passes
-lgcc_s to ld. But libgcc_s.a cannot be found. Adding -static when
linking should work for you.
Jie
More information about the Binutils
mailing list