Update year range in copyright notice of binutils files
[deliverable/binutils-gdb.git] / ld / testsuite / ld-x86-64 / no-plt.exp
CommitLineData
d9aee8d5 1# Expect script for x86-64 no-PLT tests.
b3adc24a 2# Copyright (C) 2016-2020 Free Software Foundation, Inc.
d9aee8d5
L
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.
25if ![isnative] {
26 return
27}
28
29if ![is_elf_format] {
30 return
31}
32
33if ![istarget "x86_64-*-*"] {
34 return
35}
36
37# Check to see if the C compiler works
44ed8092 38if { ![check_compiler_available] } {
d9aee8d5
L
39 return
40}
41
68193357
L
42# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
43global NOPIE_CFLAGS NOPIE_LDFLAGS
44
d9aee8d5
L
45run_cc_link_tests [list \
46 [list \
47 "Build no-plt-func1.o no-plt-main1.o" \
48 "" \
6c0d3bde 49 "-fPIE -Wa,-mx86-used-note=yes" \
d9aee8d5
L
50 {no-plt-func1.c no-plt-main1.c} \
51 ] \
52 [list \
53 "Build no-plt-check1.o no-plt-extern1.o" \
54 "" \
6c0d3bde 55 "-Wa,-mrelax-relocations=yes,-mx86-used-note=yes" \
d9aee8d5
L
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" \
6c0d3bde 61 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
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" \
6c0d3bde 69 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
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)" \
68193357 77 "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
d9aee8d5 78 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
6c0d3bde 79 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
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" \
6c0d3bde 88 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
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)" \
68193357 95 "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
d9aee8d5 96 tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
6c0d3bde 97 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
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" \
6c0d3bde 106 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
107 {dummy.s} \
108 {{readelf -Wr no-plt-1d.rd} {objdump -dwrj.text no-plt-1d.dd}} \
010bc3ce 109 "no-plt-1d" \
d9aee8d5
L
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" \
6c0d3bde 115 "-Wa,-mx86-used-note=yes" \
d9aee8d5 116 {dummy.s} \
9e9821dd 117 {{readelf -Wr no-plt-1e.rd} {nm -gD no-plt-1e.nd} {objdump -dwrj.text no-plt-1e.dd}} \
d9aee8d5
L
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" \
6c0d3bde 124 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
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" \
6c0d3bde 133 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
134 { dummy.s } \
135 {{readelf -Wr no-plt-1g.rd} {objdump -dwrj.text no-plt-1g.dd}} \
136 "no-plt-1g" \
137 ] \
138]
139
982c6f26 140run_ld_link_exec_tests [list \
d9aee8d5
L
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" \
6c0d3bde 145 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
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" \
6c0d3bde 154 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
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" \
6c0d3bde 163 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
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" \
6c0d3bde 172 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
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" \
6c0d3bde 181 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
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" \
6c0d3bde 190 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
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" \
6c0d3bde 199 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
200 { dummy.s } \
201 "no-plt-1g" \
202 "pass.out" \
203 ] \
204]
233cc9c1
L
205
206# Run-time tests which require working IFUNC support.
207if { [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 "" \
6c0d3bde 212 "-fPIE -O2 -g -Wa,-mx86-used-note=yes" \
233cc9c1
L
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" \
6c0d3bde 219 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
220 { dummy.s } \
221 {} \
222 "libpr20253-2a.so" \
223 ] \
224 ]
225
982c6f26 226 run_ld_link_exec_tests [list \
233cc9c1
L
227 [list \
228 "Run pr20253-2a" \
229 "tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
230 tmpdir/pr20253-2c.o tmpdir/pr20253-2d.o" \
6c0d3bde 231 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
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" \
6c0d3bde 240 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
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" \
6c0d3bde 249 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
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" \
6c0d3bde 257 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
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" \
6c0d3bde 265 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
266 { dummy.s } \
267 "pr20253-2e" \
268 "pass.out" \
269 ] \
270 [list \
271 "Run pr20253-2f" \
68193357 272 "$NOPIE_LDFLAGS tmpdir/pr20253-2a.o" \
6c0d3bde 273 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
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" \
6c0d3bde 282 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
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.187288 seconds and 4 git commands to generate.