about summary refs log tree commit diff
path: root/sysdeps
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 /sysdeps
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.
Diffstat (limited to 'sysdeps')
-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
16 files changed, 40 insertions, 26 deletions
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\