Update year range in copyright notice of binutils files
[deliverable/binutils-gdb.git] / ld / testsuite / ld-x86-64 / no-plt.exp
1 # Expect script for x86-64 no-PLT tests.
2 # Copyright (C) 2016-2018 Free Software Foundation, Inc.
3 #
4 # This file is part of the GNU Binutils.
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 # MA 02110-1301, USA.
20 #
21
22 # The following tests require running the executable generated by ld,
23 # or enough of a build environment to create a fully linked executable.
24 # This is not commonly available when testing a cross-built linker.
25 if ![isnative] {
26 return
27 }
28
29 if ![is_elf_format] {
30 return
31 }
32
33 if ![istarget "x86_64-*-*"] {
34 return
35 }
36
37 # Check to see if the C compiler works
38 if { [which $CC] == 0 } {
39 return
40 }
41
42 # Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
43 global NOPIE_CFLAGS NOPIE_LDFLAGS
44
45 run_cc_link_tests [list \
46 [list \
47 "Build no-plt-func1.o no-plt-main1.o" \
48 "" \
49 "-fPIE" \
50 {no-plt-func1.c no-plt-main1.c} \
51 ] \
52 [list \
53 "Build no-plt-check1.o no-plt-extern1.o" \
54 "" \
55 "-Wa,-mrelax-relocations=yes" \
56 {no-plt-check1.S no-plt-extern1.S} \
57 ] \
58 [list \
59 "Build libno-plt-1a.so" \
60 "-shared tmpdir/no-plt-func1.o" \
61 "" \
62 {dummy.s} \
63 {} \
64 "libno-plt-1a.so" \
65 ] \
66 [list \
67 "Build libno-plt-1b.so" \
68 "-shared tmpdir/no-plt-extern1.o" \
69 "" \
70 {dummy.s} \
71 {{readelf -Wr libno-plt-1b.rd} \
72 {objdump -dwrj.text libno-plt-1b.dd}} \
73 "libno-plt-1b.so" \
74 ] \
75 [list \
76 "No PLT (dynamic 1a)" \
77 "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
78 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
79 "" \
80 {dummy.s} \
81 {{readelf -Wr no-plt-1a.rd} {objdump -dwrj.text no-plt-1a.dd}} \
82 "no-plt-1a" \
83 ] \
84 [list \
85 "No PLT (dynamic 1b)" \
86 "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
87 tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
88 "" \
89 {dummy.s} \
90 {{readelf -Wr no-plt-1b.rd} {objdump -dwrj.text no-plt-1b.dd}} \
91 "no-plt-1b" \
92 ] \
93 [list \
94 "No PLT (dynamic 1c)" \
95 "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
96 tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
97 "" \
98 {dummy.s} \
99 {{readelf -Wr no-plt-1c.rd} {objdump -dwrj.text no-plt-1c.dd}} \
100 "no-plt-1c" \
101 ] \
102 [list \
103 "No PLT (static 1d)" \
104 "-static tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
105 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
106 "" \
107 {dummy.s} \
108 {{readelf -Wr no-plt-1d.rd} {objdump -dwrj.text no-plt-1d.dd}} \
109 "no-plt-1d" \
110 ] \
111 [list \
112 "No PLT (PIE 1e)" \
113 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
114 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
115 "" \
116 {dummy.s} \
117 {{readelf -Wr no-plt-1e.rd} {nm -gD no-plt-1e.nd} {objdump -dwrj.text no-plt-1e.dd}} \
118 "no-plt-1e" \
119 ] \
120 [list \
121 "No PLT (PIE 1f)" \
122 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
123 tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
124 "" \
125 { dummy.s } \
126 {{readelf -Wr no-plt-1f.rd} {objdump -dwrj.text no-plt-1f.dd}} \
127 "no-plt-1f" \
128 ] \
129 [list \
130 "No PLT (PIE 1g)" \
131 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
132 tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
133 "" \
134 { dummy.s } \
135 {{readelf -Wr no-plt-1g.rd} {objdump -dwrj.text no-plt-1g.dd}} \
136 "no-plt-1g" \
137 ] \
138 ]
139
140 run_ld_link_exec_tests [list \
141 [list \
142 "No PLT (dynamic 1a)" \
143 "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
144 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
145 "" \
146 { dummy.s } \
147 "no-plt-1a" \
148 "pass.out" \
149 ] \
150 [list \
151 "No PLT (dynamic 1b)" \
152 "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
153 tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
154 "" \
155 { dummy.s } \
156 "no-plt-1b" \
157 "pass.out" \
158 ] \
159 [list \
160 "No PLT (dynamic 1c)" \
161 "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
162 tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
163 "" \
164 { dummy.s } \
165 "no-plt-1c" \
166 "pass.out" \
167 ] \
168 [list \
169 "No PLT (static 1d)" \
170 "-static tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
171 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
172 "" \
173 { dummy.s } \
174 "no-plt-1d" \
175 "pass.out" \
176 ] \
177 [list \
178 "No PLT (PIE 1e)" \
179 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
180 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
181 "" \
182 { dummy.s } \
183 "no-plt-1e" \
184 "pass.out" \
185 ] \
186 [list \
187 "No PLT (PIE 1f)" \
188 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
189 tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
190 "" \
191 { dummy.s } \
192 "no-plt-1f" \
193 "pass.out" \
194 ] \
195 [list \
196 "No PLT (PIE 1g)" \
197 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
198 tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
199 "" \
200 { dummy.s } \
201 "no-plt-1g" \
202 "pass.out" \
203 ] \
204 ]
205
206 # Run-time tests which require working IFUNC support.
207 if { [check_ifunc_available] } {
208 run_cc_link_tests [list \
209 [list \
210 "Build pr20253-2a.o pr20253-2b.o pr20253-2c.o pr20253-2d.o" \
211 "" \
212 "-fPIE -O2 -g" \
213 { pr20253-2a.c pr20253-2b.S pr20253-2c.S pr20253-2d.S } \
214 ] \
215 [list \
216 "Build libpr20253-2a.so" \
217 "-shared tmpdir/pr20253-2b.o \
218 tmpdir/pr20253-2c.o tmpdir/pr20253-2d.o" \
219 "" \
220 { dummy.s } \
221 {} \
222 "libpr20253-2a.so" \
223 ] \
224 ]
225
226 run_ld_link_exec_tests [list \
227 [list \
228 "Run pr20253-2a" \
229 "tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
230 tmpdir/pr20253-2c.o tmpdir/pr20253-2d.o" \
231 "" \
232 { dummy.s } \
233 "pr20253-2a" \
234 "pass.out" \
235 ] \
236 [list \
237 "Run pr20253-2b" \
238 "--static tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
239 tmpdir/pr20253-2c.o tmpdir/pr20253-2d.o" \
240 "" \
241 { dummy.s } \
242 "pr20253-2b" \
243 "pass.out" \
244 ] \
245 [list \
246 "Run pr20253-2c" \
247 "-pie tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
248 tmpdir/pr20253-2c.o tmpdir/pr20253-2d.o" \
249 "" \
250 { dummy.s } \
251 "pr20253-2c" \
252 "pass.out" \
253 ] \
254 [list \
255 "Run pr20253-2d" \
256 "tmpdir/pr20253-2a.o tmpdir/libpr20253-2a.so" \
257 "" \
258 { dummy.s } \
259 "pr20253-2d" \
260 "pass.out" \
261 ] \
262 [list \
263 "Run pr20253-2e" \
264 "-pie tmpdir/pr20253-2a.o tmpdir/libpr20253-2a.so" \
265 "" \
266 { dummy.s } \
267 "pr20253-2e" \
268 "pass.out" \
269 ] \
270 [list \
271 "Run pr20253-2f" \
272 "$NOPIE_LDFLAGS tmpdir/pr20253-2a.o" \
273 "" \
274 { pr20253-2b.S pr20253-2c.S pr20253-2d.S } \
275 "pr20253-2f" \
276 "pass.out" \
277 "-DCHECK_PLT" \
278 ] \
279 [list \
280 "Run pr20253-2g" \
281 "--static tmpdir/pr20253-2a.o" \
282 "" \
283 { pr20253-2b.S pr20253-2c.S pr20253-2d.S } \
284 "pr20253-2g" \
285 "pass.out" \
286 "-DCHECK_PLT" \
287 ] \
288 ]
289 }
This page took 0.035134 seconds and 4 git commands to generate.