PowerPC local got test

Message ID 20191008024243.GN7064@bubble.grove.modra.org
State New
Headers show
Series
  • PowerPC local got test
Related show

Commit Message

Alan Modra Oct. 8, 2019, 2:42 a.m.
This is the one that causes ppc64 ld segfaults between 2019-10-04 and
2019-10-07.  Bug introduced with f749f26eea, fixed by 93370e8e7b.

	* testsuite/ld-powerpc/localgot.s,
	* testsuite/ld-powerpc/localgot.d: New test.
	* testsuite/ld-powerpc/powerpc.exp: Run it.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/ld/testsuite/ld-powerpc/localgot.d b/ld/testsuite/ld-powerpc/localgot.d
new file mode 100644
index 0000000000..f58a97973a
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/localgot.d
@@ -0,0 +1,8 @@ 
+#source: localgot.s
+#as: -mppc64
+#ld: -pie
+#readelf: -r
+
+Relocation section '\.rela\.dyn' at offset .* contains 1 entry:
+ +Offset +Info +Type.*
+.*_RELATIVE .*
diff --git a/ld/testsuite/ld-powerpc/localgot.s b/ld/testsuite/ld-powerpc/localgot.s
new file mode 100644
index 0000000000..600be56daf
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/localgot.s
@@ -0,0 +1,5 @@ 
+ .text
+ .global _start
+_start:
+x:
+ ld 3,x@got(2) # isn't correct for 32-bit, but hey this is just a testcase
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index bbd4813ebd..7634891a60 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -374,6 +374,7 @@  if [ supports_ppc64 ] then {
     run_dump_test "tlsie"
 }
 
+run_dump_test "localgot"
 run_dump_test "tlsldopt32"
 
 run_ld_link_tests $ppceabitests