1 # Expect script
for x86
-64 no
-PLT tests.
2 # Copyright
(C
) 2016-2024 Free Software Foundation
, Inc.
4 # This file is part of the GNU Binutils.
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.
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.
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
,
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.
33 if ![istarget
"x86_64-*-*"] {
37 # Check to see
if the C compiler works
38 if { ![check_compiler_available
] } {
42 run_cc_link_tests
[list \
44 "Build no-plt-func1.o no-plt-main1.o" \
46 "-fPIE -Wa,-mx86-used-note=yes" \
47 {no
-plt
-func1.c no
-plt
-main1.c
} \
50 "Build no-plt-check1.o no-plt-extern1.o" \
52 "-Wa,-mrelax-relocations=yes,-mx86-used-note=yes" \
53 {no
-plt
-check1.S no
-plt
-extern1.S
} \
56 "Build libno-plt-1a.so" \
57 "-shared tmpdir/no-plt-func1.o" \
58 "-Wa,-mx86-used-note=yes" \
64 "Build libno-plt-1b.so" \
65 "-shared tmpdir/no-plt-extern1.o" \
66 "-Wa,-mx86-used-note=yes" \
68 {{readelf
-Wr libno
-plt
-1b.rd
} \
69 {objdump
-dwrj.
text libno
-plt
-1b.dd
}} \
73 "No PLT (dynamic 1a)" \
74 "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
75 tmpdir
/no
-plt
-func1.o tmpdir
/no
-plt
-extern1.o
" \
76 "-Wa,-mx86-used-note=yes" \
78 {{readelf
-Wr no
-plt
-1a.rd
} {objdump
-dwrj.
text no
-plt
-1a.dd
}} \
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
" \
85 "-Wa,-mx86-used-note=yes" \
87 {{readelf
-Wr no
-plt
-1b.rd
} {objdump
-dwrj.
text no
-plt
-1b.dd
}} \
91 "No PLT (dynamic 1c)" \
92 "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
93 tmpdir
/no
-plt
-func1.o tmpdir
/libno
-plt
-1b.so
" \
94 "-Wa,-mx86-used-note=yes" \
96 {{readelf
-Wr no
-plt
-1c.rd
} {objdump
-dwrj.
text no
-plt
-1c.dd
}} \
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
" \
103 "-Wa,-mx86-used-note=yes" \
105 {{readelf
-Wr no
-plt
-1d.rd
} {objdump
-dwrj.
text no
-plt
-1d.dd
}} \
110 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
111 tmpdir
/no
-plt
-func1.o tmpdir
/no
-plt
-extern1.o
" \
112 "-Wa,-mx86-used-note=yes" \
114 {{readelf
-Wr no
-plt
-1e.rd
} {nm
-gD no
-plt
-1e.nd
} {objdump
-dwrj.
text no
-plt
-1e.dd
}} \
119 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
120 tmpdir
/libno
-plt
-1a.so tmpdir
/libno
-plt
-1b.so
" \
121 "-Wa,-mx86-used-note=yes" \
123 {{readelf
-Wr no
-plt
-1f.rd
} {objdump
-dwrj.
text no
-plt
-1f.dd
}} \
128 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
129 tmpdir
/no
-plt
-func1.o tmpdir
/libno
-plt
-1b.so
" \
130 "-Wa,-mx86-used-note=yes" \
132 {{readelf
-Wr no
-plt
-1g.rd
} {objdump
-dwrj.
text no
-plt
-1g.dd
}} \
137 run_ld_link_exec_tests
[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
" \
142 "-Wa,-mx86-used-note=yes" \
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
" \
151 "-Wa,-mx86-used-note=yes" \
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
" \
160 "-Wa,-mx86-used-note=yes" \
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
" \
169 "-Wa,-mx86-used-note=yes" \
176 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
177 tmpdir
/no
-plt
-func1.o tmpdir
/no
-plt
-extern1.o
" \
178 "-Wa,-mx86-used-note=yes" \
185 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
186 tmpdir
/libno
-plt
-1a.so tmpdir
/libno
-plt
-1b.so
" \
187 "-Wa,-mx86-used-note=yes" \
194 "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
195 tmpdir
/no
-plt
-func1.o tmpdir
/libno
-plt
-1b.so
" \
196 "-Wa,-mx86-used-note=yes" \
203 # Run
-time tests which require working IFUNC support.
204 if { [check_ifunc_available
] } {
205 run_cc_link_tests
[list \
207 "Build pr20253-2a.o pr20253-2b.o pr20253-2c.o pr20253-2d.o" \
209 "-fPIE -O2 -g -Wa,-mx86-used-note=yes" \
210 { pr20253
-2a.c pr20253
-2b.S pr20253
-2c.S pr20253
-2d.S
} \
213 "Build libpr20253-2a.so" \
214 "-shared tmpdir/pr20253-2b.o \
215 tmpdir
/pr20253
-2c.o tmpdir
/pr20253
-2d.o
" \
216 "-Wa,-mx86-used-note=yes" \
223 run_ld_link_exec_tests
[list \
226 "tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
227 tmpdir
/pr20253
-2c.o tmpdir
/pr20253
-2d.o
" \
228 "-Wa,-mx86-used-note=yes" \
235 "--static tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
236 tmpdir
/pr20253
-2c.o tmpdir
/pr20253
-2d.o
" \
237 "-Wa,-mx86-used-note=yes" \
244 "-pie tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
245 tmpdir
/pr20253
-2c.o tmpdir
/pr20253
-2d.o
" \
246 "-Wa,-mx86-used-note=yes" \
253 "tmpdir/pr20253-2a.o tmpdir/libpr20253-2a.so" \
254 "-Wa,-mx86-used-note=yes" \
261 "-pie tmpdir/pr20253-2a.o tmpdir/libpr20253-2a.so" \
262 "-Wa,-mx86-used-note=yes" \
269 "$NOPIE_LDFLAGS tmpdir/pr20253-2a.o" \
270 "-Wa,-mx86-used-note=yes" \
271 { pr20253
-2b.S pr20253
-2c.S pr20253
-2d.S
} \
278 "--static tmpdir/pr20253-2a.o" \
279 "-Wa,-mx86-used-note=yes" \
280 { pr20253
-2b.S pr20253
-2c.S pr20253
-2d.S
} \