about summary refs log tree commit diff
path: root/sysdeps/hppa
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2015-08-14 22:15:49 -0400
committerMike Frysinger <vapier@gentoo.org>2015-08-18 02:37:17 -0400
commitcf4253777412e9c8d5bfbc1c8b975f472e1e7d43 (patch)
tree39a14a32dd23a78b84d553c5b666d6691443c0ca /sysdeps/hppa
parent352d0eafb669a688003471783ca43cf5a3e94cd2 (diff)
downloadglibc-cf4253777412e9c8d5bfbc1c8b975f472e1e7d43.tar.gz
glibc-cf4253777412e9c8d5bfbc1c8b975f472e1e7d43.tar.xz
glibc-cf4253777412e9c8d5bfbc1c8b975f472e1e7d43.zip
hppa: start.S: rework references to fix PIE TEXTRELs [BZ #18421]
The startup code was not using PIC friendly references leading to TEXTRELs
in every PIE ELF.
Diffstat (limited to 'sysdeps/hppa')
-rw-r--r--sysdeps/hppa/start.S16
1 files changed, 14 insertions, 2 deletions
diff --git a/sysdeps/hppa/start.S b/sysdeps/hppa/start.S
index 64d8c3ed6f..cc4f243650 100644
--- a/sysdeps/hppa/start.S
+++ b/sysdeps/hppa/start.S
@@ -42,7 +42,11 @@
 	/* Have the linker create plabel words so we get PLABEL32
 	   relocs and not 21/14.  The use of 21/14 relocs is only
 	   supported in the latest dynamic linker.  */
-	.section	.rodata
+#ifdef SHARED
+	.section	.data.rel.ro,"aw",@progbits
+#else
+	.section	.rodata,"a",@progbits
+#endif
 	.align 4
 .Lpmain:
 	.word P%main
@@ -52,6 +56,10 @@
 	.word P%__libc_csu_fini
 .Lp__libc_csu_init:
 	.word P%__libc_csu_init
+#ifdef SHARED
+.Lp__global:
+	.word $global$
+#endif
 
 	.text
 	.align 4
@@ -122,10 +130,14 @@ _start:
 	/* void *stack_end (7th argument) */
 	stw	%sp, -60(%sp)
 
+#ifdef SHARED
+	addil	LT'.Lp__global, %r19
+	ldw	RT'.Lp__global(%r1), %dp
+#else
 	/* load global */
 	ldil	L%$global$, %dp
 	ldo	R%$global$(%dp), %dp
-
+#endif
 	bl	__libc_start_main,%r2
 	nop
 	/* die horribly if it returned (it shouldn't) */