about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-02-28 22:38:00 +0000
committerUlrich Drepper <drepper@redhat.com>2002-02-28 22:38:00 +0000
commit0d01dace556f7eb482c346c545e11035d33852ce (patch)
tree9bf619ec2629e5dc966602d19f633fbbc8bbbea1
parent1eb610d162de8470b53b3e31629932ca7726a142 (diff)
downloadglibc-0d01dace556f7eb482c346c545e11035d33852ce.tar.gz
glibc-0d01dace556f7eb482c346c545e11035d33852ce.tar.xz
glibc-0d01dace556f7eb482c346c545e11035d33852ce.zip
Update.
2002-02-28  Jakub Jelinek  <jakub@redhat.com>

	* elf/rtld.c (_rtld_global): Remove .protected.
	(_rtld_local): Strong alias to _rtld_global.
	* elf/Makefile (CFLAGS-.os): Add -D_RTLD_LOCAL if compiling rtld
	only .os object.
	* sysdeps/generic/ldsodefs.h (GL): If SHARED and _RTLD_LOCAL, use
	_rtld_local instead of _rtld_global.
	(_rtld_local): Add hidden extern, possibly in .sdata section.
	* configure.in: Add tests for visibility attribute and .sdata.
	* config.h.in: Add HAVE_VISIBILITY_ATTRIBUTE and HAVE_SDATA_SECTION.
	* sysdeps/alpha/dl-machine.h: Use _rtld_local instead of _rtld_global.
	* sysdeps/arm/dl-machine.h: Likewise.
	* sysdeps/generic/ldsodefs.h: Likewise.
	* sysdeps/hppa/dl-machine.h: Likewise.
	* sysdeps/cris/dl-machine.h: Likewise.
	* sysdeps/i386/dl-machine.h: Likewise.
	* sysdeps/ia64/dl-machine.h: Likewise.
	* sysdeps/m68k/dl-machine.h: Likewise.
	* sysdeps/mips/mips64/dl-machine.h: Likewise.
	* sysdeps/mips/dl-machine.h: Likewise.
	* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h: Likewise.
	* sysdeps/sh/dl-machine.h: Likewise.
	* sysdeps/s390/s390-32/dl-machine.h: Likewise.
	* sysdeps/s390/s390-64/dl-machine.h: Likewise.
	* sysdeps/x86_64/dl-machine.h: Likewise.
-rw-r--r--ChangeLog28
-rw-r--r--config.h.in6
-rwxr-xr-xconfigure168
-rw-r--r--configure.in38
-rw-r--r--elf/Makefile2
-rw-r--r--elf/rtld.c6
-rw-r--r--localedata/ChangeLog3
-rw-r--r--localedata/tests-mbwc/dat_strfmon.c58
-rw-r--r--sysdeps/alpha/dl-machine.h2
-rw-r--r--sysdeps/arm/dl-machine.h2
-rw-r--r--sysdeps/cris/dl-machine.h2
-rw-r--r--sysdeps/generic/ldsodefs.h19
-rw-r--r--sysdeps/hppa/dl-machine.h4
-rw-r--r--sysdeps/i386/dl-machine.h7
-rw-r--r--sysdeps/ia64/dl-machine.h6
-rw-r--r--sysdeps/m68k/dl-machine.h2
-rw-r--r--sysdeps/mips/dl-machine.h2
-rw-r--r--sysdeps/mips/mips64/dl-machine.h4
-rw-r--r--sysdeps/s390/s390-32/dl-machine.h2
-rw-r--r--sysdeps/s390/s390-64/dl-machine.h2
-rw-r--r--sysdeps/sh/dl-machine.h2
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h4
-rw-r--r--sysdeps/sparc/sparc64/dl-machine.h4
-rw-r--r--sysdeps/x86_64/dl-machine.h2
24 files changed, 259 insertions, 116 deletions
diff --git a/ChangeLog b/ChangeLog
index bd44bd1226..5505efa5fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2002-02-28  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf/rtld.c (_rtld_global): Remove .protected.
+	(_rtld_local): Strong alias to _rtld_global.
+	* elf/Makefile (CFLAGS-.os): Add -D_RTLD_LOCAL if compiling rtld
+	only .os object.
+	* sysdeps/generic/ldsodefs.h (GL): If SHARED and _RTLD_LOCAL, use
+	_rtld_local instead of _rtld_global.
+	(_rtld_local): Add hidden extern, possibly in .sdata section.
+	* configure.in: Add tests for visibility attribute and .sdata.
+	* config.h.in: Add HAVE_VISIBILITY_ATTRIBUTE and HAVE_SDATA_SECTION.
+	* sysdeps/alpha/dl-machine.h: Use _rtld_local instead of _rtld_global.
+	* sysdeps/arm/dl-machine.h: Likewise.
+	* sysdeps/generic/ldsodefs.h: Likewise.
+	* sysdeps/hppa/dl-machine.h: Likewise.
+	* sysdeps/cris/dl-machine.h: Likewise.
+	* sysdeps/i386/dl-machine.h: Likewise.
+	* sysdeps/ia64/dl-machine.h: Likewise.
+	* sysdeps/m68k/dl-machine.h: Likewise.
+	* sysdeps/mips/mips64/dl-machine.h: Likewise.
+	* sysdeps/mips/dl-machine.h: Likewise.
+	* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
+	* sysdeps/sparc/sparc64/dl-machine.h: Likewise.
+	* sysdeps/sh/dl-machine.h: Likewise.
+	* sysdeps/s390/s390-32/dl-machine.h: Likewise.
+	* sysdeps/s390/s390-64/dl-machine.h: Likewise.
+	* sysdeps/x86_64/dl-machine.h: Likewise.
+
 2002-02-28  Ulrich Drepper  <drepper@redhat.com>
 
 	* login/login.c (login): Always initialize ut_line field
