diff options
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | Makerules | 5 | ||||
-rw-r--r-- | config.make.in | 1 | ||||
-rwxr-xr-x | configure | 109 | ||||
-rw-r--r-- | configure.in | 14 | ||||
-rw-r--r-- | conform/conformtest.pl | 1 | ||||
-rw-r--r-- | elf/dl-init.c | 120 | ||||
-rw-r--r-- | elf/dl-load.c | 7 | ||||
-rw-r--r-- | elf/elf.h | 1 | ||||
-rw-r--r-- | elf/soinit.c | 8 | ||||
-rw-r--r-- | posix/tst-fnmatch.input | 6 |
11 files changed, 179 insertions, 110 deletions
@@ -1,7 +1,24 @@ +2001-02-01 Ulrich Drepper <drepper@redhat.com> + + * Makerules (build-shlib): Add $(extra-B-$(@F:lib%.so=%).so). + * configure.in: Test for -z initfirst linker option. + * config.make.in: Add have-z-initfirst. + * elf/dl-init.c (_dl_init): Split out actual initialization code in + new function call_init. If _dl_initfirst is non-NULL initialize first. + * elf/dl-load.c (_dl_map_from_fd): If DF_1_INITFIRST flag is set + remember object in _dl_initfirst. + * elf/soinit.c: Remove special support for calling + __pthread_initialize_minimal. + + * conform/conformtest.pl: Add missing $prepend in type test. + 2001-01-31 Ulrich Drepper <drepper@redhat.com> + * elf/elf.h (SHT_CHECKSUM): New definition. + * posix/fnmatch_loop.c: Remove incorrect reverse condition in [. .] matching. Patch by Isamu Hasegawa <isamu@yamato.ibm.com>. + * posix/tst-fnmatch.input: Add tests for [. .] in locales. 2001-01-31 Mark Kettenis <kettenis@gnu.org> @@ -1,5 +1,4 @@ -# Copyright (C) 1991,92,93,94,95,96,97,98,99,2000 -# Free Software Foundation, Inc. +# Copyright (C) 1991-1999, 2000,2001 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 @@ -416,7 +415,7 @@ lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp) define build-shlib $(LINK.o) -shared -Wl,-O1 -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \ - -B$(csu-objpfx) $(load-map-file) \ + $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) $(load-map-file) \ -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \ $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \ -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \ diff --git a/config.make.in b/config.make.in index 8b8ea9e..9c15cec 100644 --- a/config.make.in +++ b/config.make.in @@ -39,6 +39,7 @@ elf = @elf@ have-protected = @libc_cv_asm_protected_directive@ have-z-nodelete = @libc_cv_z_nodelete@ have-z-nodlopen = @libc_cv_z_nodlopen@ +have-z-initfirst = @libc_cv_z_initfirst@ have-initfini = @libc_cv_have_initfini@ need-nopic-initfini = @nopic_initfini@ with-cvs = @with_cvs@ @@ -2735,16 +2735,36 @@ fi echo "$ac_t""$libc_cv_z_nodlopen" 1>&6 + + echo $ac_n "checking for -z initfirst option""... $ac_c" 1>&6 +echo "configure:2741: 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 + cat > conftest.c <<EOF +int _start (void) { return 42; } +EOF + if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -Wl,--enable-new-dtags,-z,initfirst 1>&5'; { (eval echo configure:2748: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } + then + libc_cv_z_initfirst=yes + else + libc_cv_z_initfirst=no + fi + rm -f conftest* +fi + +echo "$ac_t""$libc_cv_z_initfirst" 1>&6 + fi if test $elf != yes; then echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6 -echo "configure:2743: checking for .init and .fini sections" >&5 +echo "configure:2763: 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 2748 "configure" +#line 2768 "configure" #include "confdefs.h" int main() { @@ -2753,7 +2773,7 @@ asm (".section .init"); asm ("${libc_cv_dot_text}"); ; return 0; } EOF -if { (eval echo configure:2757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_have_initfini=yes else @@ -2776,7 +2796,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:2780: checking whether cc puts quotes around section names" >&5 +echo "configure:2800: 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 @@ -2813,19 +2833,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:2817: checking for _ prefix on C symbol names" >&5 +echo "configure:2837: 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 2822 "configure" +#line 2842 "configure" #include "confdefs.h" asm ("_glibc_foobar:"); int main() { glibc_foobar (); ; return 0; } EOF -if { (eval echo configure:2829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* libc_cv_asm_underscores=yes else @@ -2840,17 +2860,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:2844: checking for _ prefix on C symbol names" >&5 +echo "configure:2864: 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 2849 "configure" +#line 2869 "configure" #include "confdefs.h" void underscore_test(void) { return; } EOF -if { (eval echo configure:2854: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2874: \"$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 @@ -2882,7 +2902,7 @@ if test $elf = yes; then fi echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6 -echo "configure:2886: checking for assembler .weak directive" >&5 +echo "configure:2906: 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 @@ -2905,7 +2925,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:2909: checking for assembler .weakext directive" >&5 +echo "configure:2929: 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 @@ -2945,14 +2965,14 @@ fi case "${host_cpu}-${host_os}" in hppa*linux*) echo $ac_n "checking for assembler line separator""... $ac_c" 1>&6 -echo "configure:2949: checking for assembler line separator" >&5 +echo "configure:2969: 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:2956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2976: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_asm_line_sep='!' else if test -z "$enable_hacker_mode"; then @@ -2974,7 +2994,7 @@ EOF esac echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6 -echo "configure:2978: checking for ld --no-whole-archive" >&5 +echo "configure:2998: 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 @@ -2985,7 +3005,7 @@ __throw () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -Wl,--no-whole-archive - -o conftest conftest.c 1>&5'; { (eval echo configure:2989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c 1>&5'; { (eval echo configure:3009: \"$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 @@ -2999,7 +3019,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:3003: checking for gcc -fexceptions" >&5 +echo "configure:3023: 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 @@ -3010,7 +3030,7 @@ __throw () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -fexceptions - -o conftest conftest.c 1>&5'; { (eval echo configure:3014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c 1>&5'; { (eval echo configure:3034: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_exceptions=yes else libc_cv_gcc_exceptions=no @@ -3025,14 +3045,14 @@ fi if test "$base_machine" = alpha ; then echo $ac_n "checking for function ..ng prefix""... $ac_c" 1>&6 -echo "configure:3029: checking for function ..ng prefix" >&5 +echo "configure:3049: 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:3036: \"$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:3056: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_alpha_ng_prefix=yes else @@ -3059,19 +3079,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:3063: checking whether clobbering cr0 causes problems" >&5 +echo "configure:3083: 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 3068 "configure" +#line 3088 "configure" #include "confdefs.h" int tester(int x) { asm ("" : : : "cc"); return x & 123; } int main() { ; return 0; } EOF -if { (eval echo configure:3075: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_c_asmcr0_bug='no' else @@ -3093,12 +3113,12 @@ fi fi echo $ac_n "checking for DWARF2 unwind info support""... $ac_c" 1>&6 -echo "configure:3097: checking for DWARF2 unwind info support" >&5 +echo "configure:3117: 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 3102 "configure" +#line 3122 "configure" static char __EH_FRAME_BEGIN__; _start () { @@ -3125,7 +3145,7 @@ __bzero () {} EOF if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame_info -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3129: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3149: \"$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 @@ -3133,7 +3153,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:3137: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3157: \"$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 @@ -3163,12 +3183,12 @@ EOF esac echo $ac_n "checking for __builtin_expect""... $ac_c" 1>&6 -echo "configure:3167: checking for __builtin_expect" >&5 +echo "configure:3187: 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 3172 "configure" +#line 3192 "configure" int foo (int a) { a = __builtin_expect (a, 10); @@ -3176,7 +3196,7 @@ int foo (int a) } EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3180: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3200: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_builtin_expect=yes else libc_cv_gcc_builtin_expect=no @@ -3193,12 +3213,12 @@ EOF fi echo $ac_n "checking for local label subtraction""... $ac_c" 1>&6 -echo "configure:3197: checking for local label subtraction" >&5 +echo "configure:3217: 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 3202 "configure" +#line 3222 "configure" int foo (int a) { static const int ar[] = { &&l1 - &&l1, &&l2 - &&l1 }; @@ -3211,7 +3231,7 @@ int foo (int a) } EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3235: \"$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 @@ -3228,7 +3248,7 @@ EOF fi echo $ac_n "checking for libgd""... $ac_c" 1>&6 -echo "configure:3232: checking for libgd" >&5 +echo "configure:3252: checking for libgd" >&5 old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $libgd_include" old_LDFLAGS="$LDFLAGS" @@ -3236,14 +3256,14 @@ LDFLAGS="$LDFLAGS $libgd_ldflags" old_LIBS="$LIBS" LIBS="$LIBS -lgd -lpng -lz -lm" cat > conftest.$ac_ext <<EOF -#line 3240 "configure" +#line 3260 "configure" #include "confdefs.h" #include <gd.h> int main() { gdImagePng (0, 0) ; return 0; } EOF -if { (eval echo configure:3247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBGD=yes else @@ -3260,7 +3280,7 @@ echo "$ac_t""$LIBGD" 1>&6 echo $ac_n "checking size of long double""... $ac_c" 1>&6 -echo "configure:3264: checking size of long double" >&5 +echo "configure:3284: 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 @@ -3268,7 +3288,7 @@ else ac_cv_sizeof_long_double=0 else cat > conftest.$ac_ext <<EOF -#line 3272 "configure" +#line 3292 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -3279,7 +3299,7 @@ main() exit(0); } EOF -if { (eval echo configure:3283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3303: \"$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 @@ -3347,7 +3367,7 @@ if test "$uname" = "sysdeps/generic"; then fi echo $ac_n "checking OS release for uname""... $ac_c" 1>&6 -echo "configure:3351: checking OS release for uname" >&5 +echo "configure:3371: 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 @@ -3369,7 +3389,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:3373: checking OS version for uname" >&5 +echo "configure:3393: 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 @@ -3391,7 +3411,7 @@ else fi echo $ac_n "checking stdio selection""... $ac_c" 1>&6 -echo "configure:3395: checking stdio selection" >&5 +echo "configure:3415: checking stdio selection" >&5 case $stdio in libio) cat >> confdefs.h <<\EOF @@ -3405,7 +3425,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:3409: checking for old glibc 2.0.x headers" >&5 +echo "configure:3429: 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 @@ -3460,7 +3480,7 @@ if test $shared = default; then fi echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6 -echo "configure:3464: checking whether -fPIC is default" >&5 +echo "configure:3484: checking whether -fPIC is default" >&5 if eval "test \"`echo '$''{'pic_default'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3685,6 +3705,7 @@ s%@VERSIONING@%$VERSIONING%g s%@libc_cv_asm_protected_directive@%$libc_cv_asm_protected_directive%g s%@libc_cv_z_nodelete@%$libc_cv_z_nodelete%g s%@libc_cv_z_nodlopen@%$libc_cv_z_nodlopen%g +s%@libc_cv_z_initfirst@%$libc_cv_z_initfirst%g s%@libc_cv_have_initfini@%$libc_cv_have_initfini%g s%@no_whole_archive@%$no_whole_archive%g s%@exceptions@%$exceptions%g diff --git a/configure.in b/configure.in index dfab7a3..e52648f 100644 --- a/configure.in +++ b/configure.in @@ -973,6 +973,20 @@ EOF fi rm -f conftest*]) AC_SUBST(libc_cv_z_nodlopen) + + AC_CACHE_CHECK(for -z initfirst option, + libc_cv_z_initfirst, [dnl + cat > conftest.c <<EOF +int _start (void) { return 42; } +EOF + if AC_TRY_COMMAND([${CC-cc} -shared -o conftest.so conftest.c -Wl,--enable-new-dtags,-z,initfirst 1>&AC_FD_CC]) + then + libc_cv_z_initfirst=yes + else + libc_cv_z_initfirst=no + fi + rm -f conftest*]) + AC_SUBST(libc_cv_z_initfirst) fi if test $elf != yes; then diff --git a/conform/conformtest.pl b/conform/conformtest.pl index a80e7d6..5ae1cea 100644 --- a/conform/conformtest.pl +++ b/conform/conformtest.pl @@ -670,6 +670,7 @@ while ($#headers >= 0) { # Generate a program to test for the availability of this type. open (TESTFILE, ">$fnamebase.c"); + print TESTFILE "$prepend"; print TESTFILE "#include <$h>\n"; if ($maybe_opaque == 1) { print TESTFILE "$type *a;\n"; diff --git a/elf/dl-init.c b/elf/dl-init.c index 627f823..82e5737 100644 --- a/elf/dl-init.c +++ b/elf/dl-init.c @@ -1,5 +1,5 @@ /* Return the next shared object initializer function not yet run. - Copyright (C) 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1998,1999,2000,2001 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 @@ -27,6 +27,63 @@ typedef void (*init_t) (int, char **, char **); /* Flag, nonzero during startup phase. */ extern int _dl_starting_up; +/* The object to be initialized first. */ +extern struct link_map *_dl_initfirst; + + +static void +call_init (struct link_map *l, int argc, char **argv, char **env) +{ + if (l->l_init_called) + /* This object is all done. */ + return; + + /* Avoid handling this constructor again in case we have a circular + dependency. */ + l->l_init_called = 1; + + /* Check for object which constructors we do not run here. */ + if (l->l_name[0] == '\0' && l->l_type == lt_executable) + return; + + /* Are there any constructors? */ + if (l->l_info[DT_INIT] == NULL && l->l_info[DT_INIT_ARRAY] == NULL) + return; + + /* Print a debug message if wanted. */ + if (__builtin_expect (_dl_debug_impcalls, 0)) + _dl_debug_message (1, "\ncalling init: ", + l->l_name[0] ? l->l_name : _dl_argv[0], "\n\n", NULL); + + /* Now run the local constructors. There are two forms of them: + - the one named by DT_INIT + - the others in the DT_INIT_ARRAY. + */ + if (l->l_info[DT_INIT] != NULL) + { + init_t init = (init_t) DL_DT_INIT_ADDRESS + (l, l->l_addr + l->l_info[DT_INIT]->d_un.d_ptr); + + /* Call the function. */ + init (argc, argv, env); + } + + /* Next see whether there is an array with initialization functions. */ + if (l->l_info[DT_INIT_ARRAY] != NULL) + { + unsigned int j; + unsigned int jm; + ElfW(Addr) *addrs; + + jm = l->l_info[DT_INIT_ARRAYSZ]->d_un.d_val / sizeof (ElfW(Addr)); + + addrs = (ElfW(Addr) *) (l->l_info[DT_INIT_ARRAY]->d_un.d_ptr + + l->l_addr); + for (j = 0; j < jm; ++j) + ((init_t) addrs[j]) (argc, argv, env); + } +} + void internal_function @@ -36,6 +93,12 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env) struct r_debug *r; unsigned int i; + if (_dl_initfirst != NULL) + { + call_init (_dl_initfirst, argc, argv, env); + _dl_initfirst = NULL; + } + /* Don't do anything if there is no preinit array. */ if (preinit_array != NULL && (i = preinit_array->d_un.d_val / sizeof (ElfW(Addr))) > 0) @@ -73,60 +136,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env) i = main_map->l_searchlist.r_nlist; while (i-- > 0) - { - struct link_map *l = main_map->l_initfini[i]; - init_t init; - - if (l->l_init_called) - /* This object is all done. */ - continue; - - /* Avoid handling this constructor again in case we have a circular - dependency. */ - l->l_init_called = 1; - - /* Check for object which constructors we do not run here. */ - if (l->l_name[0] == '\0' && l->l_type == lt_executable) - continue; - - /* Are there any constructors? */ - if (l->l_info[DT_INIT] == NULL && l->l_info[DT_INIT_ARRAY] == NULL) - continue; - - /* Print a debug message if wanted. */ - if (__builtin_expect (_dl_debug_impcalls, 0)) - _dl_debug_message (1, "\ncalling init: ", - l->l_name[0] ? l->l_name : _dl_argv[0], - "\n\n", NULL); - - /* Now run the local constructors. There are two forms of them: - - the one named by DT_INIT - - the others in the DT_INIT_ARRAY. - */ - if (l->l_info[DT_INIT] != NULL) - { - init = (init_t) DL_DT_INIT_ADDRESS - (l, l->l_addr + l->l_info[DT_INIT]->d_un.d_ptr); - - /* Call the function. */ - init (argc, argv, env); - } - - /* Next see whether there is an array with initialization functions. */ - if (l->l_info[DT_INIT_ARRAY] != NULL) - { - unsigned int j; - unsigned int jm; - ElfW(Addr) *addrs; - - jm = l->l_info[DT_INIT_ARRAYSZ]->d_un.d_val / sizeof (ElfW(Addr)); - - addrs = (ElfW(Addr) *) (l->l_info[DT_INIT_ARRAY]->d_un.d_ptr - + l->l_addr); - for (j = 0; j < jm; ++j) - ((init_t) addrs[j]) (argc, argv, env); - } - } + call_init (main_map->l_initfini[i], argc, argv, env); /* Notify the debugger all new objects are now ready to go. */ r->r_state = RT_CONSISTENT; diff --git a/elf/dl-load.c b/elf/dl-load.c index e8112b1..157d827 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -117,6 +117,9 @@ int _dl_clktck; extern const char *_dl_platform; extern size_t _dl_platformlen; +/* The object to be initialized first. */ +struct link_map *_dl_initfirst; + /* This is the decomposed LD_LIBRARY_PATH search path. */ static struct r_search_path_struct env_path_list; @@ -1150,6 +1153,10 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, l->l_scope[0] = &l->l_symbolic_searchlist; } + /* Remember whether this object must be initialized first. */ + if (l->l_flags_1 & DF_1_INITFIRST) + _dl_initfirst = l; + /* Finally the file information. */ l->l_dev = st.st_dev; l->l_ino = st.st_ino; @@ -295,6 +295,7 @@ typedef struct #define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ #define SHT_NUM 19 /* Number of defined types. */ #define SHT_LOOS 0x60000000 /* Start OS-specific */ +#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ #define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ #define SHT_SUNW_move 0x6ffffffa #define SHT_SUNW_COMDAT 0x6ffffffb diff --git a/elf/soinit.c b/elf/soinit.c index 42e6cf1..ff65af4 100644 --- a/elf/soinit.c +++ b/elf/soinit.c @@ -36,9 +36,6 @@ extern void __deregister_frame (const void *); # endif #endif -/* We have to initialize the thread library at least if bit. */ -extern void __pthread_initialize_minimal (void) __attribute__ ((weak)); - /* This function will be called from _init in init-first.c. */ void __libc_global_ctors (void) @@ -46,11 +43,6 @@ __libc_global_ctors (void) /* Call constructor functions. */ run_hooks (__CTOR_LIST__); - /* Initialize the thread library at least a bit since the libgcc functions - are using thread functions if these are available. */ - if (__pthread_initialize_minimal) - __pthread_initialize_minimal (); - #ifdef HAVE_DWARF2_UNWIND_INFO # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC { diff --git a/posix/tst-fnmatch.input b/posix/tst-fnmatch.input index 85dda08..6add86c 100644 --- a/posix/tst-fnmatch.input +++ b/posix/tst-fnmatch.input @@ -460,6 +460,9 @@ de_DE.ISO-8859-1 "ä" "[[=ä=]b]" 0 de_DE.ISO-8859-1 "b" "[[=ä=]b]" 0 de_DE.ISO-8859-1 "c" "[[=ä=]b]" NOMATCH +de_DE.ISO-8859-1 "aa" "[[.a.]]a" 0 +de_DE.ISO-8859-1 "ba" "[[.a.]]a" NOMATCH + # And with a multibyte character set. de_DE.UTF-8 "a" "[a-z]" 0 @@ -549,6 +552,9 @@ de_DE.UTF-8 "ä" "[[=ä=]b]" 0 de_DE.UTF-8 "b" "[[=ä=]b]" 0 de_DE.UTF-8 "c" "[[=ä=]b]" NOMATCH +de_DE.UTF-8 "aa" "[[.a.]]a" 0 +de_DE.UTF-8 "ba" "[[.a.]]a" NOMATCH + # Test of GNU extensions. C "x" "x" 0 PATHNAME|LEADING_DIR |