diff --git a/ChangeLog b/ChangeLog index a527941d6e..efa4644bcd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-08-26 Ulrich Drepper + + * config.h.in: Add HAVE_Z_COMBRELOC. + * configure.in: Add test for -z combreloc. + + * sysdeps/i386/dl-machine.h (elf_machine_rel): Minor cleanups and + optimizations. Use HAVE_Z_COMBRELOC to avoid generaton of + R_386_RELATIVE handling for ld.so startup. + 2001-08-25 Ulrich Drepper * po/tr.po: Update from translation team. diff --git a/config.h.in b/config.h.in index 34af868c96..1761f9975d 100644 --- a/config.h.in +++ b/config.h.in @@ -86,6 +86,9 @@ certain registers (CR0, MQ, CTR, LR) in asm statements. */ #undef BROKEN_PPC_ASM_CR0 +/* Define if the linker supports the -z combreloc option. */ +#undef HAVE_Z_COMBRELOC + /* Defined to some form of __attribute__ ((...)) if the compiler supports a different, more efficient calling convention. */ diff --git a/configure b/configure index 450657face..a900b481d4 100755 --- a/configure +++ b/configure @@ -970,7 +970,7 @@ gnu* | linux* | sysv4* | solaris2* | irix6*) aix*) # These systems are always xcoff xcoff=yes - elf=no + elf=no ;; esac @@ -2282,7 +2282,7 @@ else fi -for ac_prog in mawk gawk nawk awk +for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -2874,16 +2874,38 @@ fi echo "$ac_t""$libc_cv_Bgroup" 1>&6 + + echo $ac_n "checking for -z combreloc""... $ac_c" 1>&6 +echo "configure:2880: 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 + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } + then + if readelf -S conftest.so | fgrep .rel.dyn > /dev/null; then + cat >> confdefs.h <<\EOF +#define HAVE_Z_COMBRELOC 1 +EOF + + fi + fi + rm -f conftest* +fi + +echo "$ac_t""$libc_cv_z_combreloc" 1>&6 fi if test $elf != yes; then echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6 -echo "configure:2882: checking for .init and .fini sections" >&5 +echo "configure:2904: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_have_initfini=yes else @@ -2915,7 +2937,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:2919: checking whether cc puts quotes around section names" >&5 +echo "configure:2941: 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 @@ -2952,19 +2974,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:2956: checking for _ prefix on C symbol names" >&5 +echo "configure:2978: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* libc_cv_asm_underscores=yes else @@ -2979,17 +3001,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:2983: checking for _ prefix on C symbol names" >&5 +echo "configure:3005: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3015: \"$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 @@ -3021,7 +3043,7 @@ if test $elf = yes; then fi echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6 -echo "configure:3025: checking for assembler .weak directive" >&5 +echo "configure:3047: 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 @@ -3044,7 +3066,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:3048: checking for assembler .weakext directive" >&5 +echo "configure:3070: 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 @@ -3091,14 +3113,14 @@ EOF ;; hppa*linux*) echo $ac_n "checking for assembler line separator""... $ac_c" 1>&6 -echo "configure:3095: checking for assembler line separator" >&5 +echo "configure:3117: 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 <&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:3124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_asm_line_sep='!' else if test -z "$enable_hacker_mode"; then @@ -3120,7 +3142,7 @@ EOF esac echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6 -echo "configure:3124: checking for ld --no-whole-archive" >&5 +echo "configure:3146: 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 @@ -3131,7 +3153,7 @@ __throw () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -Wl,--no-whole-archive - -o conftest conftest.c 1>&5'; { (eval echo configure:3135: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c 1>&5'; { (eval echo configure:3157: \"$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 @@ -3145,7 +3167,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:3149: checking for gcc -fexceptions" >&5 +echo "configure:3171: 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 @@ -3156,7 +3178,7 @@ __throw () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -fexceptions - -o conftest conftest.c 1>&5'; { (eval echo configure:3160: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c 1>&5'; { (eval echo configure:3182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_exceptions=yes else libc_cv_gcc_exceptions=no @@ -3171,14 +3193,14 @@ fi if test "$base_machine" = alpha ; then echo $ac_n "checking for function ..ng prefix""... $ac_c" 1>&6 -echo "configure:3175: checking for function ..ng prefix" >&5 +echo "configure:3197: 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:3182: \"$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:3204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_alpha_ng_prefix=yes else @@ -3205,19 +3227,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:3209: checking whether clobbering cr0 causes problems" >&5 +echo "configure:3231: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_c_asmcr0_bug='no' else @@ -3239,12 +3261,12 @@ fi fi echo $ac_n "checking for DWARF2 unwind info support""... $ac_c" 1>&6 -echo "configure:3243: checking for DWARF2 unwind info support" >&5 +echo "configure:3265: 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 <&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3297: \"$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 @@ -3279,7 +3301,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:3283: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3305: \"$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 @@ -3309,12 +3331,12 @@ EOF esac echo $ac_n "checking for __builtin_expect""... $ac_c" 1>&6 -echo "configure:3313: checking for __builtin_expect" >&5 +echo "configure:3335: 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 <&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_builtin_expect=yes else libc_cv_gcc_builtin_expect=no @@ -3339,12 +3361,12 @@ EOF fi echo $ac_n "checking for local label subtraction""... $ac_c" 1>&6 -echo "configure:3343: checking for local label subtraction" >&5 +echo "configure:3365: 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 <&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3383: \"$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 @@ -3374,7 +3396,7 @@ EOF fi echo $ac_n "checking for libgd""... $ac_c" 1>&6 -echo "configure:3378: checking for libgd" >&5 +echo "configure:3400: checking for libgd" >&5 if test "$with_gd" != "no"; then old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $libgd_include" @@ -3383,14 +3405,14 @@ if test "$with_gd" != "no"; then old_LIBS="$LIBS" LIBS="$LIBS -lgd -lpng -lz -lm" cat > conftest.$ac_ext < int main() { gdImagePng (0, 0) ; return 0; } EOF -if { (eval echo configure:3394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBGD=yes else @@ -3410,7 +3432,7 @@ echo "$ac_t""$LIBGD" 1>&6 echo $ac_n "checking size of long double""... $ac_c" 1>&6 -echo "configure:3414: checking size of long double" >&5 +echo "configure:3436: 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 @@ -3418,18 +3440,18 @@ else ac_cv_sizeof_long_double=0 else cat > conftest.$ac_ext < -main() +int main() { FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); + if (!f) return(1); fprintf(f, "%d\n", sizeof(long double)); - exit(0); + return(0); } EOF -if { (eval echo configure:3433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3455: \"$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 @@ -3498,7 +3520,7 @@ if test "$uname" = "sysdeps/generic"; then fi echo $ac_n "checking OS release for uname""... $ac_c" 1>&6 -echo "configure:3502: checking OS release for uname" >&5 +echo "configure:3524: 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 @@ -3520,7 +3542,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:3524: checking OS version for uname" >&5 +echo "configure:3546: 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 @@ -3542,7 +3564,7 @@ else fi echo $ac_n "checking stdio selection""... $ac_c" 1>&6 -echo "configure:3546: checking stdio selection" >&5 +echo "configure:3568: checking stdio selection" >&5 case $stdio in libio) cat >> confdefs.h <<\EOF @@ -3556,7 +3578,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:3560: checking for old glibc 2.0.x headers" >&5 +echo "configure:3582: 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 @@ -3617,7 +3639,7 @@ if test $shared = default; then fi echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6 -echo "configure:3621: checking whether -fPIC is default" >&5 +echo "configure:3643: 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 5962b91340..719856e2b7 100644 --- a/configure.in +++ b/configure.in @@ -255,7 +255,7 @@ gnu* | linux* | sysv4* | solaris2* | irix6*) aix*) # These systems are always xcoff xcoff=yes - elf=no + elf=no ;; esac @@ -1061,6 +1061,24 @@ EOF fi rm -f conftest*]) AC_SUBST(libc_cv_Bgroup) + + AC_CACHE_CHECK(for -z combreloc, + libc_cv_z_combreloc, [dnl + cat > conftest.c <&AC_FD_CC]) + then +dnl The following test is a bit weak. We must use a tool which can test +dnl cross-platform since the gcc used can be a cross compiler. Without +dnl introducing new options this is not easily doable. Instead use a tool +dnl which always is cross-platform: readelf. To detect whether -z combreloc +dnl look for a section named .rel.dyn. + if readelf -S conftest.so | fgrep .rel.dyn > /dev/null; then + AC_DEFINE(HAVE_Z_COMBRELOC) + fi + fi + rm -f conftest*]) fi if test $elf != yes; then diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 6b6c91eb57..53d802203a 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -305,9 +305,10 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, { const unsigned int r_type = ELF32_R_TYPE (reloc->r_info); +#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC if (__builtin_expect (r_type == R_386_RELATIVE, 0)) { -#ifndef RTLD_BOOTSTRAP +# ifndef RTLD_BOOTSTRAP /* 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 @@ -316,14 +317,15 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, weak decl in the same file. */ weak_extern (_dl_rtld_map); if (map != &_dl_rtld_map) /* Already done in rtld itself. */ -#endif +# endif *reloc_addr += map->l_addr; } -#ifndef RTLD_BOOTSTRAP +# ifndef RTLD_BOOTSTRAP else if (__builtin_expect (r_type == R_386_NONE, 0)) return; -#endif +# endif else +#endif { #ifndef RTLD_BOOTSTRAP const Elf32_Sym *const refsym = sym; @@ -352,7 +354,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *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))) + && _dl_verbose)) { const char *strtab; @@ -365,8 +367,6 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, memcpy (reloc_addr, (void *) value, MIN (sym->st_size, refsym->st_size)); break; -#endif -#if !defined RTLD_BOOTSTRAP || defined _NDEBUG default: /* We add these checks in the version to relocate ld.so only if we are still debugging. */ @@ -381,6 +381,7 @@ static inline void elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc, Elf32_Addr *const reloc_addr) { + assert (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE); *reloc_addr += l_addr; }