diff --git a/config.h.in b/config.h.in
index fae29729e4..dc831e51e6 100644
--- a/config.h.in
+++ b/config.h.in
@@ -102,6 +102,12 @@
 /* Define if the assembler supported .protected.  */
 #undef	HAVE_PROTECTED
 
+/* Define if the compiler supports __attribute__ ((visibility (...))).  */
+#undef	HAVE_VISIBILITY_ATTRIBUTE
+
+/* Define if _rtld_local structure should be forced into .sdata section.  */
+#undef	HAVE_SDATA_SECTION
+
 /* Define if binutils support TLS handling.  */
 #undef	HAVE_TLS_SUPPORT
 
diff --git a/configure b/configure
index e6460308ea..606283442f 100755
--- a/configure
+++ b/configure
@@ -2806,8 +2806,64 @@ echo "$ac_t""$libc_cv_asm_protected_directive" 1>&6
 EOF
 
 
+  if test $libc_cv_asm_protected_directive = yes; then
+    echo $ac_n "checking whether __attribute__((visibility())) is supported""... $ac_c" 1>&6
+echo "configure:2812: checking whether __attribute__((visibility())) is supported" >&5
+if eval "test \"`echo '$''{'libc_cv_visibility_attribute'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+		  int foo __attribute__ ((visibility ("hidden"))) = 1;
+		  int bar __attribute__ ((visibility ("protected"))) = 1;
+EOF
+		  libc_cv_visibility_attribute=no
+		  if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
+		    if grep '\.hidden.*foo' conftest.s >/dev/null; then
+		      if grep '\.protected.*bar' conftest.s >/dev/null; then
+			libc_cv_visibility_attribute=yes
+		      fi
+		    fi
+		  fi
+		  rm -f conftest.cs
+		 
+fi
+
+echo "$ac_t""$libc_cv_visibility_attribute" 1>&6
+    if test $libc_cv_visibility_attribute = yes; then
+      cat >> confdefs.h <<\EOF
+#define HAVE_VISIBILITY_ATTRIBUTE 1
+EOF
+
+    fi
+  fi
+
+  if test $libc_cv_visibility_attribute = yes -a $gnu_ld = yes; then
+    echo $ac_n "checking whether to put _rtld_local into .sdata section""... $ac_c" 1>&6
+echo "configure:2843: checking whether to put _rtld_local into .sdata section" >&5
+if eval "test \"`echo '$''{'libc_cv_have_sdata_section'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "int i;" > conftest.c
+		  libc_cv_have_sdata_section=no
+		  if ${CC-cc} -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
+		     | grep '\.sdata' >/dev/null; then
+		    libc_cv_have_sdata_section=yes
+		  fi
+		  rm -f conftest.c conftest.so
+		 
+fi
+
+echo "$ac_t""$libc_cv_have_sdata_section" 1>&6
+    if test $libc_cv_have_sdata_section = yes; then
+      cat >> confdefs.h <<\EOF
+#define HAVE_SDATA_SECTION 1
+EOF
+
+    fi
+  fi
+
   echo $ac_n "checking for -z nodelete option""... $ac_c" 1>&6
-echo "configure:2811: checking for -z nodelete option" >&5
+echo "configure:2867: 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
@@ -2816,7 +2872,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:2820: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
+		     -Wl,--enable-new-dtags,-z,nodelete 1>&5'; { (eval echo configure:2876: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
   then
     libc_cv_z_nodelete=yes
   else
@@ -2829,7 +2885,7 @@ echo "$ac_t""$libc_cv_z_nodelete" 1>&6
   
 
   echo $ac_n "checking for -z nodlopen option""... $ac_c" 1>&6
-echo "configure:2833: checking for -z nodlopen option" >&5
+echo "configure:2889: 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
@@ -2838,7 +2894,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:2842: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
+			-Wl,--enable-new-dtags,-z,nodlopen 1>&5'; { (eval echo configure:2898: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
   then
     libc_cv_z_nodlopen=yes
   else
