diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-02-01 01:33:04 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-02-01 01:33:04 +0000 |
commit | 5688da55372193e5941f0240e6ea759d28483970 (patch) | |
tree | 07e201b5db41088611a28d339926c7a953fa7391 | |
parent | a204ea3607d148c7b83dec5b54496762a99699d8 (diff) | |
download | glibc-5688da55372193e5941f0240e6ea759d28483970.zip glibc-5688da55372193e5941f0240e6ea759d28483970.tar.gz glibc-5688da55372193e5941f0240e6ea759d28483970.tar.bz2 |
Update.
* sysdeps/generic/ldsodefs.h: Add _dl_load_lock, _dl_lazy,
_dl_dynamic_weak, _dl_fpu_control, _dl_cpuclock_offset, and
_dl_debug_fd to rtld_global.
* elf/Versions: Likewise.
* elf/dl-close.c: Likewise.
* elf/dl-iteratephdr.c: Likewise.
* elf/dl-lookup.c: Likewise.
* elf/dl-misc.c: Likewise.
* elf/dl-open.c: Likewise.
* elf/dl-support.c: Likewise.
* elf/do-lookup.h: Likewise.
* elf/rtld.c: Likewise.
* sysdeps/generic/dl-cache.c: Likewise.
* sysdeps/generic/dl-sysdep.c: Likewise.
* sysdeps/ia64/Versions: Likewise.
* sysdeps/unix/clock_gettime.c: Likewise.
* sysdeps/unix/clock_settime.c: Likewise.
* sysdeps/unix/sysv/linux/init-first.c: Likewise.
* sysdeps/sparc/Versions: Removed.
* sysdeps/i386/i686/Versions : Removed.
* sysdeps/x86_64/Versions: Removed.
* configure.in: Define HAVE_PROTECTED if .protected is available.
* config.h.in: Add entry for HAVE_PROTECTED.
2002-01-31 Jakub Jelinek <jakub@redhat.com.
* sysdeps/alpha/dl-machine.h: Move global variables for SHARED
code in struct _rtld_global. Export this struct, remove all
exports for the signal variables.
* sysdeps/arm/dl-machine: Likewise.
* sysdeps/generic/dl-origin: Likewise.
* sysdeps/generic/dl-sysdep: Likewise.
* sysdeps/generic/dl-cache: Likewise.
* sysdeps/hppa/dl-fptr: Likewise.
* sysdeps/hppa/dl-machine: Likewise.
* sysdeps/cris/dl-machine: Likewise.
* sysdeps/i386/dl-machine: Likewise.
* sysdeps/ia64/dl-machine: Likewise.
* sysdeps/m68k/dl-machine: Likewise.
* sysdeps/mach/hurd/dl-sysdep: Likewise.
* sysdeps/mips/mips64/dl-machine: Likewise.
* sysdeps/mips/dl-machine: Likewise.
* sysdeps/powerpc/elf/libc-start: Likewise.
* sysdeps/powerpc/dl-machine: Likewise.
* sysdeps/powerpc/dl-start: Likewise.
* sysdeps/sparc/sparc32/dl-machine: Likewise.
* sysdeps/sparc/sparc64/dl-machine: Likewise.
* sysdeps/sh/dl-machine: Likewise.
* sysdeps/s390/s390-32/dl-machine: Likewise.
* sysdeps/s390/s390-64/dl-machine: Likewise.
* sysdeps/unix/sysv/aix/libc-start: Likewise.
* sysdeps/unix/sysv/aix/start-libc: Likewise.
* sysdeps/unix/sysv/linux/ia64/dl-static: Likewise.
* sysdeps/unix/sysv/linux/m68k/getpagesize: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize: Likewise.
* sysdeps/x86_64/dl-machine: Likewise.
2002-01-31 Ulrich Drepper <drepper@redhat.com>
51 files changed, 389 insertions, 353 deletions
@@ -1,5 +1,64 @@ 2002-01-31 Ulrich Drepper <drepper@redhat.com> + * sysdeps/generic/ldsodefs.h: Add _dl_load_lock, _dl_lazy, + _dl_dynamic_weak, _dl_fpu_control, _dl_cpuclock_offset, and + _dl_debug_fd to rtld_global. + * elf/Versions: Likewise. + * elf/dl-close.c: Likewise. + * elf/dl-iteratephdr.c: Likewise. + * elf/dl-lookup.c: Likewise. + * elf/dl-misc.c: Likewise. + * elf/dl-open.c: Likewise. + * elf/dl-support.c: Likewise. + * elf/do-lookup.h: Likewise. + * elf/rtld.c: Likewise. + * sysdeps/generic/dl-cache.c: Likewise. + * sysdeps/generic/dl-sysdep.c: Likewise. + * sysdeps/ia64/Versions: Likewise. + * sysdeps/unix/clock_gettime.c: Likewise. + * sysdeps/unix/clock_settime.c: Likewise. + * sysdeps/unix/sysv/linux/init-first.c: Likewise. + * sysdeps/sparc/Versions: Removed. + * sysdeps/i386/i686/Versions : Removed. + * sysdeps/x86_64/Versions: Removed. + * configure.in: Define HAVE_PROTECTED if .protected is available. + * config.h.in: Add entry for HAVE_PROTECTED. + +2002-01-31 Jakub Jelinek <jakub@redhat.com. + + * sysdeps/alpha/dl-machine.h: Move global variables for SHARED + code in struct _rtld_global. Export this struct, remove all + exports for the signal variables. + * sysdeps/arm/dl-machine: Likewise. + * sysdeps/generic/dl-origin: Likewise. + * sysdeps/generic/dl-sysdep: Likewise. + * sysdeps/generic/dl-cache: Likewise. + * sysdeps/hppa/dl-fptr: Likewise. + * sysdeps/hppa/dl-machine: Likewise. + * sysdeps/cris/dl-machine: Likewise. + * sysdeps/i386/dl-machine: Likewise. + * sysdeps/ia64/dl-machine: Likewise. + * sysdeps/m68k/dl-machine: Likewise. + * sysdeps/mach/hurd/dl-sysdep: Likewise. + * sysdeps/mips/mips64/dl-machine: Likewise. + * sysdeps/mips/dl-machine: Likewise. + * sysdeps/powerpc/elf/libc-start: Likewise. + * sysdeps/powerpc/dl-machine: Likewise. + * sysdeps/powerpc/dl-start: Likewise. + * sysdeps/sparc/sparc32/dl-machine: Likewise. + * sysdeps/sparc/sparc64/dl-machine: Likewise. + * sysdeps/sh/dl-machine: Likewise. + * sysdeps/s390/s390-32/dl-machine: Likewise. + * sysdeps/s390/s390-64/dl-machine: Likewise. + * sysdeps/unix/sysv/aix/libc-start: Likewise. + * sysdeps/unix/sysv/aix/start-libc: Likewise. + * sysdeps/unix/sysv/linux/ia64/dl-static: Likewise. + * sysdeps/unix/sysv/linux/m68k/getpagesize: Likewise. + * sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize: Likewise. + * sysdeps/x86_64/dl-machine: Likewise. + +2002-01-31 Ulrich Drepper <drepper@redhat.com> + * sysdeps/posix/readv.c: Don't use alloca if the memory requirements are too high. diff --git a/config.h.in b/config.h.in index 917674b..53e761d 100644 --- a/config.h.in +++ b/config.h.in @@ -96,6 +96,9 @@ /* Define if the linker supports the -z combreloc option. */ #undef HAVE_Z_COMBRELOC +/* Define if the assembler supported .protected. */ +#undef HAVE_PROTECTED + /* Defined to some form of __attribute__ ((...)) if the compiler supports a different, more efficient calling convention. */ @@ -2789,9 +2789,13 @@ fi echo "$ac_t""$libc_cv_asm_protected_directive" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_PROTECTED 1 +EOF + echo $ac_n "checking for -z nodelete option""... $ac_c" 1>&6 -echo "configure:2795: checking for -z nodelete option" >&5 +echo "configure:2799: checking for -z nodelete option" >&5 if eval "test \"`echo '$''{'libc_cv_z_nodelete'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2800,7 +2804,7 @@ int _start (void) { return 42; } EOF if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -nostartfiles -nostdlib - -Wl,--enable-new-dtags,-z,nodelete 1>&5'; { (eval echo configure:2804: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } + -Wl,--enable-new-dtags,-z,nodelete 1>&5'; { (eval echo configure:2808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } then libc_cv_z_nodelete=yes else @@ -2813,7 +2817,7 @@ echo "$ac_t""$libc_cv_z_nodelete" 1>&6 echo $ac_n "checking for -z nodlopen option""... $ac_c" 1>&6 -echo "configure:2817: checking for -z nodlopen option" >&5 +echo "configure:2821: checking for -z nodlopen option" >&5 if eval "test \"`echo '$''{'libc_cv_z_nodlopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2822,7 +2826,7 @@ int _start (void) { return 42; } EOF if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -nostartfiles -nostdlib - -Wl,--enable-new-dtags,-z,nodlopen 1>&5'; { (eval echo configure:2826: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } + -Wl,--enable-new-dtags,-z,nodlopen 1>&5'; { (eval echo configure:2830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } then libc_cv_z_nodlopen=yes else @@ -2835,7 +2839,7 @@ echo "$ac_t""$libc_cv_z_nodlopen" 1>&6 echo $ac_n "checking for -z initfirst option""... $ac_c" 1>&6 -echo "configure:2839: checking for -z initfirst option" >&5 +echo "configure:2843: checking for -z initfirst option" >&5 if eval "test \"`echo '$''{'libc_cv_z_initfirst'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2844,7 +2848,7 @@ int _start (void) { return 42; } EOF if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -nostartfiles -nostdlib - -Wl,--enable-new-dtags,-z,initfirst 1>&5'; { (eval echo configure:2848: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } + -Wl,--enable-new-dtags,-z,initfirst 1>&5'; { (eval echo configure:2852: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } then libc_cv_z_initfirst=yes else @@ -2857,14 +2861,14 @@ echo "$ac_t""$libc_cv_z_initfirst" 1>&6 echo $ac_n "checking for -Bgroup option""... $ac_c" 1>&6 -echo "configure:2861: checking for -Bgroup option" >&5 +echo "configure:2865: checking for -Bgroup option" >&5 if eval "test \"`echo '$''{'libc_cv_Bgroup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<EOF int _start (void) { return 42; } EOF - if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -Wl,-Bgroup -nostdlib 1>&5'; { (eval echo configure:2868: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } + if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -Wl,-Bgroup -nostdlib 1>&5'; { (eval echo configure:2872: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } then libc_cv_Bgroup=yes else @@ -2877,7 +2881,7 @@ echo "$ac_t""$libc_cv_Bgroup" 1>&6 echo $ac_n "checking for -z combreloc""... $ac_c" 1>&6 -echo "configure:2881: checking for -z combreloc" >&5 +echo "configure:2885: checking for -z combreloc" >&5 if eval "test \"`echo '$''{'libc_cv_z_combreloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2887,7 +2891,7 @@ int foo (void) { return bar (); } EOF if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -nostdlib -nostartfiles - -Wl,-z,combreloc 1>&5'; { (eval echo configure:2891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } + -Wl,-z,combreloc 1>&5'; { (eval echo configure:2895: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } then if readelf -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then libc_cv_z_combreloc=yes @@ -2912,12 +2916,12 @@ fi if test $elf != yes; then echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6 -echo "configure:2916: checking for .init and .fini sections" >&5 +echo "configure:2920: checking for .init and .fini sections" >&5 if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2921 "configure" +#line 2925 "configure" #include "confdefs.h" int main() { @@ -2926,7 +2930,7 @@ asm (".section .init"); asm ("${libc_cv_dot_text}"); ; return 0; } EOF -if { (eval echo configure:2930: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_have_initfini=yes else @@ -2949,7 +2953,7 @@ fi if test $elf = yes -a $gnu_ld = yes; then echo $ac_n "checking whether cc puts quotes around section names""... $ac_c" 1>&6 -echo "configure:2953: checking whether cc puts quotes around section names" >&5 +echo "configure:2957: checking whether cc puts quotes around section names" >&5 if eval "test \"`echo '$''{'libc_cv_have_section_quotes'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2986,19 +2990,19 @@ if test $elf = yes; then else if test $ac_cv_prog_cc_works = yes; then echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6 -echo "configure:2990: checking for _ prefix on C symbol names" >&5 +echo "configure:2994: checking for _ prefix on C symbol names" >&5 if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2995 "configure" +#line 2999 "configure" #include "confdefs.h" asm ("_glibc_foobar:"); int main() { glibc_foobar (); ; return 0; } EOF -if { (eval echo configure:3002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* libc_cv_asm_underscores=yes else @@ -3013,17 +3017,17 @@ fi echo "$ac_t""$libc_cv_asm_underscores" 1>&6 else echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6 -echo "configure:3017: checking for _ prefix on C symbol names" >&5 +echo "configure:3021: checking for _ prefix on C symbol names" >&5 if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3022 "configure" +#line 3026 "configure" #include "confdefs.h" void underscore_test(void) { return; } EOF -if { (eval echo configure:3027: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3031: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if grep _underscore_test conftest* >/dev/null; then rm -f conftest* libc_cv_asm_underscores=yes @@ -3055,7 +3059,7 @@ if test $elf = yes; then fi echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6 -echo "configure:3059: checking for assembler .weak directive" >&5 +echo "configure:3063: checking for assembler .weak directive" >&5 if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3078,7 +3082,7 @@ echo "$ac_t""$libc_cv_asm_weak_directive" 1>&6 if test $libc_cv_asm_weak_directive = no; then echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6 -echo "configure:3082: checking for assembler .weakext directive" >&5 +echo "configure:3086: checking for assembler .weakext directive" >&5 if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3125,14 +3129,14 @@ EOF ;; hppa*linux*) echo $ac_n "checking for assembler line separator""... $ac_c" 1>&6 -echo "configure:3129: checking for assembler line separator" >&5 +echo "configure:3133: checking for assembler line separator" >&5 if eval "test \"`echo '$''{'libc_cv_asm_line_sep'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.s <<EOF nop ; is_old_puffin EOF - if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:3136: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:3140: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_asm_line_sep='!' else if test -z "$enable_hacker_mode"; then @@ -3154,7 +3158,7 @@ EOF esac echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6 -echo "configure:3158: checking for ld --no-whole-archive" >&5 +echo "configure:3162: checking for ld --no-whole-archive" >&5 if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3165,7 +3169,7 @@ __throw () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -Wl,--no-whole-archive - -o conftest conftest.c 1>&5'; { (eval echo configure:3169: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c 1>&5'; { (eval echo configure:3173: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_ld_no_whole_archive=yes else libc_cv_ld_no_whole_archive=no @@ -3179,7 +3183,7 @@ if test $libc_cv_ld_no_whole_archive = yes; then fi echo $ac_n "checking for gcc -fexceptions""... $ac_c" 1>&6 -echo "configure:3183: checking for gcc -fexceptions" >&5 +echo "configure:3187: checking for gcc -fexceptions" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_exceptions'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3190,7 +3194,7 @@ __throw () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -fexceptions - -o conftest conftest.c 1>&5'; { (eval echo configure:3194: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c 1>&5'; { (eval echo configure:3198: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_exceptions=yes else libc_cv_gcc_exceptions=no @@ -3205,14 +3209,14 @@ fi if test "$base_machine" = alpha ; then echo $ac_n "checking for function ..ng prefix""... $ac_c" 1>&6 -echo "configure:3209: checking for function ..ng prefix" >&5 +echo "configure:3213: checking for function ..ng prefix" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_alpha_ng_prefix'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<\EOF foo () { } EOF -if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:3216: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; +if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:3220: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_alpha_ng_prefix=yes else @@ -3239,19 +3243,19 @@ if test "$host_cpu" = powerpc ; then # Check for a bug present in at least versions 2.8.x of GCC # and versions 1.0.x of EGCS. echo $ac_n "checking whether clobbering cr0 causes problems""... $ac_c" 1>&6 -echo "configure:3243: checking whether clobbering cr0 causes problems" >&5 +echo "configure:3247: checking whether clobbering cr0 causes problems" >&5 if eval "test \"`echo '$''{'libc_cv_c_asmcr0_bug'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3248 "configure" +#line 3252 "configure" #include "confdefs.h" int tester(int x) { asm ("" : : : "cc"); return x & 123; } int main() { ; return 0; } EOF -if { (eval echo configure:3255: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_c_asmcr0_bug='no' else @@ -3273,12 +3277,12 @@ fi fi echo $ac_n "checking for DWARF2 unwind info support""... $ac_c" 1>&6 -echo "configure:3277: checking for DWARF2 unwind info support" >&5 +echo "configure:3281: checking for DWARF2 unwind info support" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_dwarf2_unwind_info'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<EOF -#line 3282 "configure" +#line 3286 "configure" static char __EH_FRAME_BEGIN__; _start () { @@ -3305,7 +3309,7 @@ __bzero () {} EOF if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame_info -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3309: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_dwarf2_unwind_info=static else libc_cv_gcc_dwarf2_unwind_info=no @@ -3313,7 +3317,7 @@ fi if test $libc_cv_gcc_dwarf2_unwind_info = no; then if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3321: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_dwarf2_unwind_info=yes else libc_cv_gcc_dwarf2_unwind_info=no @@ -3343,12 +3347,12 @@ EOF esac echo $ac_n "checking for __builtin_expect""... $ac_c" 1>&6 -echo "configure:3347: checking for __builtin_expect" >&5 +echo "configure:3351: checking for __builtin_expect" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_builtin_expect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<EOF -#line 3352 "configure" +#line 3356 "configure" int foo (int a) { a = __builtin_expect (a, 10); @@ -3356,7 +3360,7 @@ int foo (int a) } EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3360: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3364: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_builtin_expect=yes else libc_cv_gcc_builtin_expect=no @@ -3373,12 +3377,12 @@ EOF fi echo $ac_n "checking for local label subtraction""... $ac_c" 1>&6 -echo "configure:3377: checking for local label subtraction" >&5 +echo "configure:3381: checking for local label subtraction" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_subtract_local_labels'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<EOF -#line 3382 "configure" +#line 3386 "configure" int foo (int a) { static const int ar[] = { &&l1 - &&l1, &&l2 - &&l1 }; @@ -3391,7 +3395,7 @@ int foo (int a) } EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3399: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_subtract_local_labels=yes else libc_cv_gcc_subtract_local_labels=no @@ -3408,7 +3412,7 @@ EOF fi echo $ac_n "checking for libgd""... $ac_c" 1>&6 -echo "configure:3412: checking for libgd" >&5 +echo "configure:3416: checking for libgd" >&5 if test "$with_gd" != "no"; then old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $libgd_include" @@ -3417,14 +3421,14 @@ if test "$with_gd" != "no"; then old_LIBS="$LIBS" LIBS="$LIBS -lgd -lpng -lz -lm" cat > conftest.$ac_ext <<EOF -#line 3421 "configure" +#line 3425 "configure" #include "confdefs.h" #include <gd.h> int main() { gdImagePng (0, 0) ; return 0; } EOF -if { (eval echo configure:3428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBGD=yes else @@ -3444,7 +3448,7 @@ echo "$ac_t""$LIBGD" 1>&6 echo $ac_n "checking size of long double""... $ac_c" 1>&6 -echo "configure:3448: checking size of long double" >&5 +echo "configure:3452: checking size of long double" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3452,7 +3456,7 @@ else ac_cv_sizeof_long_double=0 else cat > conftest.$ac_ext <<EOF -#line 3456 "configure" +#line 3460 "configure" #include "confdefs.h" #include <stdio.h> int main() @@ -3463,7 +3467,7 @@ int main() return(0); } EOF -if { (eval echo configure:3467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_double=`cat conftestval` else @@ -3541,7 +3545,7 @@ if test "$uname" = "sysdeps/generic"; then fi echo $ac_n "checking OS release for uname""... $ac_c" 1>&6 -echo "configure:3545: checking OS release for uname" >&5 +echo "configure:3549: checking OS release for uname" >&5 if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3563,7 +3567,7 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6 uname_release="$libc_cv_uname_release" echo $ac_n "checking OS version for uname""... $ac_c" 1>&6 -echo "configure:3567: checking OS version for uname" >&5 +echo "configure:3571: checking OS version for uname" >&5 if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3585,7 +3589,7 @@ else fi echo $ac_n "checking stdio selection""... $ac_c" 1>&6 -echo "configure:3589: checking stdio selection" >&5 +echo "configure:3593: checking stdio selection" >&5 case $stdio in libio) cat >> confdefs.h <<\EOF @@ -3599,7 +3603,7 @@ echo "$ac_t""$stdio" 1>&6 # Test for old glibc 2.0.x headers so that they can be removed properly # Search only in includedir. echo $ac_n "checking for old glibc 2.0.x headers""... $ac_c" 1>&6 -echo "configure:3603: checking for old glibc 2.0.x headers" >&5 +echo "configure:3607: checking for old glibc 2.0.x headers" >&5 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h" then old_glibc_headers=yes @@ -3660,7 +3664,7 @@ if test $shared = default; then fi echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6 -echo "configure:3664: checking whether -fPIC is default" >&5 +echo "configure:3668: checking whether -fPIC is default" >&5 if eval "test \"`echo '$''{'pic_default'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else diff --git a/configure.in b/configure.in index 155f3b2..ec9fcbc 100644 --- a/configure.in +++ b/configure.in @@ -993,6 +993,7 @@ EOF fi rm -f conftest*]) AC_SUBST(libc_cv_asm_protected_directive) + AC_DEFINE(HAVE_PROTECTED) AC_CACHE_CHECK(for -z nodelete option, libc_cv_z_nodelete, [dnl diff --git a/elf/Versions b/elf/Versions index 5c8da22..af4f4b8 100644 --- a/elf/Versions +++ b/elf/Versions @@ -30,9 +30,6 @@ libc { ld { GLIBC_2.0 { - # global variables - _dl_debug_fd; - # Those are in the dynamic linker, but used by libc.so. __libc_enable_secure; _dl_catch_error; _dl_check_all_versions; _dl_debug_initialize; _dl_debug_state; @@ -48,20 +45,17 @@ ld { } GLIBC_2.1 { # global variables - _dl_fpu_control; __libc_stack_end; + __libc_stack_end; # functions used in other libraries _dl_start_profile; _dl_mcount; _dl_unload_cache; } GLIBC_2.1.1 { - # global variables - _dl_lazy; - # functions used in other libraries _dl_dst_count; _dl_dst_substitute; } GLIBC_2.2 { - _dl_init; _dl_load_lock; _dl_argv; _dl_check_map_versions; + _dl_init; _dl_argv; _dl_check_map_versions; # variables used elsewhere _dl_out_of_memory; diff --git a/elf/dl-close.c b/elf/dl-close.c index cece96b..65de9e7 100644 --- a/elf/dl-close.c +++ b/elf/dl-close.c @@ -57,7 +57,7 @@ _dl_close (void *_map) _dl_signal_error (0, map->l_name, NULL, N_("shared object not open")); /* Acquire the lock. */ - __libc_lock_lock_recursive (_dl_load_lock); + __libc_lock_lock_recursive (GL(dl_load_lock)); /* Decrement the reference count. */ if (map->l_opencount > 1 || map->l_type != lt_loaded) @@ -70,7 +70,7 @@ _dl_close (void *_map) /* One decrement the object itself, not the dependencies. */ --map->l_opencount; - __libc_lock_unlock_recursive (_dl_load_lock); + __libc_lock_unlock_recursive (GL(dl_load_lock)); return; } @@ -298,7 +298,7 @@ _dl_close (void *_map) free (list); /* Release the lock. */ - __libc_lock_unlock_recursive (_dl_load_lock); + __libc_lock_unlock_recursive (GL(dl_load_lock)); } diff --git a/elf/dl-iteratephdr.c b/elf/dl-iteratephdr.c index e2a5d2a..3145e38 100644 --- a/elf/dl-iteratephdr.c +++ b/elf/dl-iteratephdr.c @@ -32,7 +32,7 @@ __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, int ret = 0; /* Make sure we are alone. */ - __libc_lock_lock_recursive (_dl_load_lock); + __libc_lock_lock_recursive (GL(dl_load_lock)); for (l = GL(dl_loaded); l != NULL; l = l->l_next) { @@ -49,7 +49,7 @@ __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, } /* Release the lock. */ - __libc_lock_unlock_recursive (_dl_load_lock); + __libc_lock_unlock_recursive (GL(dl_load_lock)); return ret; } diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c index f10ff47..695ce54 100644 --- a/elf/dl-lookup.c +++ b/elf/dl-lookup.c @@ -94,7 +94,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map) return 0; /* Make sure nobody can unload the object while we are at it. */ - __libc_lock_lock_recursive (_dl_load_lock); + __libc_lock_lock_recursive (GL(dl_load_lock)); /* Determine whether UNDEF_MAP already has a reference to MAP. First look in the normal dependencies. */ @@ -180,7 +180,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map) out: /* Release the lock. */ - __libc_lock_unlock_recursive (_dl_load_lock); + __libc_lock_unlock_recursive (GL(dl_load_lock)); return result; } diff --git a/elf/dl-misc.c b/elf/dl-misc.c index a96689e..d4d9d13 100644 --- a/elf/dl-misc.c +++ b/elf/dl-misc.c @@ -1,5 +1,5 @@ /* Miscellaneous support functions for dynamic linker - Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -80,10 +80,6 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot) } -/* Descriptor to write debug messages to. */ -int _dl_debug_fd = 2; - - /* Bare-bone printf implementation. This function only knows about the formats and flags needed and can handle only up to 64 stripes in the output. */ @@ -250,7 +246,7 @@ _dl_debug_printf (const char *fmt, ...) va_list arg; va_start (arg, fmt); - _dl_debug_vdprintf (_dl_debug_fd, 1, fmt, arg); + _dl_debug_vdprintf (GL(dl_debug_fd), 1, fmt, arg); va_end (arg); } @@ -262,7 +258,7 @@ _dl_debug_printf_c (const char *fmt, ...) va_list arg; va_start (arg, fmt); - _dl_debug_vdprintf (_dl_debug_fd, -1, fmt, arg); + _dl_debug_vdprintf (GL(dl_debug_fd), -1, fmt, arg); va_end (arg); } diff --git a/elf/dl-open.c b/elf/dl-open.c index 2f82e4c..56b6cbb 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -259,7 +259,7 @@ dl_open_worker (void *a) #endif /* Only do lazy relocation if `LD_BIND_NOW' is not set. */ - lazy = (mode & RTLD_BINDING_MASK) == RTLD_LAZY && _dl_lazy; + lazy = (mode & RTLD_BINDING_MASK) == RTLD_LAZY && GL(dl_lazy); /* Relocate the objects loaded. We do this in reverse order so that copy relocs of earlier objects overwrite the data written by later objects. */ @@ -400,7 +400,7 @@ _dl_open (const char *file, int mode, const void *caller) _dl_signal_error (EINVAL, file, NULL, N_("invalid mode for dlopen()")); /* Make sure we are alone. */ - __libc_lock_lock_recursive (_dl_load_lock); + __libc_lock_lock_recursive (GL(dl_load_lock)); args.file = file; args.mode = mode; @@ -414,7 +414,7 @@ _dl_open (const char *file, int mode, const void *caller) #endif /* Release the lock. */ - __libc_lock_unlock_recursive (_dl_load_lock); + __libc_lock_unlock_recursive (GL(dl_load_lock)); if (errstring) { diff --git a/elf/dl-support.c b/elf/dl-support.c index 0efbcc4..b78b79d 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -27,6 +27,7 @@ #include <ldsodefs.h> #include <dl-machine.h> #include <bits/libc-lock.h> +#include <dl-cache.h> #include <dl-librecon.h> #include <unsecvars.h> #include <hp-timing.h> @@ -119,6 +120,11 @@ struct r_search_path_elem *_dl_init_all_dirs; /* The object to be initialized first. */ struct link_map *_dl_initfirst; +/* Descriptor to write debug messages to. */ +int _dl_debug_fd = STDERR_FILENO; + +int _dl_correct_cache_id = _DL_CACHE_DEFAULT_ID; + /* During the program run we must not modify the global data of loaded shared object simultanously in two threads. Therefore we protect `_dl_open' and `_dl_close' in dl-close.c. diff --git a/elf/do-lookup.h b/elf/do-lookup.h index 65f7b02..18d1ab5 100644 --- a/elf/do-lookup.h +++ b/elf/do-lookup.h @@ -160,7 +160,7 @@ FCT (const char *undef_name, unsigned long int hash, const ElfW(Sym) *ref, { case STB_WEAK: /* Weak definition. Use this value if we don't find another. */ - if (__builtin_expect (_dl_dynamic_weak, 0)) + if (__builtin_expect (GL(dl_dynamic_weak), 0)) { if (! result->s) { @@ -33,6 +33,8 @@ #include "dynamic-link.h" #include "dl-librecon.h" #include <unsecvars.h> +#include <dl-cache.h> +#include <dl-procinfo.h> #include <assert.h> @@ -58,25 +60,6 @@ static void process_envvars (enum mode *modep); int _dl_argc; char **_dl_argv; unsigned int _dl_skip_args; /* Nonzero if we were run directly. */ -fpu_control_t _dl_fpu_control = _FPU_DEFAULT; -int _dl_lazy = 1; -/* XXX I know about at least one case where we depend on the old weak - behavior (it has to do with librt). Until we get DSO groups implemented - we have to make this the default. Bummer. --drepper */ -#if 0 -int _dl_dynamic_weak; -#else -int _dl_dynamic_weak = 1; -#endif - -/* During the program run we must not modify the global data of - loaded shared object simultanously in two threads. Therefore we - protect `_dl_open' and `_dl_close' in dl-close.c. - - This must be a recursive lock since the initializer function of - the loaded object might as well require a call to this function. - At this time it is not anymore a problem to modify the tables. */ -__libc_lock_define_initialized_recursive (, _dl_load_lock) /* Set nonzero during loading and initialization of executable and libraries, cleared before the executable's entry point runs. This @@ -89,7 +72,26 @@ int _dl_starting_up; /* This is the structure which defines all variables global to ld.so (except those which cannot be added for some reason). */ -struct rtld_global _rtld_global; +struct rtld_global _rtld_global = + { + ._dl_debug_fd = STDERR_FILENO, +#if 1 + /* XXX I know about at least one case where we depend on the old + weak behavior (it has to do with librt). Until we get DSO + groups implemented we have to make this the default. + Bummer. --drepper */ + ._dl_dynamic_weak = 1, +#endif + ._dl_lazy = 1, + ._dl_fpu_control = _FPU_DEFAULT, + ._dl_correct_cache_id = _DL_CACHE_DEFAULT_ID, + ._dl_hwcap_mask = HWCAP_IMPORTANT, + ._dl_load_lock = _LIBC_LOCK_RECURSIVE_INITIALIZER + }; +/* There must only be the definition in ld.so itself. */ +#ifdef HAVE_PROTECTED +asm (".protected _rtld_global"); +#endif static void dl_main (const ElfW(Phdr) *phdr, @@ -418,7 +420,7 @@ dl_main (const ElfW(Phdr) *phdr, if (! strcmp (_dl_argv[1], "--list")) { mode = list; - _dl_lazy = -1; /* This means do no dependency analysis. */ + GL(dl_lazy) = -1; /* This means do no dependency analysis. */ ++_dl_skip_args; --_dl_argc; @@ -941,13 +943,13 @@ of this helper program; chances are you did not intend to run this program.\n\ else { /* If LD_WARN is set warn about undefined symbols. */ - if (_dl_lazy >= 0 && GL(dl_verbose)) + if (GL(dl_lazy) >= 0 && GL(dl_verbose)) { /* We have to do symbol dependency testing. */ struct relocate_args args; struct link_map *l; - args.lazy = _dl_lazy; + args.lazy = GL(dl_lazy); l = GL(dl_loaded); while (l->l_next) @@ -1142,7 +1144,7 @@ of this helper program; chances are you did not intend to run this program.\n\ #endif /* If we are profiling we also must do lazy reloaction. */ - _dl_lazy |= consider_profiling; + GL(dl_lazy) |= consider_profiling; l = GL(dl_loaded); while (l->l_next) @@ -1163,7 +1165,7 @@ of this helper program; chances are you did not intend to run this program.\n\ } if (l != &GL(dl_rtld_map)) - _dl_relocate_object (l, l->l_scope, _dl_lazy, consider_profiling); + _dl_relocate_object (l, l->l_scope, GL(dl_lazy), consider_profiling); l = l->l_prev; } @@ -1327,6 +1329,7 @@ process_dl_debug (const char *dl_debug) && debopts[cnt].name[len] == '\0') { GL(dl_debug_mask) |= debopts[cnt].mask; + any_debug = 1; break; } @@ -1428,7 +1431,7 @@ process_envvars (enum mode *modep) /* Do we bind early? */ if (memcmp (envline, "BIND_NOW", 8) == 0) { - _dl_lazy = envline[9] == '\0'; + GL(dl_lazy) = envline[9] == '\0'; break; } if (memcmp (envline, "BIND_NOT", 8) == 0) @@ -1471,7 +1474,7 @@ process_envvars (enum mode *modep) } if (memcmp (envline, "DYNAMIC_WEAK", 12) == 0) - _dl_dynamic_weak = 1; + GL(dl_dynamic_weak) = 1; break; case 14: @@ -1553,10 +1556,10 @@ process_envvars (enum mode *modep) *--startp = '.'; startp = memcpy (startp - name_len, debug_output, name_len); - _dl_debug_fd = __open (startp, flags, DEFFILEMODE); - if (_dl_debug_fd == -1) + GL(dl_debug_fd) = __open (startp, flags, DEFFILEMODE); + if (GL(dl_debug_fd) == -1) /* We use standard output if opening the file failed. */ - _dl_debug_fd = STDOUT_FILENO; + GL(dl_debug_fd) = STDOUT_FILENO; } } diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 43e192f..93620d2 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,8 @@ +2002-01-31 Ulrich Drepper <drepper@redhat.com> + + * pthread.c: _dl_cpuclock_offset is not any longer a global variable + in SHARED code, use GL(dl_cpuclock_offset). + 2002-01-28 Andreas Jaeger <aj@suse.de> * sysdeps/mips/pspinlock.c (__pthread_spin_init): Clear *LOCK to diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c index 1a2888f..2901d9c 100644 --- a/linuxthreads/pthread.c +++ b/linuxthreads/pthread.c @@ -30,6 +30,7 @@ #include "internals.h" #include "spinlock.h" #include "restart.h" +#include <ldsodefs.h> /* We need the global/static resolver state here. */ #include <resolv.h> @@ -225,11 +226,6 @@ static void pthread_handle_sigcancel(int sig); static void pthread_handle_sigrestart(int sig); static void pthread_handle_sigdebug(int sig); -/* CPU clock handling. */ -#if HP_TIMING_AVAIL -extern hp_timing_t _dl_cpuclock_offset; -#endif - /* Signal numbers used for the communication. In these variables we keep track of the used variables. If the platform does not support any real-time signals we will define the @@ -396,7 +392,7 @@ __pthread_initialize_minimal(void) INIT_THREAD_SELF(&__pthread_initial_thread, 0); #endif #if HP_TIMING_AVAIL - __pthread_initial_thread.p_cpuclock_offset = _dl_cpuclock_offset; + __pthread_initial_thread.p_cpuclock_offset = GL(dl_cpuclock_offset); #endif } diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 7b6dcec..9e4c6f4 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. Alpha version. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson <rth@tamu.edu>. @@ -110,11 +110,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { *(Elf64_Addr *)(plt + 16) = (Elf64_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) { /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } } @@ -328,7 +328,7 @@ $fixup_stack_ret: \n\ " RTLD_START_SPECIAL_INIT " \n\ /* Call _dl_init(_dl_loaded, argc, argv, envp) to run \n\ initializers. */ \n\ - ldq $16, _dl_loaded \n\ + ldq $16, _rtld_global \n\ ldq $17, 0($sp) \n\ lda $18, 8($sp) \n\ s8addq $17, 8, $19 \n\ @@ -498,7 +498,7 @@ elf_machine_rela (struct link_map *map, { unsigned long int const r_type = ELF64_R_TYPE (reloc->r_info); -#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC +#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC && !defined SHARED /* This is defined in rtld.c, but nowhere in the static libc.a; make the reference weak so static programs can still link. This declaration cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) @@ -515,7 +515,7 @@ elf_machine_rela (struct link_map *map, { # if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC /* Already done in dynamic linker. */ - if (map != &_dl_rtld_map) + if (map != &GL(dl_rtld_map)) # endif { /* XXX Make some timings. Maybe it's preverable to test for diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 73edd77..4c302b5 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. ARM version. - Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,98,99,2000,2001,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -109,10 +109,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf32_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) /* Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } else /* This function will get called to fix up the GOT entry indicated by @@ -324,7 +324,7 @@ _dl_start_user: .L_STACK_END: .word __libc_stack_end(GOT) .L_LOADED: - .word _dl_loaded(GOT) + .word _rtld_global(GOT) .previous\n\ "); @@ -347,14 +347,12 @@ _dl_start_user: _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -extern const char *_dl_platform; - static inline void __attribute__ ((unused)) dl_platform_init (void) { - if (_dl_platform != NULL && *_dl_platform == '\0') + if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; + GL(dl_platform) = NULL; } static inline Elf32_Addr @@ -452,7 +450,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, found. */ break; if (sym->st_size > refsym->st_size - || (_dl_verbose && sym->st_size < refsym->st_size)) + || (GL(dl_verbose) && sym->st_size < refsym->st_size)) { const char *strtab; @@ -484,7 +482,9 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ +# ifndef SHARED weak_extern (_dl_rtld_map); +# endif if (map == &_dl_rtld_map) /* Undo the relocation done here during bootstrapping. Now we will relocate it anew, possibly using a diff --git a/sysdeps/cris/dl-machine.h b/sysdeps/cris/dl-machine.h index e4778e3..ff27005 100644 --- a/sysdeps/cris/dl-machine.h +++ b/sysdeps/cris/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. CRIS version. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -106,11 +106,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf32_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) { /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } } else @@ -212,7 +212,7 @@ _dl_start_user: move.d $sp,$r12 addq 4,$r12 ; main_map: at _dl_loaded. - move.d [$r0+_dl_loaded:GOT16],$r9 + move.d [$r0+_rtld_global:GOT16],$r9 move.d [$r9],$r10 move.d _dl_init:PLTG,$r9 add.d $r0,$r9 @@ -246,14 +246,12 @@ _dl_start_user: _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -extern const char *_dl_platform; - static inline void __attribute__ ((unused)) dl_platform_init (void) { - if (_dl_platform != NULL && *_dl_platform == '\0') + if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; + GL(dl_platform) = NULL; } static inline Elf32_Addr @@ -314,7 +312,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, found. */ break; if (sym->st_size > refsym->st_size - || (_dl_verbose && sym->st_size < refsym->st_size)) + || (GL(dl_verbose) && sym->st_size < refsym->st_size)) { extern char **_dl_argv; const char *strtab; diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index 7ba00e4..3800a67 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -38,10 +38,6 @@ static size_t cachesize; /* 1 if cache_data + PTR points into the cache. */ #define _dl_cache_verify_ptr(ptr) (ptr < cache_data_size) -/* This is the cache ID we expect. Normally it is 3 for glibc linked - binaries. */ -int _dl_correct_cache_id = _DL_CACHE_DEFAULT_ID; - #define SEARCH_CACHE(cache) \ /* We use binary search since the table is sorted in the cache file. \ The first matching entry in the table is returned. \ @@ -111,12 +107,12 @@ do \ if (_dl_cache_check_flags (flags) \ && _dl_cache_verify_ptr (lib->value)) \ { \ - if (best == NULL || flags == _dl_correct_cache_id) \ + if (best == NULL || flags == GL(dl_correct_cache_id)) \ { \ HWCAP_CHECK; \ best = cache_data + lib->value; \ \ - if (flags == _dl_correct_cache_id) \ + if (flags == GL(dl_correct_cache_id)) \ /* We've found an exact match for the shared \ object and no general `ELF' release. Stop \ searching. */ \ diff --git a/sysdeps/generic/dl-origin.c b/sysdeps/generic/dl-origin.c index 273ffeb..db990e6 100644 --- a/sysdeps/generic/dl-origin.c +++ b/sysdeps/generic/dl-origin.c @@ -1,5 +1,5 @@ /* Find path of executable. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -25,9 +25,6 @@ #include <dl-dst.h> -/* Generally it is not possible to implement this. We have to fall - back on a solution where the user provides the information. */ -extern const char *_dl_origin_path; const char * _dl_get_origin (void) @@ -35,15 +32,15 @@ _dl_get_origin (void) char *result = (char *) -1; /* We use the environment variable LD_ORIGIN_PATH. If it is set make a copy and strip out trailing slashes. */ - if (_dl_origin_path != NULL) + if (GL(dl_origin_path) != NULL) { - size_t len = strlen (_dl_origin_path); - result = malloc (len + 1); + size_t len = strlen (GL(dl_origin_path)); + result = (char *) malloc (len + 1); if (result == NULL) result = (char *) -1; else { - char *cp = __mempcpy (result, _dl_origin_path, len); + char *cp = __mempcpy (result, GL(dl_origin_path), len); while (cp > result + 1 && cp[-1] == '/') --cp; *cp = '\0'; diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index f8b8ac1..d3d5a8c 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -39,7 +39,6 @@ #include <hp-timing.h> extern char **_environ; -extern fpu_control_t _dl_fpu_control; extern void _end; /* Protect SUID program against misuse of file descriptors. */ @@ -54,10 +53,6 @@ int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion /* This variable contains the lowest stack address ever used. */ void *__libc_stack_end; static ElfW(auxv_t) *_dl_auxv; -//Xunsigned long int _dl_hwcap_mask = HWCAP_IMPORTANT; -#if HP_TIMING_AVAIL -hp_timing_t _dl_cpuclock_offset; -#endif #ifndef DL_FIND_ARG_COMPONENTS # define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp) \ @@ -95,7 +90,7 @@ _dl_sysdep_start (void **start_argptr, #endif #if HP_TIMING_AVAIL - HP_TIMING_NOW (_dl_cpuclock_offset); + HP_TIMING_NOW (GL(dl_cpuclock_offset)); #endif DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, _dl_argv, _environ, @@ -146,7 +141,7 @@ _dl_sysdep_start (void **start_argptr, GL(dl_clktck) = av->a_un.a_val; break; case AT_FPUCW: - _dl_fpu_control = av->a_un.a_val; + GL(dl_fpu_control) = av->a_un.a_val; break; } diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 5230332..3249105 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -29,10 +29,12 @@ #include <elf.h> #include <dlfcn.h> +#include <fpu_control.h> #include <sys/mman.h> #include <link.h> #include <dl-lookupcfg.h> #include <bits/libc-lock.h> +#include <hp-timing.h> __BEGIN_DECLS @@ -234,6 +236,15 @@ struct rtld_global /* Cached value of `getpagesize ()'. */ EXTERN size_t _dl_pagesize; + /* During the program run we must not modify the global data of + loaded shared object simultanously in two threads. Therefore we + protect `_dl_open' and `_dl_close' in dl-close.c. + + This must be a recursive lock since the initializer function of + the loaded object might as well require a call to this function. + At this time it is not anymore a problem to modify the tables. */ + __libc_lock_define_recursive (EXTERN, _dl_load_lock) + /* OS version. */ EXTERN unsigned int _dl_osversion; /* Platform name. */ @@ -251,12 +262,27 @@ struct rtld_global /* If nonzero print warnings messages. */ EXTERN int _dl_verbose; + /* Do we do lazy relocations? */ + EXTERN int _dl_lazy; + /* Nonzero if runtime lookups should not update the .got/.plt. */ EXTERN int _dl_bind_not; + /* Nonzero if references should be treated as weak during runtime + linking. */ + EXTERN int _dl_dynamic_weak; + + /* Default floating-point control word. */ + EXTERN fpu_control_t _dl_fpu_control; + /* The object to be initialized first. */ EXTERN struct link_map *_dl_initfirst; + /* Start time on CPU clock. */ +#if HP_TIMING_AVAIL + EXTERN hp_timing_t _dl_cpuclock_offset; +#endif + /* Name of the shared object to be profiled (if any). */ EXTERN const char *_dl_profile; /* Map of shared object to be profiled. */ @@ -268,7 +294,7 @@ struct rtld_global /* Name of the object we want to trace the prelinking. */ EXTERN const char *_dl_trace_prelink; - /* Expect cache ID. */ + /* Expected cache ID. */ EXTERN int _dl_correct_cache_id; /* Counters for the number of relocations performed. */ @@ -291,6 +317,9 @@ struct rtld_global EXTERN struct r_search_path_elem *_dl_all_dirs; EXTERN struct r_search_path_elem *_dl_init_all_dirs; + /* File descriptor to write debug messages to. */ + EXTERN int _dl_debug_fd; + /* Structure describing the dynamic linker itself. */ EXTERN struct link_map _dl_rtld_map; #ifdef SHARED @@ -303,22 +332,9 @@ extern struct rtld_global _rtld_global; extern int _dl_argc; extern char **_dl_argv; -/* Do we do lazy relocations? */ -extern int _dl_lazy; - /* The array with message we print as a last resort. */ extern const char _dl_out_of_memory[]; -/* File descriptor to write debug messages to. */ -extern int _dl_debug_fd; - -/* Nonzero if references should be treated as weak during runtime - linking. - - XXX Once we can set the default for this variable to zero move it - into _rtld_global. */ -extern int _dl_dynamic_weak; - /* OS-dependent function to open the zero-fill device. */ extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */ diff --git a/sysdeps/hppa/dl-fptr.c b/sysdeps/hppa/dl-fptr.c index 4f8cc8b..f8b6424 100644 --- a/sysdeps/hppa/dl-fptr.c +++ b/sysdeps/hppa/dl-fptr.c @@ -1,5 +1,5 @@ /* Make dynamic PLABELs for function pointers. HPPA version. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -44,10 +44,9 @@ static int __hppa_fptr_lock = 1; #ifdef MAP_ANON /* The fd is not examined when using MAP_ANON. */ -#define ANONFD -1 +# define ANONFD -1 #else -extern int _dl_zerofd; -#define ANONFD _dl_zerofd +# define ANONFD GL(dl_zerofd) #endif struct hppa_fptr __boot_ldso_fptr[HPPA_BOOT_FPTR_SIZE]; @@ -95,10 +94,10 @@ __hppa_make_fptr (const struct link_map *sym_map, Elf32_Addr value, { #ifndef MAP_ANON # define MAP_ANON 0 - if (_dl_zerofd == -1) + if (GL(dl_zerofd) == -1) { - _dl_zerofd = _dl_sysdep_open_zero_fill (); - if (_dl_zerofd == -1) + GL(dl_zerofd) = _dl_sysdep_open_zero_fill (); + if (GL(dl_zerofd) == -1) { __close (fd); _dl_signal_error (errno, NULL, NULL, @@ -107,11 +106,11 @@ __hppa_make_fptr (const struct link_map *sym_map, Elf32_Addr value, } #endif - __fptr_next = __mmap (0, _dl_pagesize, PROT_READ | PROT_WRITE, + __fptr_next = __mmap (0, GL(dl_pagesize), PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, ANONFD, 0); if (__fptr_next == MAP_FAILED) _dl_signal_error(errno, NULL, NULL, "cannot map page for fptr"); - __fptr_count = _dl_pagesize / sizeof (struct hppa_fptr); + __fptr_count = GL(dl_pagesize) / sizeof (struct hppa_fptr); } f = __fptr_next++; __fptr_count--; diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h index d13f15b..449fa9d 100644 --- a/sysdeps/hppa/dl-machine.h +++ b/sysdeps/hppa/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. PA-RISC version. - Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1995-1997,1999,2000,2001,2002 Free Software Foundation, Inc. Contributed by David Huggins-Daines <dhd@debian.org> This file is part of the GNU C Library. @@ -227,12 +227,12 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) ((unsigned long) &_dl_runtime_resolve & ~3))->func; else { - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) { /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } got[-2] = (Elf32_Addr) ((struct hppa_fptr *) @@ -362,8 +362,8 @@ asm ( \ " stw %r24,-44(%sp)\n" \ \ ".Lnofix:\n" \ -" addil LT'_dl_loaded,%r19\n" \ -" ldw RT'_dl_loaded(%r1),%r26\n" \ +" addil LT'_rtld_global,%r19\n" \ +" ldw RT'_rtld_global(%r1),%r26\n" \ " bl set_dp, %r2\n" \ " ldw 0(%r26),%r26\n" \ \ @@ -488,13 +488,13 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, struct link_map *sym_map; Elf32_Addr value; -#ifndef RTLD_BOOTSTRAP +#if !defined RTLD_BOOTSTRAP && !defined SHARED /* This is defined in rtld.c, but nowhere in the static libc.a; make the reference weak so static programs can still link. This declaration cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ - weak_extern (_dl_rtld_map); + weak_extern (GL(dl_rtld_map)); #endif /* RESOLVE_MAP will return a null value for undefined syms, and @@ -527,7 +527,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, other ones will have their values reset. In particular, __fptr_next will be reset, sometimes causing endless loops in __hppa_make_fptr(). So don't do that. */ - if (map == &_dl_rtld_map) + if (map == &GL(dl_rtld_map)) return; #endif /* .eh_frame can have unaligned relocs. */ @@ -604,7 +604,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, break; if (__builtin_expect (sym->st_size > refsym->st_size, 0) || (__builtin_expect (sym->st_size < refsym->st_size, 0) - && __builtin_expect (_dl_verbose, 0))) + && __builtin_expect (GL(dl_verbose), 0))) { const char *strtab; diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 338dbfb..66392da 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -328,8 +328,10 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ +# ifndef SHARED weak_extern (_dl_rtld_map); - if (map != &_dl_rtld_map) /* Already done in rtld itself. */ +# endif + if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */ # endif *reloc_addr += map->l_addr; } diff --git a/sysdeps/i386/i686/Versions b/sysdeps/i386/i686/Versions deleted file mode 100644 index 4242ca4..0000000 --- a/sysdeps/i386/i686/Versions +++ /dev/null @@ -1,5 +0,0 @@ -ld { - GLIBC_2.2.3 { - _dl_cpuclock_offset; - } -} diff --git a/sysdeps/ia64/Versions b/sysdeps/ia64/Versions index b1df498..1e1387f 100644 --- a/sysdeps/ia64/Versions +++ b/sysdeps/ia64/Versions @@ -4,7 +4,4 @@ ld { _dl_symbol_address; _dl_unmap; _dl_lookup_address; _dl_function_address; } - GLIBC_2.2.3 { - _dl_cpuclock_offset; - } } diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index b81cf29..04381fe 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. IA-64 version. - Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,2000,2001,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -508,7 +508,7 @@ elf_machine_rela (struct link_map *map, const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info); Elf64_Addr value; -#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC +#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC && !defined SHARED /* This is defined in rtld.c, but nowhere in the static libc.a; make the reference weak so static programs can still link. This declaration cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index d9c8194..bd2d1e2 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. m68k version. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -85,11 +85,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf32_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) { /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } } else @@ -176,7 +176,7 @@ _dl_start_user: pea 8(%sp, %d1*4) pea 8(%sp) move.l %d1, -(%sp) - move.l ([_dl_loaded@GOT.w, %a5]), -(%sp) + move.l ([_rtld_global@GOT.w, %a5]), -(%sp) jbsr _dl_init@PLTPC addq.l #8, %sp addq.l #8, %sp @@ -251,7 +251,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, found. */ break; if (sym->st_size > refsym->st_size - || (sym->st_size < refsym->st_size && _dl_verbose)) + || (sym->st_size < refsym->st_size && GL(dl_verbose))) { extern char **_dl_argv; const char *strtab; diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index a17e92a..596f161 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -1,5 +1,5 @@ /* Operating system support for run-time dynamic linker. Hurd version. - Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,98,99,2000,2001,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -52,7 +52,6 @@ int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion of init-first. */ /* This variable containts the lowest stack address ever used. */ void *__libc_stack_end; -unsigned long int _dl_hwcap_mask = HWCAP_IMPORTANT; struct hurd_startup_data *_dl_hurd_data; @@ -236,7 +235,7 @@ unfmh(); /* XXX */ __mach_init (); /* Initialize frequently used global variable. */ - _dl_pagesize = __getpagesize (); + GL(dl_pagesize) = __getpagesize (); fmh(); /* XXX */ diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index de51069..4c28e17 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -216,7 +216,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc) } { - struct link_map *l = _dl_loaded; + struct link_map *l = GL(dl_loaded); while (l) { @@ -441,7 +441,7 @@ _dl_start_user:\n\ # Save back the modified argument count.\n\ sw $4, 0($29)\n\ 1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\ - lw $4, _dl_loaded\n\ + lw $4, _rtld_global\n\ lw $5, 0($29)\n\ la $6, 4($29)\n\ sll $7, $5, 2\n\ @@ -477,14 +477,14 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc, { const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info); -#ifndef RTLD_BOOTSTRAP +#if !defined RTLD_BOOTSTRAP && !defined SHARED /* This is defined in rtld.c, but nowhere in the static libc.a; make the reference weak so static programs can still link. This declaration cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ - weak_extern (_dl_rtld_map); + weak_extern (GL(dl_rtld_map)); #endif switch (r_type) @@ -501,7 +501,7 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc, if (symidx < gotsym) { #ifndef RTLD_BOOTSTRAP - if (map != &_dl_rtld_map) + if (map != &GL(dl_rtld_map)) #endif *reloc_addr += sym->st_value + map->l_addr; } @@ -520,7 +520,7 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc, } else #ifndef RTLD_BOOTSTRAP - if (map != &_dl_rtld_map) + if (map != &GL(dl_rtld_map)) #endif *reloc_addr += map->l_addr; } @@ -561,7 +561,7 @@ elf_machine_got_rel (struct link_map *map, int lazy) ({ \ const ElfW(Sym) *ref = sym; \ const struct r_found_version *version \ - = vernum ? &map->l_versions [vernum [sym_index]] : NULL; \ + = vernum ? &map->l_versions[vernum[sym_index]] : NULL; \ ElfW(Addr) value; \ value = RESOLVE (&ref, version, R_MIPS_REL32); \ (ref)? value + ref->st_value: 0; \ @@ -576,7 +576,7 @@ elf_machine_got_rel (struct link_map *map, int lazy) n = map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val; /* The dynamic linker's local got entries have already been relocated. */ - if (map != &_dl_rtld_map) + if (map != &GL(dl_rtld_map)) { /* got[0] is reserved. got[1] is also reserved for the dynamic object generated by gnu ld. Skip these reserved entries from relocation. */ diff --git a/sysdeps/mips/mips64/dl-machine.h b/sysdeps/mips/mips64/dl-machine.h index d51f1e3..7ee3cf5 100644 --- a/sysdeps/mips/mips64/dl-machine.h +++ b/sysdeps/mips/mips64/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. MIPS64 version. - Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1999,2000,2001,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>. @@ -289,7 +289,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc) } { - struct link_map *l = _dl_loaded; + struct link_map *l = GL(dl_loaded); while (l) { @@ -480,7 +480,7 @@ _dl_start_user:\n\ # Save back the modified argument count.\n\ sd $4, 0($29)\n\ 1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\ - ld $4, _dl_loaded\n\ + ld $4, _rtld_global\n\ ld $5, 0($29)\n\ dla $6, 4($29)\n\ dla $7, 8($29)\n\ @@ -492,7 +492,7 @@ _dl_start_user:\n\ dla $31, _dl_fini\n\ # Jump to the user entry point.\n\ 1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\ - lw $4, _dl_loaded\n\ + lw $4, _rtld_global\n\ lw $5, 0($29)\n\ la $6, 4($29)\n\ la $7, 8($29)\n\ @@ -553,8 +553,10 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc, RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ - weak_extern (_dl_rtld_map); - if (map == &_dl_rtld_map) +# ifndef SHARED + weak_extern (GL(dl_rtld_map)); +# endif + if (map == &GL(dl_rtld_map)) /* Undo the relocation done here during bootstrapping. Now we will relocate it anew, possibly using a binding found in the user program or a loaded library rather than the dynamic linker's diff --git a/sysdeps/powerpc/dl-machine.c b/sysdeps/powerpc/dl-machine.c index 0e3164f..7081466 100644 --- a/sysdeps/powerpc/dl-machine.c +++ b/sysdeps/powerpc/dl-machine.c @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation functions. PowerPC version. - Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1995-2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -112,11 +112,11 @@ __elf_preferred_address(struct link_map *loader, size_t maplength, be superceded by the program's load address). */ low = 0x0003FFFF; high = 0x70000000; - for (l = _dl_loaded; l; l = l->l_next) + for (l = GL(dl_loaded); l; l = l->l_next) { ElfW(Addr) mapstart, mapend; - mapstart = l->l_map_start & ~(_dl_pagesize - 1); - mapend = l->l_map_end | (_dl_pagesize - 1); + mapstart = l->l_map_start & ~(GL(dl_pagesize) - 1); + mapend = l->l_map_end | (GL(dl_pagesize) - 1); assert (mapend > mapstart); /* Prefer gaps below the main executable, note that l == @@ -137,7 +137,7 @@ __elf_preferred_address(struct link_map *loader, size_t maplength, } high -= 0x10000; /* Allow some room between objects. */ - maplength = (maplength | (_dl_pagesize-1)) + 1; + maplength = (maplength | (GL(dl_pagesize) - 1)) + 1; if (high <= low || high - low < maplength ) return 0; return high - maplength; /* Both high and maplength are page-aligned. */ @@ -235,10 +235,10 @@ __elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) : _dl_runtime_resolve); Elf32_Word offset; - if (profile && _dl_name_match_p (_dl_profile, map)) + if (profile && _dl_name_match_p (GL(dl_profile), map)) /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = map; + GL(dl_profile_map) = map; /* For the long entries, subtract off data_words. */ tramp[0] = OPCODE_ADDIS_HI (11, 11, -data_words); @@ -467,7 +467,7 @@ __process_machine_rela (struct link_map *map, found. */ return; if (sym->st_size > refsym->st_size - || (_dl_verbose && sym->st_size < refsym->st_size)) + || (GL(dl_verbose) && sym->st_size < refsym->st_size)) { const char *strtab; diff --git a/sysdeps/powerpc/dl-start.S b/sysdeps/powerpc/dl-start.S index beb9262..1bca5d5 100644 --- a/sysdeps/powerpc/dl-start.S +++ b/sysdeps/powerpc/dl-start.S @@ -1,5 +1,5 @@ /* Machine-dependent ELF startup code. PowerPC version. - Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1995-2000, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -52,7 +52,7 @@ ENTRY(_dl_start_user) /* the address of _start in r30, */ mr r30,r3 /* &_dl_argc in 29, &_dl_argv in 27, and _dl_loaded in 28. */ - lwz r28,_dl_loaded@got(r31) + lwz r28,_rtld_global@got(r31) lwz r29,_dl_argc@got(r31) lwz r27,_dl_argv@got(r31) diff --git a/sysdeps/powerpc/elf/libc-start.c b/sysdeps/powerpc/elf/libc-start.c index 99dc436..e20fd04 100644 --- a/sysdeps/powerpc/elf/libc-start.c +++ b/sysdeps/powerpc/elf/libc-start.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,2000,01,02 Free Software Foundation, Inc. +/* Copyright (C) 1998,2000,2001,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -96,7 +96,7 @@ BP_SYM (__libc_start_main) (int argc, char *__unbounded *__unbounded ubp_av, /* Call the initializer of the libc. */ #ifdef SHARED - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0)) + if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) _dl_debug_printf ("\ninitialize libc\n\n"); #endif __libc_init_first (argc, argv, __environ); @@ -107,14 +107,14 @@ BP_SYM (__libc_start_main) (int argc, char *__unbounded *__unbounded ubp_av, /* Call the initializer of the program, if any. */ #ifdef SHARED - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0)) + if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) _dl_debug_printf ("\ninitialize program: %s\n\n", argv[0]); #endif if (stinfo->init) stinfo->init (argc, argv, __environ, auxvec); #ifdef SHARED - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0)) + if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) _dl_debug_printf ("\ntransferring control: %s\n\n", argv[0]); #endif diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h index 2207dd4..2c7ba2e 100644 --- a/sysdeps/s390/s390-32/dl-machine.h +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. S390 Version. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Carl Pederson & Martin Schwidefsky. This file is part of the GNU C Library. @@ -112,10 +112,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf32_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } else /* This function will get called to fix up the GOT entry indicated by @@ -287,7 +287,7 @@ _dl_start_user:\n\ # Call the function to run the initializers.\n\ # Load the parameters:\n\ # (%r2, %r3, %r4, %r5) = (_dl_loaded, argc, argv, envp)\n\ - l %r2,_dl_loaded@GOT(%r12)\n\ + l %r2,_rtld_global@GOT(%r12)\n\ l %r2,0(%r2)\n\ l %r3,96(%r15)\n\ la %r4,100(%r15)\n\ @@ -333,14 +333,12 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -extern const char *_dl_platform; - static inline void __attribute__ ((unused)) dl_platform_init (void) { - if (_dl_platform != NULL && *_dl_platform == '\0') + if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; + GL(dl_platform) = NULL; } static inline Elf32_Addr @@ -401,7 +399,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, break; if (__builtin_expect (sym->st_size > refsym->st_size, 0) || (__builtin_expect (sym->st_size < refsym->st_size, 0) - && __builtin_expect (_dl_verbose, 0))) + && __builtin_expect (GL(dl_verbose), 0))) { const char *strtab; diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h index 25294fc..a6df8dd 100644 --- a/sysdeps/s390/s390-64/dl-machine.h +++ b/sysdeps/s390/s390-64/dl-machine.h @@ -1,6 +1,6 @@ /* Machine-dependent ELF dynamic relocation inline functions. 64 bit S/390 Version. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2002 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -105,10 +105,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf64_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } else /* This function will get called to fix up the GOT entry indicated by @@ -262,7 +262,7 @@ _dl_start_user:\n\ # Call the function to run the initializers.\n\ # Load the parameters:\n\ # (%r2, %r3, %r4, %r5) = (_dl_loaded, argc, argv, envp)\n\ - lghi %r2,_dl_loaded@GOT + lghi %r2,_rtld_global@GOT lg %r2,0(%r2,%r12)\n\ lg %r2,0(%r2)\n\ lg %r3,160(%r15)\n\ @@ -302,14 +302,12 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -extern const char *_dl_platform; - static inline void __attribute__ ((unused)) dl_platform_init (void) { - if (_dl_platform != NULL && *_dl_platform == '\0') + if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; + GL(dl_platform) = NULL; } static inline Elf64_Addr @@ -369,7 +367,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, break; if (__builtin_expect (sym->st_size > refsym->st_size, 0) || (__builtin_expect (sym->st_size < refsym->st_size, 0) - && __builtin_expect (_dl_verbose, 0))) + && __builtin_expect (GL(dl_verbose), 0))) { const char *strtab; diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index b303756..705e8d6 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. SH version. - Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -105,7 +105,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf32_Addr) &_dl_runtime_profile; /* Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } else /* This function will get called to fix up the GOT entry indicated by @@ -388,7 +388,7 @@ _dl_start_user:\n\ .L_dl_init:\n\ .long _dl_init@PLT\n\ .L_dl_loaded:\n\ - .long _dl_loaded@GOT\n\ + .long _rtld_global@GOT\n\ .L_dl_starting_up:\n\ .long _dl_starting_up@GOT\n\ .L_dl_fini:\n\ @@ -411,14 +411,12 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -extern const char *_dl_platform; - static inline void __attribute__ ((unused)) dl_platform_init (void) { - if (_dl_platform != NULL && *_dl_platform == '\0') + if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; + GL(dl_platform) = NULL; } static inline Elf32_Addr @@ -481,7 +479,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, if (__builtin_expect (r_type == R_SH_RELATIVE, 0)) { #ifndef RTLD_BOOTSTRAP - if (map != &_dl_rtld_map) /* Already done in rtld itself. */ + if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */ #endif { if (reloc->r_addend) @@ -515,7 +513,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, found. */ break; if (sym->st_size > refsym->st_size - || (sym->st_size < refsym->st_size && _dl_verbose)) + || (sym->st_size < erefsym->st_size && GL(dl_verbose))) { const char *strtab; @@ -542,8 +540,10 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ - weak_extern (_dl_rtld_map); - if (map == &_dl_rtld_map) +# ifndef SHARED + weak_extern (GL(dl_rtld_map)); +# endif + if (map == &GL(dl_rtld_map)) /* Undo the relocation done here during bootstrapping. Now we will relocate it anew, possibly using a binding found in the user program or a loaded library diff --git a/sysdeps/sparc/Versions b/sysdeps/sparc/Versions deleted file mode 100644 index 7785430..0000000 --- a/sysdeps/sparc/Versions +++ /dev/null @@ -1,6 +0,0 @@ -ld { - GLIBC_2.2.3 { - # If this symbol is ever available on SPARC it was introduced in 2.2.3. - _dl_cpuclock_offset; - } -} diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 19a3897..7544707 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. SPARC version. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -44,7 +44,8 @@ /* Use a different preload file when running in 32-bit emulation mode on a 64-bit host. */ -#define LD_SO_PRELOAD ((_dl_hwcap & HWCAP_SPARC_V9) ? "/etc/ld.so.preload32" \ +#define LD_SO_PRELOAD ((GL(dl_hwcap) & HWCAP_SPARC_V9) \ + ? "/etc/ld.so.preload32" \ : "/etc/ld.so.preload") @@ -57,13 +58,15 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr) else if (ehdr->e_machine == EM_SPARC32PLUS) { unsigned long *hwcap; +#ifndef SHARED weak_extern (_dl_hwcap); weak_extern (_dl_hwcap_mask); +#endif - hwcap = WEAKADDR(_dl_hwcap); + hwcap = WEAKADDR (GL(dl_hwcap)); /* XXX The following is wrong! Dave Miller rejected to implement it correctly. If this causes problems shoot *him*! */ - return hwcap == NULL || (*hwcap & _dl_hwcap_mask & HWCAP_SPARC_V9); + return hwcap == NULL || (*hwcap & GL(dl_hwcap_mask) & HWCAP_SPARC_V9); } else return 0; @@ -124,8 +127,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { rfunc = (Elf32_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) - _dl_profile_map = l; + if (_dl_name_match_p (GL(dl_profile), l)) + GL(dl_profile_map) = l; } /* The beginning of the PLT does: @@ -154,8 +157,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) Elf32_Rela *relaend = (Elf32_Rela *) ((char *) rela + l->l_info[DT_PLTRELSZ]->d_un.d_val); +#ifndef SHARED weak_extern (_dl_hwcap); - hwcap = WEAKADDR(_dl_hwcap); +#endif + hwcap = WEAKADDR (GL(dl_hwcap)); do_flush = (!hwcap || (*hwcap & HWCAP_SPARC_FLUSH)); /* prelink must ensure there are no R_SPARC_NONE relocs left @@ -307,9 +312,9 @@ _dl_start_user: bne 23b add %i1, 8, %i1 /* %o0 = _dl_loaded, %o1 = argc, %o2 = argv, %o3 = envp. */ -3: sethi %hi(_dl_loaded), %o0 +3: sethi %hi(_rtld_global), %o0 add %sp, 23*4, %o2 - orcc %o0, %lo(_dl_loaded), %o0 + orcc %o0, %lo(_rtld_global), %o0 sll %i5, 2, %o3 ld [%l7+%o0], %o0 add %o3, 4, %o3 @@ -337,15 +342,17 @@ sparc_fixup_plt (const Elf32_Rela *reloc, Elf32_Addr *reloc_addr, functionality on those cpu's that implement it. */ unsigned long *hwcap; int do_flush; +# ifndef SHARED weak_extern (_dl_hwcap); - hwcap = WEAKADDR(_dl_hwcap); +# endif + hwcap = WEAKADDR (GL(dl_hwcap)); do_flush = (!hwcap || (*hwcap & HWCAP_SPARC_FLUSH)); #else /* Unfortunately, this is necessary, so that we can ensure ld.so will not execute corrupt PLT entry instructions. */ const int do_flush = 1; #endif - + if (0 && disp >= -0x800000 && disp < 0x800000) { /* Don't need to worry about thread safety. We're writing just one @@ -451,7 +458,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, found. */ break; if (sym->st_size > refsym->st_size - || (_dl_verbose && sym->st_size < refsym->st_size)) + || (GL(dl_verbose) && sym->st_size < refsym->st_size)) { extern char **_dl_argv; const char *strtab; diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index 913f98a..8cfed7b 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. Sparc64 version. - Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -284,7 +284,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, found. */ break; if (sym->st_size > refsym->st_size - || (_dl_verbose && sym->st_size < refsym->st_size)) + || (GL(dl_verbose) && sym->st_size < refsym->st_size)) { extern char **_dl_argv; const char *strtab; @@ -498,8 +498,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { res0_addr = (Elf64_Addr) &_dl_runtime_profile_0; res1_addr = (Elf64_Addr) &_dl_runtime_profile_1; - if (_dl_name_match_p (_dl_profile, l)) - _dl_profile_map = l; + if (_dl_name_match_p (GL(dl_profile), l)) + GL(dl_profile_map) = l; } /* PLT0 looks like: @@ -745,9 +745,9 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) " add %i1, 16, %i1\n" \ " stx %l5, [%l4]\n" \ " /* %o0 = _dl_loaded, %o1 = argc, %o2 = argv, %o3 = envp. */\n" \ -"2: sethi %hi(_dl_loaded), %o0\n" \ +"2: sethi %hi(_rtld_global), %o0\n" \ " add %sp, " __S(STACK_BIAS) " + 23*8, %o2\n" \ -" orcc %o0, %lo(_dl_loaded), %o0\n" \ +" orcc %o0, %lo(_rtld_global), %o0\n" \ " sllx %i5, 3, %o3\n" \ " ldx [%l7 + %o0], %o0\n" \ " add %o3, 8, %o3\n" \ diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c index a86786b..5dc329e 100644 --- a/sysdeps/unix/clock_gettime.c +++ b/sysdeps/unix/clock_gettime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,7 +21,7 @@ #include <time.h> #include <sys/time.h> #include <libc-internal.h> -#include <hp-timing.h> +#include <ldsodefs.h> #if HP_TIMING_AVAIL @@ -31,10 +31,6 @@ static hp_timing_t freq; -/* We need the starting time for the process. */ -extern hp_timing_t _dl_cpuclock_offset; - - /* This function is defined in the thread library. */ extern int __pthread_clock_gettime (hp_timing_t freq, struct timespec *tp) __attribute__ ((__weak__)); @@ -86,7 +82,7 @@ clock_gettime (clockid_t clock_id, struct timespec *tp) HP_TIMING_NOW (tsc); /* Compute the offset since the start time of the process. */ - tsc -= _dl_cpuclock_offset; + tsc -= GL(dl_cpuclock_offset); /* Compute the seconds. */ tp->tv_sec = tsc / freq; diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c index 79a9b56..407e759 100644 --- a/sysdeps/unix/clock_settime.c +++ b/sysdeps/unix/clock_settime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,6 +20,7 @@ #include <time.h> #include <sys/time.h> #include <libc-internal.h> +#include <ldsodefs.h> #if HP_TIMING_AVAIL @@ -29,10 +30,6 @@ static hp_timing_t freq; -/* We need the starting time for the process. */ -extern hp_timing_t _dl_cpuclock_offset; - - /* This function is defined in the thread library. */ extern void __pthread_clock_settime (hp_timing_t offset) __attribute__ ((__weak__)); @@ -92,7 +89,7 @@ clock_settime (clockid_t clock_id, const struct timespec *tp) /* Determine the offset and use it as the new base value. */ if (clock_id != CLOCK_THREAD_CPUTIME_ID || __pthread_clock_settime == NULL) - _dl_cpuclock_offset = tsc - usertime; + GL(dl_cpuclock_offset) = tsc - usertime; else __pthread_clock_settime (tsc - usertime); diff --git a/sysdeps/unix/sysv/aix/libc-start.c b/sysdeps/unix/sysv/aix/libc-start.c index 1184664..757b349 100644 --- a/sysdeps/unix/sysv/aix/libc-start.c +++ b/sysdeps/unix/sysv/aix/libc-start.c @@ -1,5 +1,5 @@ /* Initialization code run first thing by the XCOFF startup code. AIX version. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -73,10 +73,6 @@ extern int __loadx (int flag, void *module, void *arg1, void *arg2, /* Needed by setenv */ char **__environ; -/* Needed by dl-support.c */ -/* XXX stubbing out dl-support.c for now.. - size_t _dl_pagesize = 0; */ - /* * Find __rtinit symbol * @@ -277,7 +273,7 @@ __libc_start_main (void) /* Call the initializer of the program, if any. */ #ifdef SHARED - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0)) + if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) _dl_debug_printf ("\ninitialize program: %s\n\n", __libc_start_data.argv[0]); #endif @@ -285,7 +281,7 @@ __libc_start_main (void) (*__libc_start_data.init) (); #ifdef SHARED - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0)) + if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) _dl_debug_printf ("\ntransferring control: %s\n\n", __libc_start_data.argv[0]); #endif diff --git a/sysdeps/unix/sysv/aix/start-libc.c b/sysdeps/unix/sysv/aix/start-libc.c index e3582e3..303caa7 100644 --- a/sysdeps/unix/sysv/aix/start-libc.c +++ b/sysdeps/unix/sysv/aix/start-libc.c @@ -1,5 +1,5 @@ /* Initialization code run first thing by the XCOFF startup code. AIX version. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -74,10 +74,6 @@ extern int __loadx (int flag, void *module, void *arg1, void *arg2, /* Needed by setenv */ char **__environ; -/* Needed by dl-support.c */ -/* XXX stubbing out dl-support.c for now.. - size_t _dl_pagesize = 0; */ - /* Find __rtinit symbol diff --git a/sysdeps/unix/sysv/linux/ia64/dl-static.c b/sysdeps/unix/sysv/linux/ia64/dl-static.c index f74353e..11f372d 100644 --- a/sysdeps/unix/sysv/linux/ia64/dl-static.c +++ b/sysdeps/unix/sysv/linux/ia64/dl-static.c @@ -1,5 +1,5 @@ /* Variable initialization. IA-64 version. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,8 +19,6 @@ #include <ldsodefs.h> -extern int _dl_clktck; - #ifdef SHARED void @@ -44,8 +42,8 @@ __libc_lock_define_initialized_recursive (static, _dl_static_lock) static void *variables[] = { - &_dl_pagesize, - &_dl_clktck + &GL(dl_pagesize), + &GL(dl_clktck) }; void diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c index 3cfb08d..39f53a7 100644 --- a/sysdeps/unix/sysv/linux/init-first.c +++ b/sysdeps/unix/sysv/linux/init-first.c @@ -1,5 +1,5 @@ /* Initialization code run first thing by the ELF startup code. Linux version. - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,8 +28,8 @@ #include "kernel-features.h" #include <libc-internal.h> +#include <ldsodefs.h> #ifndef SHARED -# include <ldsodefs.h> # include "dl-osinfo.h" #endif @@ -41,7 +41,6 @@ static void init (int, char **, char **) __attribute__ ((unused)); extern int _dl_starting_up; weak_extern (_dl_starting_up) -extern fpu_control_t _dl_fpu_control; extern int _dl_fpu_control_set; /* Set nonzero if we have to be prepared for more then one libc being @@ -78,7 +77,7 @@ init (int argc, char **argv, char **envp) kernel would use a different value. (In a static program we don't have this information.) */ #ifdef SHARED - if (__fpu_control != _dl_fpu_control) + if (__fpu_control != GL(dl_fpu_control)) #endif __setfpucw (__fpu_control); } diff --git a/sysdeps/unix/sysv/linux/m68k/getpagesize.c b/sysdeps/unix/sysv/linux/m68k/getpagesize.c index bbabbb1..ce1048b 100644 --- a/sysdeps/unix/sysv/linux/m68k/getpagesize.c +++ b/sysdeps/unix/sysv/linux/m68k/getpagesize.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@suse.de>. @@ -21,6 +21,7 @@ #include <sys/param.h> #include <errno.h> +#include <ldsodefs.h> #include <sysdep.h> #include <sys/syscall.h> @@ -28,13 +29,12 @@ int __getpagesize () { - extern size_t _dl_pagesize; #ifdef __NR_getpagesize int result; #endif - if (_dl_pagesize != 0) - return _dl_pagesize; + if (GL(dl_pagesize) != 0) + return GL(dl_pagesize); #ifdef __NR_getpagesize result = INLINE_SYSCALL (getpagesize, 0); diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c b/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c index db7f98b..8bd4732 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,6 +18,7 @@ #include <unistd.h> #include <sys/param.h> +#include <ldsodefs.h> /* Return the system page size. This value will either be 4k or 8k depending on whether or not we are running on Sparc v9 machine. */ @@ -26,16 +27,14 @@ via the AT_PAGESZ auxiliary argument. If we are a static program, we use the getpagesize system call. */ -size_t _dl_pagesize; - extern size_t __syscall_getpagesize(void); int __getpagesize () { - if (_dl_pagesize == 0) - _dl_pagesize = __syscall_getpagesize(); - return _dl_pagesize; + if (GL(dl_pagesize) == 0) + GL(dl_pagesize) = __syscall_getpagesize(); + return GL(dl_pagesize); } weak_alias (__getpagesize, getpagesize) diff --git a/sysdeps/x86_64/Versions b/sysdeps/x86_64/Versions deleted file mode 100644 index 42386f4..0000000 --- a/sysdeps/x86_64/Versions +++ /dev/null @@ -1,5 +0,0 @@ -ld { - GLIBC_2.2.5 { - _dl_cpuclock_offset; - } -} diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 955239d..504c75e 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. x86-64 version. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>. @@ -96,10 +96,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf64_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } else /* This function will get called to fix up the GOT entry indicated by @@ -250,7 +250,7 @@ _dl_start_user:\n\ # argc -> rsi\n\ movq %rdx, %rsi\n\ # _dl_loaded -> rdi\n\ - movq _dl_loaded@GOTPCREL(%rip), %rdi\n\ + movq _rtld_global@GOTPCREL(%rip), %rdi\n\ movq (%rdi), %rdi\n\ # env -> rcx\n\ leaq 16(%rsp,%rdx,8), %rcx\n\ @@ -283,14 +283,12 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -extern const char *_dl_platform; - static inline void __attribute__ ((unused)) dl_platform_init (void) { - if (_dl_platform != NULL && *_dl_platform == '\0') + if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; + GL(dl_platform) = NULL; } static inline Elf64_Addr @@ -334,8 +332,10 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ - weak_extern (_dl_rtld_map); - if (map != &_dl_rtld_map) /* Already done in rtld itself. */ +# ifndef SHARED + weak_extern (GL(dl_rtld_map)); +# endif + if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */ # endif *reloc_addr = map->l_addr + reloc->r_addend; } @@ -379,7 +379,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, break; if (__builtin_expect (sym->st_size > refsym->st_size, 0) || (__builtin_expect (sym->st_size < refsym->st_size, 0) - && _dl_verbose)) + && GL(dl_verbose))) { const char *strtab; |