summaryrefslogtreecommitdiff
path: root/patches/0006-x86-64-Add-tests-for-z-textonly-z-max-page-size-0x10.patch
blob: 3c02413cb20d2a7877138ff55946f111aed52e8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
From 6a98c098b8284df539ca7d6ccf13e4e239ec65f7 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 13 Nov 2017 14:47:03 -0800
Subject: [PATCH 6/6] x86-64: Add tests for -z textonly -z max-page-size=0x1000

	PR ld/22393
	* testsuite/ld-x86-64/pr22393-3a.c: New file.
	* testsuite/ld-x86-64/pr22393-3a.rd: Likewise.
	* testsuite/ld-x86-64/pr22393-3b.c: Likewise.
	* testsuite/ld-x86-64/pr22393-3b.rd: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run tests for -z textonly
	-z max-page-size=0x1000.
---
 ld/testsuite/ld-x86-64/pr22393-3a.c  |  7 ++++
 ld/testsuite/ld-x86-64/pr22393-3a.rd |  9 +++++
 ld/testsuite/ld-x86-64/pr22393-3b.c  |  7 ++++
 ld/testsuite/ld-x86-64/pr22393-3b.rd |  9 +++++
 ld/testsuite/ld-x86-64/x86-64.exp    | 71 ++++++++++++++++++++++++++++++++++++
 5 files changed, 103 insertions(+)
 create mode 100644 ld/testsuite/ld-x86-64/pr22393-3a.c
 create mode 100644 ld/testsuite/ld-x86-64/pr22393-3a.rd
 create mode 100644 ld/testsuite/ld-x86-64/pr22393-3b.c
 create mode 100644 ld/testsuite/ld-x86-64/pr22393-3b.rd

diff --git a/ld/testsuite/ld-x86-64/pr22393-3a.c b/ld/testsuite/ld-x86-64/pr22393-3a.c
new file mode 100644
index 0000000000..68fa4a0dd0
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr22393-3a.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void
+test()
+{
+  printf ("PASS\n");
+}
diff --git a/ld/testsuite/ld-x86-64/pr22393-3a.rd b/ld/testsuite/ld-x86-64/pr22393-3a.rd
new file mode 100644
index 0000000000..b7ba110095
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr22393-3a.rd
@@ -0,0 +1,9 @@
+#source: pr22393-1.s
+#ld: -shared -z textonly
+#readelf: -l --wide
+#target: *-*-linux-gnu *-*-gnu* *-*-nacl*
+
+#failif
+#...
+ +[0-9]+  +.*(\.note|\.gnu|\.hash|\.dyn|\.rel).*\.text.*
+#...
diff --git a/ld/testsuite/ld-x86-64/pr22393-3b.c b/ld/testsuite/ld-x86-64/pr22393-3b.c
new file mode 100644
index 0000000000..3033809b02
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr22393-3b.c
@@ -0,0 +1,7 @@
+void test(void);
+
+int main()
+{
+  test();
+  return 0;
+}
diff --git a/ld/testsuite/ld-x86-64/pr22393-3b.rd b/ld/testsuite/ld-x86-64/pr22393-3b.rd
new file mode 100644
index 0000000000..b7ba110095
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr22393-3b.rd
@@ -0,0 +1,9 @@
+#source: pr22393-1.s
+#ld: -shared -z textonly
+#readelf: -l --wide
+#target: *-*-linux-gnu *-*-gnu* *-*-nacl*
+
+#failif
+#...
+ +[0-9]+  +.*(\.note|\.gnu|\.hash|\.dyn|\.rel).*\.text.*
+#...
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index ef2cb1551c..304128e165 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -1104,6 +1104,51 @@ if { [isnative] && [which $CC] != 0 } {
 	    {} \
 	    "pr22064.so" \
 	] \
+	[list \
+	    "Build pr22393-3a.so" \
+	    "-shared -Wl,-z,textonly,-z,max-page-size=0x1000" \
+	    "-fPIC" \
+	    {pr22393-3a.c} \
+	    {{readelf -lW pr22393-3a.rd} \
+	     {readelf -lW pr22393-3b.rd}} \
+	    "pr22393-3a.so" \
+	] \
+	[list \
+	    "Build pr22393-3a-now.so" \
+	    "-shared -Wl,-z,textonly,-z,now,-z,max-page-size=0x1000" \
+	    "-fPIC" \
+	    {pr22393-3a.c} \
+	    {{readelf -lW pr22393-3a.rd} \
+	     {readelf -lW pr22393-3b.rd}} \
+	    "pr22393-3a-now.so" \
+	] \
+	[list \
+	    "Build pr22393-3" \
+	    "$NOPIE_LDFLAGS -Wl,-z,textonly,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-2a.so" \
+	    "$NOPIE_CFLAGS" \
+	    {pr22393-3b.c} \
+	    {{readelf -lW pr22393-3a.rd} \
+	     {readelf -lW pr22393-3b.rd}} \
+	    "pr22393-3" \
+	] \
+	[list \
+	    "Build pr22393-3 (PIE)" \
+	    "-pie -Wl,-z,textonly,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-2a-now.so" \
+	    "-fPIE" \
+	    {pr22393-3b.c} \
+	    {{readelf -lW pr22393-3a.rd} \
+	     {readelf -lW pr22393-3b.rd}} \
+	    "pr22393-3-pie" \
+	] \
+	[list \
+	    "Build pr22393-3 (static)" \
+	    "-static -Wl,-z,textonly,-z,max-page-size=0x1000" \
+	    "" \
+	    {pr22393-3a.c pr22393-3b.c} \
+	    {{readelf -lW pr22393-3a.rd} \
+	     {readelf -lW pr22393-3b.rd}} \
+	    "pr22393-3-static" \
+	] \
     ]
 
     if  {[istarget "x86_64-*-linux*-gnux32"]} {
@@ -1403,6 +1448,32 @@ if { [isnative] && [which $CC] != 0 } {
 	    "pass.out" \
 	    "-fPIE" \
 	] \
+	[list \
+	    "Run pr22393-3" \
+	    "$NOPIE_LDFLAGS -Wl,-z,textonly,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-3a.so" \
+	    "" \
+	    {pr22393-3b.c} \
+	    "pr22393-3" \
+	    "pass.out" \
+	    "$NOPIE_CFLAGS" \
+	] \
+	[list \
+	    "Run pr22393-3 (PIE)" \
+	    "-pie -Wl,-z,textonly,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-3a-now.so" \
+	    "" \
+	    {pr22393-3b.c} \
+	    "pr22393-3-pie" \
+	    "pass.out" \
+	    "-fPIE" \
+	] \
+	[list \
+	    "Run pr22393-3 (static)" \
+	    "-static -Wl,-z,textonly,-z,max-page-size=0x1000" \
+	    "" \
+	    {pr22393-3a.c pr22393-3b.c} \
+	    "pr22393-3-static" \
+	    "pass.out" \
+	] \
     ]
 
     # Run-time tests which require working ifunc attribute support.
-- 
2.13.6