@@ -2851,7 +2907,7 @@ echo "$ac_t""$libc_cv_z_nodlopen" 1>&6
   
 
   echo $ac_n "checking for -z initfirst option""... $ac_c" 1>&6
-echo "configure:2855: checking for -z initfirst option" >&5
+echo "configure:2911: 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
@@ -2860,7 +2916,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:2864: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
+			-Wl,--enable-new-dtags,-z,initfirst 1>&5'; { (eval echo configure:2920: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
   then
     libc_cv_z_initfirst=yes
   else
@@ -2873,14 +2929,14 @@ echo "$ac_t""$libc_cv_z_initfirst" 1>&6
   
 
   echo $ac_n "checking for -Bgroup option""... $ac_c" 1>&6
-echo "configure:2877: checking for -Bgroup option" >&5
+echo "configure:2933: 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:2884: \"$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:2940: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
   then
     libc_cv_Bgroup=yes
   else
@@ -2893,7 +2949,7 @@ echo "$ac_t""$libc_cv_Bgroup" 1>&6
   
 
   echo $ac_n "checking for -z combreloc""... $ac_c" 1>&6
-echo "configure:2897: checking for -z combreloc" >&5
+echo "configure:2953: 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
@@ -2904,7 +2960,7 @@ int foo (void) { return bar (mumble); }
 EOF
   if { ac_try='${CC-cc} -shared -o conftest.so conftest.c
 			-nostdlib -nostartfiles
-			-Wl,-z,combreloc 1>&5'; { (eval echo configure:2908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
+			-Wl,-z,combreloc 1>&5'; { (eval echo configure:2964: \"$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
@@ -2929,12 +2985,12 @@ fi
 
 if test $elf != yes; then
   echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:2933: checking for .init and .fini sections" >&5
+echo "configure:2989: 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 2938 "configure"
+#line 2994 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2943,7 +2999,7 @@ asm (".section .init");
 				    asm ("${libc_cv_dot_text}");
 ; return 0; }
 EOF
