This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Does --as-needed work for linker script ?
- From: "H. J. Lu" <hjl at lucon dot org>
- To: SUGIOKA Toshinobu <sugioka at itonet dot co dot jp>
- Cc: gcc at gcc dot gnu dot org, kkojima at rr dot iij4u dot or dot jp, binutils at sources dot redhat dot com
- Date: Wed, 29 Mar 2006 07:40:30 -0800
- Subject: Does --as-needed work for linker script ?
- References: <4.2.0.58.J.20060329214936.053054a0@router.itonet.co.jp>
On Wed, Mar 29, 2006 at 10:18:31PM +0900, SUGIOKA Toshinobu wrote:
> Hi,
>
> For sh4-unknown-linux target, libgcc_s.so is not symbolic link but linker script
> that is
>
> GROUP ( libgcc_s.so.1 libgcc.a )
>
> I hear this is because some functions are not included in libgcc_s.so.1 and they are
> only in libgcc.a.
>
> But now, "gcc -v -o hello hello.c" gives following output on linking phase.
>
> /usr/libexec/gcc/sh4-unknown-linux/4.1.0/collect2 --eh-frame-hdr -m shlelf_linux -dynamic-linker /lib/ld-linux.so.2 -o hello /usr/lib/gcc/sh4-unknown-linux/4.1.0/../../../crt1.o /usr/lib/gcc/sh4-unknown-linux/4.1.0/../../../crti.o /usr/lib/gcc/sh4-unknown-linux/4.1.0/crtbegin.o -L/usr/lib/gcc/sh4-unknown-linux/4.1.0 -L/usr/lib/gcc/sh4-unknown-linux/4.1.0 -L/usr/lib/gcc/sh4-unknown-linux/4.1.0/../../.. /tmp/ccer52C9.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/sh4-unknown-linux/4.1.0/crtend.o /usr/lib/gcc/sh4-unknown-linux/4.1.0/../../../crtn.o
>
> It seems that libgcc.a is linked automatically, so it would be work if libgcc_s.so is a symbolic link to libgcc_s.so.1.
>
> If libgcc_s.so were symbolic link, unneeded dependency on libgcc_s.so.1 would not be written to the executable.
> ( '--as-needed' seems not work for linker script )
It sounds like a linker bug. I will look int it.
H.J.