This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Many tests fail when gcc passes --no-add-needed to linker


On Mon, Apr 19, 2010 at 3:15 PM, Ulrich Drepper <drepper@redhat.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 04/19/2010 02:03 PM, H.J. Lu wrote:
>> That is not the case for elf/tst-tls12. It is liked against tst-tlsmod12.so:
>
> Might be that I missed something. ?I'll look at it again once you fixed
> the linker to handle the other cases.
>
>

The problem is

[hjl@gnu-15 needed-1]$ gcc -nostdlib -nostartfiles -o
/export/build/gnu/glibc/build-i686-linux/elf/tst-tls1
-Wl,-dynamic-linker=/lib/ld-linux.so.2   -Wl,-z,combreloc -Wl,-z,relro
-Wl,--hash-style=both
/export/build/gnu/glibc/build-i686-linux/csu/crt1.o
/export/build/gnu/glibc/build-i686-linux/csu/crti.o `gcc
--print-file-name=crtbegin.o`
/export/build/gnu/glibc/build-i686-linux/elf/tst-tls1.o
-Wl,-rpath-link=/export/build/gnu/glibc/build-i686-linux:/export/build/gnu/glibc/build-i686-linux/math:/export/build/gnu/glibc/build-i686-linux/elf:/export/build/gnu/glibc/build-i686-linux/dlfcn:/export/build/gnu/glibc/build-i686-linux/nss:/export/build/gnu/glibc/build-i686-linux/nis:/export/build/gnu/glibc/build-i686-linux/rt:/export/build/gnu/glibc/build-i686-linux/resolv:/export/build/gnu/glibc/build-i686-linux/crypt:/export/build/gnu/glibc/build-i686-linux/nptl
/export/build/gnu/glibc/build-i686-linux/libc.so.6
/export/build/gnu/glibc/build-i686-linux/libc_nonshared.a -lgcc
-Wl,--as-needed -lgcc_s  -Wl,--no-as-needed `gcc
--print-file-name=crtend.o`
/export/build/gnu/glibc/build-i686-linux/csu/crtn.o
/usr/local/bin/ld:
/export/build/gnu/glibc/build-i686-linux/elf/tst-tls1.o: undefined
reference to symbol '___tls_get_addr@@GLIBC_2.3'
/usr/local/bin/ld: note: '___tls_get_addr@@GLIBC_2.3' is defined in
DSO /export/build/gnu/glibc/build-i686-linux/elf/ld-linux.so.2 so try
adding it to the linker command line
/export/build/gnu/glibc/build-i686-linux/elf/ld-linux.so.2: could not
read symbols: Invalid operation
collect2: ld returned 1 exit status

The normal libc.so has

[hjl@gnu-15 needed-1]$ cat /usr/lib/libc.so
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf32-i386)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a  AS_NEEDED (
/lib/ld-linux.so.2 ) )
[hjl@gnu-15 needed-1]$

We don't have "AS_NEEDED ( /lib/ld-linux.so.2 )"  This patch adds it.



-- 
H.J.

Attachment: libc-needed-1.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]