From 0629d0af5a963d9bf2eafe458dc01f40eb597615 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Fri, 1 Oct 2010 04:47:02 +0000
Subject: [PATCH] Add 2 tests for PR ld/11812.

2010-09-30  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/11812
	* ld-i386/nogot2.d: New
	* ld-i386/nogot2.s: Likewise.
	* ld-x86-64/nogot2.d: Likewise.
	* ld-x86-64/nogot2.s: Likewise.

	* ld-i386/i386.exp: Run nogot2.
	* ld-x86-64/x86-64.exp: Likewise.
---
 ld/testsuite/ChangeLog            | 11 +++++++++++
 ld/testsuite/ld-i386/i386.exp     |  1 +
 ld/testsuite/ld-i386/nogot2.d     |  7 +++++++
 ld/testsuite/ld-i386/nogot2.s     |  4 ++++
 ld/testsuite/ld-x86-64/nogot2.d   |  7 +++++++
 ld/testsuite/ld-x86-64/nogot2.s   |  4 ++++
 ld/testsuite/ld-x86-64/x86-64.exp |  1 +
 7 files changed, 35 insertions(+)
 create mode 100644 ld/testsuite/ld-i386/nogot2.d
 create mode 100644 ld/testsuite/ld-i386/nogot2.s
 create mode 100644 ld/testsuite/ld-x86-64/nogot2.d
 create mode 100644 ld/testsuite/ld-x86-64/nogot2.s

diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 5e9b9c1eea3..3342d62d2ce 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-30  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/11812
+	* ld-i386/nogot2.d: New
+	* ld-i386/nogot2.s: Likewise.
+	* ld-x86-64/nogot2.d: Likewise.
+	* ld-x86-64/nogot2.s: Likewise.
+
+	* ld-i386/i386.exp: Run nogot2.
+	* ld-x86-64/x86-64.exp: Likewise.
+
 2010-09-29  Alan Modra  <amodra@gmail.com>
 
 	* ld-h8300/h8300.exp: Use is_elf_format.
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 86ba9e47d1a..6777c5f6755 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -190,6 +190,7 @@ run_dump_test "protected2"
 run_dump_test "protected3"
 run_dump_test "tlspie1"
 run_dump_test "nogot1"
+run_dump_test "nogot2"
 run_dump_test "discarded1"
 
 if { !([istarget "i?86-*-linux*"]
diff --git a/ld/testsuite/ld-i386/nogot2.d b/ld/testsuite/ld-i386/nogot2.d
new file mode 100644
index 00000000000..a7bb788984b
--- /dev/null
+++ b/ld/testsuite/ld-i386/nogot2.d
@@ -0,0 +1,7 @@
+#ld: -pie -melf_i386
+#readelf: -S --wide
+#as: --32
+
+#...
+[ 	]*\[.*\][ 	]+.*\.got\.plt.*
+#pass
diff --git a/ld/testsuite/ld-i386/nogot2.s b/ld/testsuite/ld-i386/nogot2.s
new file mode 100644
index 00000000000..e7212cb8561
--- /dev/null
+++ b/ld/testsuite/ld-i386/nogot2.s
@@ -0,0 +1,4 @@
+        .text
+        .globl _start
+_start:
+        movl _GLOBAL_OFFSET_TABLE_, %ecx
diff --git a/ld/testsuite/ld-x86-64/nogot2.d b/ld/testsuite/ld-x86-64/nogot2.d
new file mode 100644
index 00000000000..c6123c55a68
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/nogot2.d
@@ -0,0 +1,7 @@
+#ld: -pie -melf_x86_64
+#readelf: -S --wide
+#as: --64
+
+#...
+[ 	]*\[.*\][ 	]+.*\.got\.plt.*
+#pass
diff --git a/ld/testsuite/ld-x86-64/nogot2.s b/ld/testsuite/ld-x86-64/nogot2.s
new file mode 100644
index 00000000000..530e9096e98
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/nogot2.s
@@ -0,0 +1,4 @@
+        .text
+        .globl _start
+_start:
+        movq _GLOBAL_OFFSET_TABLE_(%rip), %rcx
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 1d3d67e4f51..12f5cad635d 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -133,6 +133,7 @@ run_dump_test "tlsle1"
 run_dump_test "tlspie1"
 run_dump_test "unique1"
 run_dump_test "nogot1"
+run_dump_test "nogot2"
 run_dump_test "discarded1"
 
 if { ![istarget "x86_64-*-linux*"] } {