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

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Including libgcc_eh in bug-atexit3-lib.so build breaks powerpc


With the recent change:

    2006-07-28  Ulrich Drepper  <drepper@redhat.com>

        * dlfcn/Makefile (LDLIBS-bug-atexit3-lib.so): Use this instead of
        LDFLAGS.  Add -lgcc_eh and libc_nonshared (again) to make sure we
        get the __stack_chk_fail_local definition when it's needed.

we see the powerpc[32|64] make check fail when compiling with gcc-4.1.1:

/opt/biarch/gcc411-p6-test/bin/gcc -m32 -mlong-double-128   -shared
-static-libgcc  -Wl,-dynamic-linker=/lib/ld.so.1 -Wl,-z,defs
-B/home/sjmunroe/work/build32-24x/csu/  -Wl,-z,combreloc -Wl,-z,relro
-Wl,--hash-style=both  -L/home/sjmunroe/work/build32-24x
-L/home/sjmunroe/work/build32-24x/math
-L/home/sjmunroe/work/build32-24x/elf
-L/home/sjmunroe/work/build32-24x/dlfcn
-L/home/sjmunroe/work/build32-24x/nss
-L/home/sjmunroe/work/build32-24x/nis
-L/home/sjmunroe/work/build32-24x/rt
-L/home/sjmunroe/work/build32-24x/resolv
-L/home/sjmunroe/work/build32-24x/crypt
-L/home/sjmunroe/work/build32-24x/nptl
-Wl,-rpath-link=/home/sjmunroe/work/build32-24x:/home/sjmunroe/work/build32-24x/math:/home/sjmunroe/work/build32-24x/elf:/home/sjmunroe/work/build32-24x/dlfcn:/home/sjmunroe/work/build32-24x/nss:/home/sjmunroe/work/build32-24x/nis:/home/sjmunroe/work/build32-24x/rt:/home/sjmunroe/work/build32-24x/resolv:/home/sjmunroe/work/build32-24x/crypt:/home/sjmunroe/work/build32-24x/nptl
-o /home/sjmunroe/work/build32-24x/dlfcn/bug-atexit3-lib.so -T
/home/sjmunroe/work/build32-24x/shlib.lds
/home/sjmunroe/work/build32-24x/csu/abi-note.o
/home/sjmunroe/work/build32-24x/dlfcn/bug-atexit3-lib.os
/home/sjmunroe/work/build32-24x/libc.so
/home/sjmunroe/work/build32-24x/libc_nonshared.a -lstdc++ -lgcc_eh
/home/sjmunroe/work/build32-24x/libc_nonshared.a
/opt/biarch/gcc411-p6-test/lib/gcc/powerpc64-linux/4.1.1/libgcc_eh.a(unwind-dw2.o):(.got2+0x10):
undefined reference to `__libc_stack_end'
collect2: ld returned 1 exit status
make[2]: *** [/home/sjmunroe/work/build32-24x/dlfcn/bug-atexit3-lib.so]
Error 1

The problem is that unwind-dw2 needs __libc_stack_end to find the AUX
Vector AT_HWCAP. The HWCAP is required to check for the presence of FPU
or Altivec registers.  But `__libc_stack_end' is only exported by ld.so
and ld.so is not included in this link.

The simple solution is to add "$(common-objpfx)/elf/ld.so" to the link.
However some might find a patch like the following objectionable:

diff -urN libc24-cvstip-20060731/dlfcn/Makefile libc24/dlfcn/Makefile
--- libc24-cvstip-20060731/dlfcn/Makefile    2006-07-28
12:37:26.000000000 -0500
+++ libc24/dlfcn/Makefile    2006-08-01 16:37:06.199679600 -0500
@@ -140,6 +140,7 @@
 $(objpfx)bug-atexit3: $(libdl)
 $(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so
 $(objpfx)bug-atexit3-lib.so: $(common-objpfx)libc.so \
+                             $(common-objpfx)/elf/ld.so \
                  $(common-objpfx)libc_nonshared.a

As it is fixing an arch specific problem in a generic part of the tree.
Unfortunately my other attempts to resolve this from powerpc specific
Makefiles have failed. For example:

diff -urN libc24-cvstip-20060731/sysdeps/powerpc/Makefile
libc24/sysdeps/powerpc/Makefile
--- libc24-cvstip-20060731/sysdeps/powerpc/Makefile    2004-02-13
21:24:52.000000000 -0600
+++ libc24/sysdeps/powerpc/Makefile    2006-08-01 15:51:50.835642272 -0500
@@ -28,3 +28,7 @@
 # get offset to rtld_global._dl_hwcap
 gen-as-const-headers += rtld-global-offsets.sym
 endif
+
+ifeq ($(subdir),dlfcn)
+LDLIBS-bug-atexit3-lib.so += $(common-objpfx)/elf/ld.so
+endif

Has no effect.

Some guidence on the best way to resolve this would be appreciated


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