tcl global directive outside proc body does nothing (ld)
[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
42run_cc_link_tests [list \
43 [list \
44 "Build no-plt-func1.o no-plt-main1.o" \
45 "" \
6c0d3bde 46 "-fPIE -Wa,-mx86-used-note=yes" \
d9aee8d5
L
47 {no-plt-func1.c no-plt-main1.c} \
48 ] \
49 [list \
50 "Build no-plt-check1.o no-plt-extern1.o" \
51 "" \
6c0d3bde 52 "-Wa,-mrelax-relocations=yes,-mx86-used-note=yes" \
d9aee8d5
L
53 {no-plt-check1.S no-plt-extern1.S} \
54 ] \
55 [list \
56 "Build libno-plt-1a.so" \
57 "-shared tmpdir/no-plt-func1.o" \
6c0d3bde 58 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
59 {dummy.s} \
60 {} \
61 "libno-plt-1a.so" \
62 ] \
63 [list \
64 "Build libno-plt-1b.so" \
65 "-shared tmpdir/no-plt-extern1.o" \
6c0d3bde 66 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
67 {dummy.s} \
68 {{readelf -Wr libno-plt-1b.rd} \
69 {objdump -dwrj.text libno-plt-1b.dd}} \
70 "libno-plt-1b.so" \
71 ] \
72 [list \
73 "No PLT (dynamic 1a)" \
68193357 74 "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
d9aee8d5 75 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
6c0d3bde 76 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
77 {dummy.s} \
78 {{readelf -Wr no-plt-1a.rd} {objdump -dwrj.text no-plt-1a.dd}} \
79 "no-plt-1a" \
80 ] \
81 [list \
82 "No PLT (dynamic 1b)" \
83 "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
84 tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
6c0d3bde 85 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
86 {dummy.s} \
87 {{readelf -Wr no-plt-1b.rd} {objdump -dwrj.text no-plt-1b.dd}} \
88 "no-plt-1b" \
89 ] \
90 [list \
91 "No PLT (dynamic 1c)" \
68193357 92 "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
d9aee8d5 93 tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
6c0d3bde 94 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
95 {dummy.s} \
96 {{readelf -Wr no-plt-1c.rd} {objdump -dwrj.text no-plt-1c.dd}} \
97 "no-plt-1c" \
98 ] \
99 [list \
100 "No PLT (static 1d)" \
101 "-static tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
102 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
6c0d3bde 103 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
104 {dummy.s} \
105 {{readelf -Wr no-plt-1d.rd} {objdump -dwrj.text no-plt-1d.dd}} \
010bc3ce 106 "no-plt-1d" \
d9aee8d5
L
107 ] \
108 [list \
109 "No PLT (PIE 1e)" \
110 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
111 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
6c0d3bde 112 "-Wa,-mx86-used-note=yes" \
d9aee8d5 113 {dummy.s} \
9e9821dd 114 {{readelf -Wr no-plt-1e.rd} {nm -gD no-plt-1e.nd} {objdump -dwrj.text no-plt-1e.dd}} \
d9aee8d5
L
115 "no-plt-1e" \
116 ] \
117 [list \
118 "No PLT (PIE 1f)" \
119 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
120 tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
6c0d3bde 121 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
122 { dummy.s } \
123 {{readelf -Wr no-plt-1f.rd} {objdump -dwrj.text no-plt-1f.dd}} \
124 "no-plt-1f" \
125 ] \
126 [list \
127 "No PLT (PIE 1g)" \
128 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
129 tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
6c0d3bde 130 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
131 { dummy.s } \
132 {{readelf -Wr no-plt-1g.rd} {objdump -dwrj.text no-plt-1g.dd}} \
133 "no-plt-1g" \
134 ] \
135]
136
982c6f26 137run_ld_link_exec_tests [list \
d9aee8d5
L
138 [list \
139 "No PLT (dynamic 1a)" \
140 "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
141 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
6c0d3bde 142 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
143 { dummy.s } \
144 "no-plt-1a" \
145 "pass.out" \
146 ] \
147 [list \
148 "No PLT (dynamic 1b)" \
149 "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
150 tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
6c0d3bde 151 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
152 { dummy.s } \
153 "no-plt-1b" \
154 "pass.out" \
155 ] \
156 [list \
157 "No PLT (dynamic 1c)" \
158 "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
159 tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
6c0d3bde 160 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
161 { dummy.s } \
162 "no-plt-1c" \
163 "pass.out" \
164 ] \
165 [list \
166 "No PLT (static 1d)" \
167 "-static tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
168 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
6c0d3bde 169 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
170 { dummy.s } \
171 "no-plt-1d" \
172 "pass.out" \
173 ] \
174 [list \
175 "No PLT (PIE 1e)" \
176 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
177 tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
6c0d3bde 178 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
179 { dummy.s } \
180 "no-plt-1e" \
181 "pass.out" \
182 ] \
183 [list \
184 "No PLT (PIE 1f)" \
185 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
186 tmpdir/libno-plt-1a.so tmpdir/libno-plt-1b.so" \
6c0d3bde 187 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
188 { dummy.s } \
189 "no-plt-1f" \
190 "pass.out" \
191 ] \
192 [list \
193 "No PLT (PIE 1g)" \
194 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
195 tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
6c0d3bde 196 "-Wa,-mx86-used-note=yes" \
d9aee8d5
L
197 { dummy.s } \
198 "no-plt-1g" \
199 "pass.out" \
200 ] \
201]
233cc9c1
L
202
203# Run-time tests which require working IFUNC support.
204if { [check_ifunc_available] } {
205 run_cc_link_tests [list \
206 [list \
207 "Build pr20253-2a.o pr20253-2b.o pr20253-2c.o pr20253-2d.o" \
208 "" \
6c0d3bde 209 "-fPIE -O2 -g -Wa,-mx86-used-note=yes" \
233cc9c1
L
210 { pr20253-2a.c pr20253-2b.S pr20253-2c.S pr20253-2d.S } \
211 ] \
212 [list \
213 "Build libpr20253-2a.so" \
214 "-shared tmpdir/pr20253-2b.o \
215 tmpdir/pr20253-2c.o tmpdir/pr20253-2d.o" \
6c0d3bde 216 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
217 { dummy.s } \
218 {} \
219 "libpr20253-2a.so" \
220 ] \
221 ]
222
982c6f26 223 run_ld_link_exec_tests [list \
233cc9c1
L
224 [list \
225 "Run pr20253-2a" \
226 "tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
227 tmpdir/pr20253-2c.o tmpdir/pr20253-2d.o" \
6c0d3bde 228 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
229 { dummy.s } \
230 "pr20253-2a" \
231 "pass.out" \
232 ] \
233 [list \
234 "Run pr20253-2b" \
235 "--static tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
236 tmpdir/pr20253-2c.o tmpdir/pr20253-2d.o" \
6c0d3bde 237 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
238 { dummy.s } \
239 "pr20253-2b" \
240 "pass.out" \
241 ] \
242 [list \
243 "Run pr20253-2c" \
244 "-pie tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
245 tmpdir/pr20253-2c.o tmpdir/pr20253-2d.o" \
6c0d3bde 246 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
247 { dummy.s } \
248 "pr20253-2c" \
249 "pass.out" \
250 ] \
251 [list \
252 "Run pr20253-2d" \
253 "tmpdir/pr20253-2a.o tmpdir/libpr20253-2a.so" \
6c0d3bde 254 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
255 { dummy.s } \
256 "pr20253-2d" \
257 "pass.out" \
258 ] \
259 [list \
260 "Run pr20253-2e" \
261 "-pie tmpdir/pr20253-2a.o tmpdir/libpr20253-2a.so" \
6c0d3bde 262 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
263 { dummy.s } \
264 "pr20253-2e" \
265 "pass.out" \
266 ] \
267 [list \
268 "Run pr20253-2f" \
68193357 269 "$NOPIE_LDFLAGS tmpdir/pr20253-2a.o" \
6c0d3bde 270 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
271 { pr20253-2b.S pr20253-2c.S pr20253-2d.S } \
272 "pr20253-2f" \
273 "pass.out" \
274 "-DCHECK_PLT" \
275 ] \
276 [list \
277 "Run pr20253-2g" \
278 "--static tmpdir/pr20253-2a.o" \
6c0d3bde 279 "-Wa,-mx86-used-note=yes" \
233cc9c1
L
280 { pr20253-2b.S pr20253-2c.S pr20253-2d.S } \
281 "pr20253-2g" \
282 "pass.out" \
283 "-DCHECK_PLT" \
284 ] \
285 ]
286}
This page took 0.22659 seconds and 4 git commands to generate.