diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-01-11 22:18:24 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-01-11 22:18:24 +0000 |
commit | d9266ea02f482e39904260d5add5d68c4508de38 (patch) | |
tree | f6f6320fd9758d0eebb5c7730edd4a9ab246d41f | |
parent | 3baf2e9b75d110f47394e41127f8a4983c9d35c3 (diff) | |
download | glibc-d9266ea02f482e39904260d5add5d68c4508de38.tar.gz glibc-d9266ea02f482e39904260d5add5d68c4508de38.tar.xz glibc-d9266ea02f482e39904260d5add5d68c4508de38.zip |
* Makerules: Define build-module-asneeded.
* iconvdata/extra-module.mk: Use build-module-asneeded. needed. 2006-01-09 Richard Henderson <rth@redhat.com> * iconvdata/extra-module.mk ($(objpfx)$(mod).so): Depend on ld.so. * sysdeps/alpha/__longjmp.S: Use PTR_DEMANGLE. * sysdeps/alpha/setjmp.S: Likewise. Avoid __sigjmp_save for rtld; tailcall in libc.so. * sysdeps/unix/sysv/linux/alpha/sysdep.h (PTR_MANGLE): Define. (PTR_MANGLE2): Define. 2006-01-11 Ulrich Drepper <drepper@redhat.com>
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | Makerules | 5 | ||||
-rw-r--r-- | elf/Makefile | 16 | ||||
-rw-r--r-- | elf/check-localplt.c | 4 | ||||
-rw-r--r-- | iconvdata/extra-module.mk | 6 | ||||
-rw-r--r-- | scripts/data/localplt-i386-linux-gnu.data | 14 | ||||
-rw-r--r-- | scripts/data/localplt-x86_64-linux-gnu.data | 12 | ||||
-rw-r--r-- | sysdeps/alpha/__longjmp.S | 5 | ||||
-rw-r--r-- | sysdeps/alpha/setjmp.S | 51 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/sysdep.h | 39 |
10 files changed, 135 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog index 845ce14fd0..e24117bd32 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,20 @@ 2006-01-11 Ulrich Drepper <drepper@redhat.com> + * Makerules: Define build-module-asneeded. + * iconvdata/extra-module.mk: Use build-module-asneeded. + needed. + +2006-01-09 Richard Henderson <rth@redhat.com> + + * iconvdata/extra-module.mk ($(objpfx)$(mod).so): Depend on ld.so. + * sysdeps/alpha/__longjmp.S: Use PTR_DEMANGLE. + * sysdeps/alpha/setjmp.S: Likewise. Avoid __sigjmp_save for rtld; + tailcall in libc.so. + * sysdeps/unix/sysv/linux/alpha/sysdep.h (PTR_MANGLE): Define. + (PTR_MANGLE2): Define. + +2006-01-11 Ulrich Drepper <drepper@redhat.com> + * elf/check-localplt.c: New file. * elf/Makefile: Add rules to build and run check-localplt. * scripts/data/localplt-x86_64-linux-gnu.data: New file. diff --git a/Makerules b/Makerules index 36e2441be0..027beef31b 100644 --- a/Makerules +++ b/Makerules @@ -572,6 +572,11 @@ define build-module $(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \ $(csu-objpfx)abi-note.o $(build-module-objlist) endef +define build-module-asneeded +$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \ + $(csu-objpfx)abi-note.o \ + -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed +endef else ifneq (,$(findstring aix,$(config-os))) define build-module diff --git a/elf/Makefile b/elf/Makefile index fedbb20155..5cd78c2f83 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -828,11 +828,21 @@ check-data := $(firstword $(wildcard \ ifneq (,$(check-data)) tests: $(objpfx)check-localplt.out +ifeq ($(have-thread-library),yes) +thread-dso := $(filter-out %_nonshared.a, $(shared-thread-library)) +endif + $(objpfx)check-localplt.out: $(objpfx)check-localplt $(common-objpfx)libc.so \ - $(common-objpfx)math/libm.so $(check-data) + $(common-objpfx)math/libm.so $(thread-dso) \ + $(common-objpfx)rt/librt.so \ + $(common-objpfx)dlfcn/libdl.so \ + $(check-data) $(objpfx)check-localplt $(common-objpfx)libc.so \ - $(common-objpfx)math/libm.so | LC_ALL=C sort |\ - diff -u $(check-data) - + $(common-objpfx)math/libm.so $(thread-dso) \ + $(common-objpfx)rt/librt.so \ + $(common-objpfx)dlfcn/libdl.so | \ + LC_ALL=C sort | \ + diff -u $(check-data) - > $@ endif endif diff --git a/elf/check-localplt.c b/elf/check-localplt.c index 96a6cc0832..b4358a8a3f 100644 --- a/elf/check-localplt.c +++ b/elf/check-localplt.c @@ -212,7 +212,7 @@ AB(handle_file) (const char *fname, int fd) if (sym.st_value != 0) /* This symbol is locally defined. */ - puts (strtab + SWAP (sym.st_name)); + printf ("%s: %s\n", basename (fname), strtab + SWAP (sym.st_name)); } else for (E(Rel) *rel = relmem; (char *) rel - (char *) relmem < relsz; ++rel) @@ -230,7 +230,7 @@ AB(handle_file) (const char *fname, int fd) if (sym.st_value != 0) /* This symbol is locally defined. */ - puts (strtab + SWAP (sym.st_name)); + printf ("%s: %s\n", basename (fname), strtab + SWAP (sym.st_name)); } return 0; diff --git a/iconvdata/extra-module.mk b/iconvdata/extra-module.mk index 7eda4e25aa..163074fea4 100644 --- a/iconvdata/extra-module.mk +++ b/iconvdata/extra-module.mk @@ -5,12 +5,14 @@ extra-objs := $(extra-objs) $(patsubst %,%.os,$($(mod)-routines)) $(objpfx)$(mod).so: $(addprefix $(objpfx),$(addsuffix .os,$($(mod)-routines)))\ $(common-objpfx)shlib.lds - $(build-module) + $(build-module-asneeded) # Depend on libc.so so a DT_NEEDED is generated in the shared objects. # This ensures they will load libc.so for needed symbols if loaded by # a statically-linked program that hasn't already loaded it. -$(objpfx)$(mod).so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a +$(objpfx)$(mod).so: $(common-objpfx)libc.so \ + $(common-objpfx)/elf/ld.so \ + $(common-objpfx)libc_nonshared.a ifneq (,$(extra-modules-left)) include extra-module.mk diff --git a/scripts/data/localplt-i386-linux-gnu.data b/scripts/data/localplt-i386-linux-gnu.data index 4852c72fcd..8fb56b6086 100644 --- a/scripts/data/localplt-i386-linux-gnu.data +++ b/scripts/data/localplt-i386-linux-gnu.data @@ -1,7 +1,7 @@ -_Unwind_Find_FDE -calloc -free -malloc -matherr -memalign -realloc +libc.so: _Unwind_Find_FDE +libc.so: calloc +libc.so: free +libc.so: malloc +libc.so: memalign +libc.so: realloc +libm.so: matherr diff --git a/scripts/data/localplt-x86_64-linux-gnu.data b/scripts/data/localplt-x86_64-linux-gnu.data index a50b1f81f7..2219aa9048 100644 --- a/scripts/data/localplt-x86_64-linux-gnu.data +++ b/scripts/data/localplt-x86_64-linux-gnu.data @@ -1,6 +1,6 @@ -calloc -free -malloc -matherr -memalign -realloc +libc.so: calloc +libc.so: free +libc.so: malloc +libc.so: memalign +libc.so: realloc +libm.so: matherr diff --git a/sysdeps/alpha/__longjmp.S b/sysdeps/alpha/__longjmp.S index 40d50312a3..43ab7ba004 100644 --- a/sysdeps/alpha/__longjmp.S +++ b/sysdeps/alpha/__longjmp.S @@ -54,6 +54,11 @@ ENTRY(__longjmp) ldt $f7, JB_F7*8(a0) ldt $f8, JB_F8*8(a0) ldt $f9, JB_F9*8(a0) +#ifdef PTR_DEMANGLE + PTR_DEMANGLE(ra, t1) + PTR_DEMANGLE2(t0, t1) + PTR_DEMANGLE2(fp, t1) +#endif cmoveq v0, 1, v0 mov t0, sp ret diff --git a/sysdeps/alpha/setjmp.S b/sysdeps/alpha/setjmp.S index 14a0320cd3..1b352f346d 100644 --- a/sysdeps/alpha/setjmp.S +++ b/sysdeps/alpha/setjmp.S @@ -23,16 +23,22 @@ #define _SETJMP_H #include <bits/setjmp.h> - .ent __sigsetjmp - .global __sigsetjmp + .ent __sigsetjmp + .global __sigsetjmp __sigsetjmp: - ldgp gp, 0(pv) + ldgp gp, 0(pv) $sigsetjmp_local: - subq sp, 16, sp - .frame sp, 16, ra, 0 - stq ra, 0(sp) - .mask 0x04000000, -16 +#ifndef PIC +#define FRAME 16 + subq sp, FRAME, sp + .frame sp, FRAME, ra, 0 + stq ra, 0(sp) + .mask 0x04000000, -FRAME +#else +#define FRAME 0 + .frame sp, FRAME, ra, 0 +#endif #ifdef PROF .set noat lda AT, _mcount @@ -47,10 +53,27 @@ $sigsetjmp_local: stq s3, JB_S3*8(a0) stq s4, JB_S4*8(a0) stq s5, JB_S5*8(a0) +#ifdef PTR_MANGLE + PTR_MANGLE(t1, ra, t0) + stq t1, JB_PC*8(a0) +#else stq ra, JB_PC*8(a0) - addq sp, 16, t0 +#endif +#if defined(PTR_MANGLE) && FRAME == 0 + PTR_MANGLE2(t1, sp, t0) +#else + addq sp, FRAME, t1 +# ifdef PTR_MANGLE + PTR_MANGLE2(t1, t1, t0) +# endif +#endif + stq t1, JB_SP*8(a0) +#ifdef PTR_MANGLE + PTR_MANGLE2(t1, fp, t0) + stq t1, JB_FP*8(a0) +#else stq fp, JB_FP*8(a0) - stq t0, JB_SP*8(a0) +#endif stt $f2, JB_F2*8(a0) stt $f3, JB_F3*8(a0) stt $f4, JB_F4*8(a0) @@ -60,12 +83,20 @@ $sigsetjmp_local: stt $f8, JB_F8*8(a0) stt $f9, JB_F9*8(a0) +#ifndef PIC /* Call to C to (potentially) save our signal mask. */ jsr ra, __sigjmp_save - ldq ra, 0(sp) addq sp, 16, sp ret +#elif defined NOT_IN_libc && defined IS_IN_rtld + /* In ld.so we never save the signal mask. */ + mov 0, v0 + ret +#else + /* Tailcall to save the signal mask. */ + br $31, __sigjmp_save !samegp +#endif END(__sigsetjmp) diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h index c3de78f4bb..ccbce81f0d 100644 --- a/sysdeps/unix/sysv/linux/alpha/sysdep.h +++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h @@ -22,10 +22,10 @@ #define _LINUX_ALPHA_SYSDEP_H 1 #ifdef __ASSEMBLER__ - #include <asm/pal.h> #include <alpha/regdef.h> - +#else +#include <stdint.h> #endif /* There is some commonality. */ @@ -98,4 +98,39 @@ INTERNAL_SYSCALL1(name, err_out, nr, args); \ }) +/* Pointer mangling support. Note that tls access is slow enough that + we don't deoptimize things by placing the pointer check value there. */ +#if defined NOT_IN_libc && defined IS_IN_rtld +# ifdef __ASSEMBLER__ +# define PTR_MANGLE(dst, src, tmp) \ + ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \ + ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \ + xor src, tmp, dst +# define PTR_MANGLE2(dst, src, tmp) \ + xor src, tmp, dst +# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) +# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) +# else +extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; +# define PTR_MANGLE(var) \ + (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard_local) +# define PTR_DEMANGLE(var) PTR_MANGLE(var) +# endif +#elif defined PIC +# ifdef __ASSEMBLER__ +# define PTR_MANGLE(dst, src, tmp) \ + ldq tmp, __pointer_chk_guard; \ + xor src, tmp, dst +# define PTR_MANGLE2(dst, src, tmp) \ + xor src, tmp, dst +# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) +# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) +# else +extern uintptr_t __pointer_chk_guard attribute_relro; +# define PTR_MANGLE(var) \ + (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard) +# define PTR_DEMANGLE(var) PTR_MANGLE(var) +# endif +#endif + #endif /* _LINUX_ALPHA_SYSDEP_H */ |