-if { (eval echo configure:2947: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_have_initfini=yes
 else
@@ -2966,7 +3022,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:2970: checking whether cc puts quotes around section names" >&5
+echo "configure:3026: 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
@@ -3003,19 +3059,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:3007: checking for _ prefix on C symbol names" >&5
+echo "configure:3063: 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 3012 "configure"
+#line 3068 "configure"
 #include "confdefs.h"
 asm ("_glibc_foobar:");
 int main() {
 glibc_foobar ();
 ; return 0; }
 EOF
-if { (eval echo configure:3019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   libc_cv_asm_underscores=yes
 else
@@ -3030,17 +3086,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:3034: checking for _ prefix on C symbol names" >&5
+echo "configure:3090: 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 3039 "configure"
+#line 3095 "configure"
 #include "confdefs.h"
 void underscore_test(void) {
 return; }
 EOF
-if { (eval echo configure:3044: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3100: \"$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
@@ -3072,7 +3128,7 @@ if test $elf = yes; then
 fi
 
 echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:3076: checking for assembler .weak directive" >&5
+echo "configure:3132: 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
@@ -3095,7 +3151,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:3099: checking for assembler .weakext directive" >&5
+echo "configure:3155: 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
@@ -3142,14 +3198,14 @@ EOF
     ;;
   hppa*linux*)
   echo $ac_n "checking for assembler line separator""... $ac_c" 1>&6
-echo "configure:3146: checking for assembler line separator" >&5
+echo "configure:3202: 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:3153: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:3209: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
     libc_cv_asm_line_sep='!'
   else
     if test -z "$enable_hacker_mode"; then
@@ -3171,7 +3227,7 @@ EOF
 esac
 
 echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:3175: checking for ld --no-whole-archive" >&5
+echo "configure:3231: 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
@@ -3182,7 +3238,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -Wl,--no-whole-archive
-			    -o conftest conftest.c 1>&5'; { (eval echo configure:3186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c 1>&5'; { (eval echo configure:3242: \"$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
@@ -3196,7 +3252,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:3200: checking for gcc -fexceptions" >&5
+echo "configure:3256: 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
@@ -3207,7 +3263,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -fexceptions
-			    -o conftest conftest.c 1>&5'; { (eval echo configure:3211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c 1>&5'; { (eval echo configure:3267: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_gcc_exceptions=yes
 else
   libc_cv_gcc_exceptions=no
@@ -3222,14 +3278,14 @@ fi
 
 if test "$base_machine" = alpha ; then
 echo $ac_n "checking for function ..ng prefix""... $ac_c" 1>&6
-echo "configure:3226: checking for function ..ng prefix" >&5
+echo "configure:3282: 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:3233: \"$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:3289: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
 then
   libc_cv_gcc_alpha_ng_prefix=yes
 else
@@ -3256,19 +3312,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:3260: checking whether clobbering cr0 causes problems" >&5
+echo "configure:3316: 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 3265 "configure"
+#line 3321 "configure"
 #include "confdefs.h"
 int tester(int x) { asm ("" : : : "cc"); return x & 123; }
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3272: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_c_asmcr0_bug='no'
 else
@@ -3290,12 +3346,12 @@ fi
 fi
 
 echo $ac_n "checking for DWARF2 unwind info support""... $ac_c" 1>&6
-echo "configure:3294: checking for DWARF2 unwind info support" >&5
+echo "configure:3350: 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 3299 "configure"
+#line 3355 "configure"
 static char __EH_FRAME_BEGIN__;
 _start ()
 {
@@ -3322,7 +3378,7 @@ __bzero () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame_info
 			    -nostdlib -nostartfiles
-			    -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3326: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3382: \"$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
@@ -3330,7 +3386,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:3334: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			      -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3390: \"$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
@@ -3360,12 +3416,12 @@ EOF
 esac
 
 echo $ac_n "checking for __builtin_expect""... $ac_c" 1>&6
-echo "configure:3364: checking for __builtin_expect" >&5
+echo "configure:3420: 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 3369 "configure"
+#line 3425 "configure"
 int foo (int a)
 {
   a = __builtin_expect (a, 10);
@@ -3373,7 +3429,7 @@ int foo (int a)
 }
 EOF
 if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles
-			    -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_gcc_builtin_expect=yes
 else
   libc_cv_gcc_builtin_expect=no
@@ -3390,7 +3446,7 @@ EOF
 fi
 
 echo $ac_n "checking for __builtin_memset""... $ac_c" 1>&6
-echo "configure:3394: checking for __builtin_memset" >&5
+echo "configure:3450: checking for __builtin_memset" >&5
 if eval "test \"`echo '$''{'libc_cv_gcc_builtin_memset'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3400,7 +3456,7 @@ void zero (void *x)
   __builtin_memset (x, 0, 1000);
 }
 EOF
-if { ac_try='${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null'; { (eval echo configure:3404: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+if { ac_try='${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null'; { (eval echo configure:3460: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
 then
   libc_cv_gcc_builtin_memset=no
 else
@@ -3418,12 +3474,12 @@ EOF
 fi
 
 echo $ac_n "checking for local label subtraction""... $ac_c" 1>&6
-echo "configure:3422: checking for local label subtraction" >&5
+echo "configure:3478: 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 3427 "configure"
+#line 3483 "configure"
 int foo (int a)
 {
   static const int ar[] = { &&l1 - &&l1, &&l2 - &&l1 };
@@ -3436,7 +3492,7 @@ int foo (int a)
 }
 EOF
 if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles
-			    -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3440: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3496: \"$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
@@ -3453,7 +3509,7 @@ EOF
 fi
 
 echo $ac_n "checking for libgd""... $ac_c" 1>&6
-echo "configure:3457: checking for libgd" >&5
+echo "configure:3513: checking for libgd" >&5
 if test "$with_gd" != "no"; then
   old_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS $libgd_include"
@@ -3462,14 +3518,14 @@ if test "$with_gd" != "no"; then
   old_LIBS="$LIBS"
   LIBS="$LIBS -lgd -lpng -lz -lm"
   cat > conftest.$ac_ext <<EOF
-#line 3466 "configure"
+#line 3522 "configure"
 #include "confdefs.h"
 #include <gd.h>
 int main() {
 gdImagePng (0, 0)
 ; return 0; }
 EOF
-if { (eval echo configure:3473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   LIBGD=yes
 else
@@ -3489,7 +3545,7 @@ echo "$ac_t""$LIBGD" 1>&6
 
 
 echo $ac_n "checking size of long double""... $ac_c" 1>&6
-echo "configure:3493: checking size of long double" >&5
+echo "configure:3549: 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
@@ -3497,7 +3553,7 @@ else
   ac_cv_sizeof_long_double=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 3501 "configure"
+#line 3557 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main()
@@ -3508,7 +3564,7 @@ int main()
   return(0);
 }
 EOF
-if { (eval echo configure:3512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3568: \"$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
@@ -3586,7 +3642,7 @@ if test "$uname" = "sysdeps/generic"; then
   fi
 
   echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:3590: checking OS release for uname" >&5
+echo "configure:3646: 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
@@ -3608,7 +3664,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:3612: checking OS version for uname" >&5
+echo "configure:3668: 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
@@ -3630,7 +3686,7 @@ else
 fi
 
 echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:3634: checking stdio selection" >&5
+echo "configure:3690: checking stdio selection" >&5
 
 case $stdio in
 libio) cat >> confdefs.h <<\EOF
@@ -3644,7 +3700,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:3648: checking for old glibc 2.0.x headers" >&5
+echo "configure:3704: 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
@@ -3705,7 +3761,7 @@ if test $shared = default; then
 fi
 
 echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6
-echo "configure:3709: checking whether -fPIC is default" >&5
+echo "configure:3765: 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 523e8efe6a..c48c4c1ca6 100644
--- a/configure.in
+++ b/configure.in
@@ -1001,6 +1001,44 @@ EOF
   AC_SUBST(libc_cv_asm_protected_directive)
   AC_DEFINE(HAVE_PROTECTED)
 
+  if test $libc_cv_asm_protected_directive = yes; then
+    AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
+		 libc_cv_visibility_attribute,
+		 [cat > conftest.c <<EOF
+		  int foo __attribute__ ((visibility ("hidden"))) = 1;
+		  int bar __attribute__ ((visibility ("protected"))) = 1;
+EOF
+		  libc_cv_visibility_attribute=no
+		  if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
+		    if grep '\.hidden.*foo' conftest.s >/dev/null; then
+		      if grep '\.protected.*bar' conftest.s >/dev/null; then
+			libc_cv_visibility_attribute=yes
+		      fi
+		    fi
+		  fi
+		  rm -f conftest.[cs]
+		 ])
+    if test $libc_cv_visibility_attribute = yes; then
+      AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
+    fi
+  fi
+
+  if test $libc_cv_visibility_attribute = yes -a $gnu_ld = yes; then
+    AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
+		 libc_cv_have_sdata_section,
+		 [echo "int i;" > conftest.c
+		  libc_cv_have_sdata_section=no
+		  if ${CC-cc} -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
+		     | grep '\.sdata' >/dev/null; then
+		    libc_cv_have_sdata_section=yes
+		  fi
+		  rm -f conftest.c conftest.so
+		 ])
+    if test $libc_cv_have_sdata_section = yes; then
+      AC_DEFINE(HAVE_SDATA_SECTION)
+    fi
+  fi
+
   AC_CACHE_CHECK(for -z nodelete option,
 		 libc_cv_z_nodelete, [dnl
   cat > conftest.c <<EOF
diff --git a/elf/Makefile b/elf/Makefile
index 595a0a7f39..4ff6f89b64 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -250,6 +250,8 @@ CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' -D'SLIBDIR="$(slibdi
 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
 CFLAGS-cache.c = $(SYSCONF-FLAGS)
 
+CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-D_RTLD_LOCAL)
+
 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
 generated += $(addsuffix .so,$(strip $(modules-names)))
 
diff --git a/elf/rtld.c b/elf/rtld.c
index b926271590..12b3cc557b 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -91,11 +91,7 @@ struct rtld_global _rtld_global =
     ._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
-
+strong_alias (_rtld_global, _rtld_local);
 
 static void dl_main (const ElfW(Phdr) *phdr, ElfW(Word) phnum,
 		     ElfW(Addr) *user_entry);
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index f023454f67..c8e043f4e0 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,5 +1,8 @@
 2002-02-28  Ulrich Drepper  <drepper@redhat.com>
 
+	* tests-mbwc/dat_strfmon.c (tst_strfmon_loc): Adjust test data for
+	Euro locales.
+
 	* locales/br_FR: Eliminate old national currencies of countries
 	participating in Euro.  Make @euro files pure copies.
 	* locales/ca_ES: Likewise.
diff --git a/localedata/tests-mbwc/dat_strfmon.c b/localedata/tests-mbwc/dat_strfmon.c
index 1e2035375a..d06169814f 100644
--- a/localedata/tests-mbwc/dat_strfmon.c
+++ b/localedata/tests-mbwc/dat_strfmon.c
@@ -20,78 +20,78 @@ TST_STRFMON tst_strfmon_loc [] = {
     {
       {
 	/* #01 */
-	/*inp*/ { 23, "%n %% %i",	     123.00			},
-	/*exp*/ { 0,1,22,		     "123,00 DM % 123,00 DEM"	},
+	/*inp*/ { 24, "%n %% %i",	     123.00			},
+	/*exp*/ { 0,1,23,		     "123,00 EUR % 123,00 EUR"	},
       },
       {
 	/* #02 */
-	/*inp*/ { 23, "%n %% %i",	     123.00			},
-	/*exp*/ { 0,1,22,		     "123,00 DM % 123,00 DEM"	},
+	/*inp*/ { 24, "%n %% %i",	     123.00			},
+	/*exp*/ { 0,1,23,		     "123,00 EUR % 123,00 EUR"	},
       },
       {
 	/* #03 */
-	/*inp*/ { 22, "%n %% %i",	     123.00			},
+	/*inp*/ { 23, "%n %% %i",	     123.00			},
 	/*exp*/ { E2BIG,1,-1,	     ""					},
       },
       {
 	/* #04 */
-	/*inp*/ { 30, "%n|%i",	     1234.561				},
-	/*exp*/ { 0,1,24,		     "1.234,56 DM|1.234,56 DEM"	},
+	/*inp*/ { 31, "%n|%i",	     1234.561				},
+	/*exp*/ { 0,1,25,		     "1.234,56 EUR|1.234,56 EUR"},
       },
       {
 	/* #05 */
-	/*inp*/ { 32, "%n|%i",	    -1234.561				},
-	/*exp*/ { 0,1,26,		     "-1.234,56 DM|-1.234,56 DEM"},
+	/*inp*/ { 33, "%n|%i",	    -1234.561				},
+	/*exp*/ { 0,1,27,		     "-1.234,56 EUR|-1.234,56 EUR"},
       },
       {
 	/* #06 */
-	/*inp*/ { 32, "%12n|%12i",	     1234.561			},
-	/*exp*/ { 0,1,25,		     " 1.234,56 DM|1.234,56 DEM"},
+	/*inp*/ { 33, "%13n|%12i",	     1234.561			},
+	/*exp*/ { 0,1,26,		     " 1.234,56 EUR|1.234,56 EUR"},
       },
       {
 	/* #07 */
-	/*inp*/ { 32, "%12n|%12i",	    -1234.561			},
-	/*exp*/ { 0,1,26,		     "-1.234,56 DM|-1.234,56 DEM"},
+	/*inp*/ { 33, "%12n|%12i",	    -1234.561			},
+	/*exp*/ { 0,1,27,		     "-1.234,56 EUR|-1.234,56 EUR"},
       },
       {
 	/* #08 */
-	/*inp*/ { 32, "%#5n|%#5i",	     1234.561			},
-	/*exp*/ { 0,1,28,		     "  1.234,56 DM|  1.234,56 DEM"},
+	/*inp*/ { 33, "%#5n|%#5i",	     1234.561			},
+	/*exp*/ { 0,1,29,		     "  1.234,56 EUR|  1.234,56 EUR"},
       },
       {
 	/* #09 */
-	/*inp*/ { 32, "%#5n|%#5i",	    -1234.561			},
-	/*exp*/ { 0,1,28,		     "- 1.234,56 DM|- 1.234,56 DEM"},
+	/*inp*/ { 33, "%#5n|%#5i",	    -1234.561			},
+	/*exp*/ { 0,1,29,		     "- 1.234,56 EUR|- 1.234,56 EUR"},
       },
       {
 	/* #10 */
-	/*inp*/ { 32, "%=*#5n|%=*#5i",	 1234.561			},
-	/*exp*/ { 0,1,28,		     " *1.234,56 DM| *1.234,56 DEM"},
+	/*inp*/ { 33, "%=*#5n|%=*#5i",	 1234.561			},
+	/*exp*/ { 0,1,29,		     " *1.234,56 EUR| *1.234,56 EUR"},
       },
       {
 	/* #11 */
-	/*inp*/ { 32, "%=0#5n|%=0#5i",	-1234.561			},
-	/*exp*/ { 0,1,28,		     "-01.234,56 DM|-01.234,56 DEM"},
+	/*inp*/ { 33, "%=0#5n|%=0#5i",	-1234.561			},
+	/*exp*/ { 0,1,29,		     "-01.234,56 EUR|-01.234,56 EUR"},
       },
       {
 	/* #12 */
-	/*inp*/ { 32, "%^#5n|%^#5i",	-1234.561			},
-	/*exp*/ { 0,1,26,		     "- 1234,56 DM|- 1234,56 DEM"},
+	/*inp*/ { 33, "%^#5n|%^#5i",	-1234.561			},
+	/*exp*/ { 0,1,27,		     "- 1234,56 EUR|- 1234,56 EUR"},
       },
       {
 	/* #13 */
-	/*inp*/ { 32, "%#5.0n|%#5.0i",	 1234.444			},
-	/*exp*/ { 0,1,22,		     "  1.234 DM|  1.234 DEM"	},
+	/*inp*/ { 33, "%#5.0n|%#5.0i",	 1234.444			},
+	/*exp*/ { 0,1,23,		     "  1.234 EUR|  1.234 EUR"	},
       },
       {
 	/* #14 */
-	/*inp*/ { 32, "%#5.0n|%#5.4i",	-1234.555			},
-	/*exp*/ { 0,1,27,		     "- 1.235 DM|- 1.234,5550 DEM"},
+	/*inp*/ { 33, "%#5.0n|%#5.4i",	-1234.555			},
+	/*exp*/ { 0,1,28,		     "- 1.235 EUR|- 1.234,5550 EUR"},
       },
       {
 	/* #15 */
-	/*inp*/ { 32, "%(#5n|%!(#5i",	-1234.561			},
-	/*exp*/ { 0,1,26,		     "( 1.234,56 DM)|( 1.234,56)"},
+	/*inp*/ { 33, "%(#5n|%!(#5i",	-1234.561			},
+	/*exp*/ { 0,1,27,		     "( 1.234,56 EUR)|( 1.234,56)"},
       },
       { is_last: 1 }
     }
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h
index 6024f135b7..490f1f1754 100644
--- a/sysdeps/alpha/dl-machine.h
+++ b/sysdeps/alpha/dl-machine.h
@@ -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, _rtld_global				\n\
+	ldq	$16, _rtld_local				\n\
 	ldq	$17, 0($sp)					\n\
 	lda	$18, 8($sp)					\n\
 	s8addq	$17, 8, $19					\n\
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 5d1656480d..177a375be5 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -324,7 +324,7 @@ _dl_start_user:
 .L_STACK_END:
 	.word	__libc_stack_end(GOT)
 .L_LOADED:
-	.word	_rtld_global(GOT)
+	.word	_rtld_local(GOT)
 .previous\n\
 ");
 
diff --git a/sysdeps/cris/dl-machine.h b/sysdeps/cris/dl-machine.h
index 34d29fa3ac..966d86b27b 100644
--- a/sysdeps/cris/dl-machine.h
+++ b/sysdeps/cris/dl-machine.h
@@ -212,7 +212,7 @@ _dl_start_user:
 	move.d	$sp,$r12
 	addq	4,$r12
 	;  main_map: at _dl_loaded.
-	move.d	[$r0+_rtld_global:GOT16],$r9
+	move.d	[$r0+_rtld_local:GOT16],$r9
 	move.d	[$r9],$r10
 	move.d	_dl_init_internal:PLTG,$r9
 	add.d	$r0,$r9
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 779e438753..08f5829895 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -199,7 +199,11 @@ typedef void (*receiver_fct) (int, const char *, const char *);
 # define GL(name) _##name
 #else
 # define EXTERN
-# define GL(name) _rtld_global._##name
+# ifdef _RTLD_LOCAL
+#  define GL(name) _rtld_local._##name
+# else
+#  define GL(name) _rtld_global._##name
+# endif
 struct rtld_global
 {
 #endif
@@ -371,6 +375,19 @@ struct rtld_global
 #ifdef SHARED
 };
 extern struct rtld_global _rtld_global;
+# ifdef _RTLD_LOCAL
+#  ifdef HAVE_VISIBILITY_ATTRIBUTE
+#   ifdef HAVE_SDATA_SECTION
+#    define __rtld_local_attribute__ \
+	    __attribute__ ((visibility ("hidden"), section (".sdata")))
+#   else
+#    define __rtld_local_attribute__ __attribute__ ((visibility ("hidden")))
+#   endif
+#  else
+#   define __rtld_local_attribute__
+#  endif
+extern struct rtld_global _rtld_local __rtld_local_attribute__;
+# endif
 #endif
 #undef EXTERN
 
diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h
index bc3a9839f7..6d4249437d 100644
--- a/sysdeps/hppa/dl-machine.h
+++ b/sysdeps/hppa/dl-machine.h
@@ -362,8 +362,8 @@ asm (									\
 "	stw	%r24,-44(%sp)\n"					\
 									\
 ".Lnofix:\n"								\
-"	addil	LT'_rtld_global,%r19\n"					\
-"	ldw	RT'_rtld_global(%r1),%r26\n"				\
+"	addil	LT'_rtld_local,%r19\n"					\
+"	ldw	RT'_rtld_local(%r1),%r26\n"				\
 "	bl	set_dp, %r2\n"						\
 "	ldw	0(%r26),%r26\n"						\
 									\
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 9ae18a430a..f51dab87e2 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -239,11 +239,10 @@ _dl_start_user:\n\
 " RTLD_START_SPECIAL_INIT "\n\
 	# Load the parameters again.\n\
 	# (eax, edx, ecx, *--esp) = (_dl_loaded, argc, argv, envp)\n\
-	movl _rtld_global@GOT(%ebx), %esi\n\
-	leal 8(%esp,%edx,4), %eax\n\
+	movl _rtld_local@GOTOFF(%ebx), %eax\n\
+	leal 8(%esp,%edx,4), %esi\n\
 	leal 4(%esp), %ecx\n\
-	pushl %eax\n\
-	movl (%esi), %eax\n\
+	pushl %esi\n\
 	# Call the function to run the initializers.\n\
 	call _dl_init_internal@PLT\n\
 	# Pass our finalizer function to the user in %edx, as per ELF ABI.\n\
diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h
index 49a5ef27bb..a115b902fc 100644
--- a/sysdeps/ia64/dl-machine.h
+++ b/sysdeps/ia64/dl-machine.h
@@ -381,7 +381,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 "	{ .mmi\n"							      \
 "	  mov out3 = r11\n"						      \
 "	  sub r17 = r17, r3	/* Substract _dl_skip_args. */\n"	      \
-"	  addl out0 = @ltoff(_rtld_global), gp\n"			      \
+"	  addl out0 = @gprel(_rtld_local), gp\n"			      \
 "	}\n"								      \
 "1:	/* Copy env. */\n"						      \
 "	{ .mfi\n"							      \
@@ -396,11 +396,9 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 "	}\n"								      \
 "	{ .mmb\n"							      \
 "	  st8 [r10] = out1		/* Record the new argc. */\n"	      \
-"	  ld8 out0 = [out0]\n"						      \
-"	  ;;\n"								      \
+"	  ld8 out0 = [out0]		/* get the linkmap */\n"	      \
 "	}\n"								      \
 "	{ .mmb\n"							      \
-"	  ld8 out0 = [out0]		/* get the linkmap */\n"	      \
 "	  st8 [r2] = r17		/* Load the new _dl_argv. */\n"	      \
 "	  br.call.sptk.many b0 = _dl_init_internal#\n"			      \
 "	  ;;\n"								      \
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index 1645d83888..b2e1c6b8b4 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -176,7 +176,7 @@ _dl_start_user:\n\
 	pea 8(%sp, %d1*4)\n\
 	pea 8(%sp)\n\
 	move.l %d1, -(%sp)\n\
-	move.l ([_rtld_global@GOT.w, %a5]), -(%sp)\n\
+	move.l ([_rtld_local@GOT.w, %a5]), -(%sp)\n\
 	jbsr _dl_init_internal@PLTPC\n\
 	addq.l #8, %sp\n\
 	addq.l #8, %sp\n\
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index 893f1047e8..fcf37f6569 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -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, _rtld_global\n\
+	lw $4, _rtld_local\n\
 	lw $5, 0($29)\n\
 	la $6, 4($29)\n\
 	sll $7, $5, 2\n\
diff --git a/sysdeps/mips/mips64/dl-machine.h b/sysdeps/mips/mips64/dl-machine.h
index 6f89c0bb11..64731b863a 100644
--- a/sysdeps/mips/mips64/dl-machine.h
+++ b/sysdeps/mips/mips64/dl-machine.h
@@ -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, _rtld_global\n\
+	ld $4, _rtld_local\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, _rtld_global\n\
+	lw $4, _rtld_local\n\
 	lw $5, 0($29)\n\
 	la $6, 4($29)\n\
 	la $7, 8($29)\n\
diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h
index 344d247550..5a8f706ead 100644
--- a/sysdeps/s390/s390-32/dl-machine.h
+++ b/sysdeps/s390/s390-32/dl-machine.h
@@ -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,_rtld_global@GOT(%r12)\n\
+	l     %r2,_rtld_local@GOT(%r12)\n\
 	l     %r2,0(%r2)\n\
 	l     %r3,96(%r15)\n\
 	la    %r4,100(%r15)\n\
diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h
index fcbd02ed10..c4f2a45fb8 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -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,_rtld_global@GOT
+	lghi  %r2,_rtld_local@GOT
 	lg    %r2,0(%r2,%r12)\n\
 	lg    %r2,0(%r2)\n\
 	lg    %r3,160(%r15)\n\
diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index 24e301e5d5..74495fabcd 100644
--- a/sysdeps/sh/dl-machine.h
+++ b/sysdeps/sh/dl-machine.h
@@ -388,7 +388,7 @@ _dl_start_user:\n\
 .L_dl_init:\n\
 	.long _dl_init_internal@PLT\n\
 .L_dl_loaded:\n\
-	.long _rtld_global@GOT\n\
+	.long _rtld_local@GOT\n\
 .L_dl_starting_up:\n\
 	.long _dl_starting_up@GOT\n\
 .L_dl_fini:\n\
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 69054572b8..17a1aa6f17 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -312,9 +312,9 @@ _dl_start_user:
 	bne	23b
 	 add	%i1, 8, %i1
   /* %o0 = _dl_loaded, %o1 = argc, %o2 = argv, %o3 = envp.  */
-3:	sethi	%hi(_rtld_global), %o0
+3:	sethi	%hi(_rtld_local), %o0
 	add	%sp, 23*4, %o2
-	orcc	%o0, %lo(_rtld_global), %o0
+	orcc	%o0, %lo(_rtld_local), %o0
 	sll	%i5, 2, %o3
 	ld	[%l7+%o0], %o0
 	add	%o3, 4, %o3
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index c0cccf3b5c..af3b2d21a7 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -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(_rtld_global), %o0\n"				\
+"2:	sethi	%hi(_rtld_local), %o0\n"				\
 "	add	%sp, " __S(STACK_BIAS) " + 23*8, %o2\n"			\
-"	orcc	%o0, %lo(_rtld_global), %o0\n"				\
+"	orcc	%o0, %lo(_rtld_local), %o0\n"				\
 "	sllx	%i5, 3, %o3\n"						\
 "	ldx	[%l7 + %o0], %o0\n"					\
 "	add	%o3, 8, %o3\n"						\
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 949e8ec301..182bd5fbda 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -250,7 +250,7 @@ _dl_start_user:\n\
 	# argc -> rsi\n\
 	movq %rdx, %rsi\n\
 	# _dl_loaded -> rdi\n\
-	movq _rtld_global@GOTPCREL(%rip), %rdi\n\
+	movq _rtld_local@GOTPCREL(%rip), %rdi\n\
 	movq (%rdi), %rdi\n\
 	# env -> rcx\n\
 	leaq 16(%rsp,%rdx,8), %rcx\n\