]>
Commit | Line | Data |
---|---|---|
5d3236ee | 1 | # Expect script for ld-plugin tests |
b3adc24a | 2 | # Copyright (C) 2010-2020 Free Software Foundation, Inc. |
5d3236ee DK |
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 | # These tests require the plugin API to be configured in. | |
22 | if ![check_plugin_api_available] { | |
23 | return | |
24 | } | |
25 | ||
c3842ce5 DK |
26 | # And a compiler to be available. |
27 | set can_compile 1 | |
e0ae9e28 | 28 | set failure_kind "unresolved" |
44ed8092 | 29 | if { ![check_compiler_available] } { |
c3842ce5 DK |
30 | # Don't fail immediately, |
31 | set can_compile 0 | |
e0ae9e28 | 32 | set failure_kind "unsupported" |
c3842ce5 DK |
33 | } |
34 | ||
5d3236ee DK |
35 | pass "plugin API enabled" |
36 | ||
37 | global base_dir | |
38 | ||
39 | # Look for the name we can dlopen in the test plugin's libtool control script. | |
40 | set plugin_name [file_contents "$base_dir/libldtestplug.la"] | |
41 | set plugin_name [regsub "'.*" [regsub ".*dlname='" "$plugin_name" ""] ""] | |
760f6ee8 NC |
42 | # Even though the API supports plugins it does not mean that the |
43 | # linker was configured with --enable-plugins. Check for that here. | |
44 | if { $plugin_name == "" } { | |
45 | verbose "The linker is not configured to support plugins" | |
46 | return | |
47 | } | |
5d3236ee DK |
48 | verbose "plugin name is '$plugin_name'" |
49 | ||
439b7f41 L |
50 | set plugin2_name [file_contents "$base_dir/libldtestplug2.la"] |
51 | set plugin2_name [regsub "'.*" [regsub ".*dlname='" "$plugin2_name" ""] ""] | |
52 | verbose "plugin2 name is '$plugin2_name'" | |
53 | ||
54 | set plugin3_name [file_contents "$base_dir/libldtestplug3.la"] | |
55 | set plugin3_name [regsub "'.*" [regsub ".*dlname='" "$plugin3_name" ""] ""] | |
56 | verbose "plugin3 name is '$plugin3_name'" | |
57 | ||
3355cb3b L |
58 | set plugin4_name [file_contents "$base_dir/libldtestplug4.la"] |
59 | set plugin4_name [regsub "'.*" [regsub ".*dlname='" "$plugin4_name" ""] ""] | |
60 | verbose "plugin4 name is '$plugin4_name'" | |
61 | ||
5d3236ee DK |
62 | # Use libtool to find full path to plugin rather than worrying |
63 | # about run paths or anything like that. | |
64 | catch "exec $base_dir/libtool --config" lt_config | |
65 | verbose "Full lt config: $lt_config" 3 | |
66 | # Look for "objdir=.libs" | |
67 | regexp -line "^objdir=.*$" "$lt_config" lt_objdir | |
68 | verbose "lt_objdir line is '$lt_objdir'" 3 | |
69 | set lt_objdir [regsub "objdir=" "$lt_objdir" ""] | |
70 | set plugin_path "$base_dir/$lt_objdir/$plugin_name" | |
439b7f41 L |
71 | set plugin2_path "$base_dir/$lt_objdir/$plugin2_name" |
72 | set plugin3_path "$base_dir/$lt_objdir/$plugin3_name" | |
3355cb3b | 73 | set plugin4_path "$base_dir/$lt_objdir/$plugin4_name" |
5d3236ee | 74 | verbose "Full plugin path $plugin_path" 2 |
439b7f41 L |
75 | verbose "Full plugin2 path $plugin2_path" 2 |
76 | verbose "Full plugin3 path $plugin3_path" 2 | |
3355cb3b | 77 | verbose "Full plugin4 path $plugin4_path" 2 |
5d3236ee | 78 | |
5d3236ee DK |
79 | set regclm "-plugin-opt registerclaimfile" |
80 | set regas "-plugin-opt registerallsymbolsread" | |
f58926a6 | 81 | set regassilent "-plugin-opt registerallsymbolsreadsilent" |
5d3236ee DK |
82 | set regcln "-plugin-opt registercleanup" |
83 | ||
6927f982 NC |
84 | if { [istarget m681*-*-*] || [istarget m68hc1*-*-*] || [istarget m9s12x*-*-*] } { |
85 | # otherwise get FAILS due to _.frame | |
86 | set CFLAGS "$CFLAGS -fomit-frame-pointer" | |
87 | } | |
5d3236ee DK |
88 | # In order to define symbols in plugin options in the list of tests below, |
89 | # we need to know if the platform prepends an underscore to C symbols, | |
90 | # which we find out by compiling the test objects now. If there is any | |
91 | # error compiling, we defer reporting it until after the list of tests has | |
92 | # been initialised, so that we can use the names in the list to report; | |
93 | # otherwise, we scan one of the files with 'nm' and look for a known symbol | |
94 | # in the output to see if it is prefixed or not. | |
95 | set failed_compile 0 | |
96 | set _ "" | |
97 | set plugin_nm_output "" | |
1949ad04 L |
98 | global NOSANTIZE_CFLAGS |
99 | set old_CFLAGS "$CFLAGS" | |
100 | append CFLAGS " $NOSANTIZE_CFLAGS" | |
c3842ce5 DK |
101 | if { $can_compile && \ |
102 | (![ld_compile "$CC $CFLAGS" $srcdir/$subdir/main.c tmpdir/main.o] \ | |
103 | || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/func.c tmpdir/func.o] \ | |
f58926a6 | 104 | || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/text.c tmpdir/text.o] \ |
3355cb3b | 105 | || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/pr20070a.c tmpdir/pr20070a.o] \ |
f58926a6 L |
106 | || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/dummy.s tmpdir/dummy.o] \ |
107 | || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/pr17973.s tmpdir/pr17973.o]) } { | |
5d3236ee DK |
108 | # Defer fail until we have list of tests set. |
109 | set failed_compile 1 | |
c3842ce5 | 110 | } |
1949ad04 | 111 | set CFLAGS "$old_CFLAGS" |
c3842ce5 | 112 | |
4e95fbcd | 113 | set dotsym 0 |
c3842ce5 | 114 | if { $can_compile && !$failed_compile } { |
5d3236ee DK |
115 | # Find out if symbols have prefix on this platform before setting tests. |
116 | catch "exec $NM tmpdir/func.o" plugin_nm_output | |
117 | if { [regexp "_func" "$plugin_nm_output"] } { | |
118 | set _ "_" | |
119 | } | |
4e95fbcd AM |
120 | if { [regexp "\\.func" "$plugin_nm_output"] } { |
121 | set dotsym 1 | |
122 | } | |
5d3236ee DK |
123 | } |
124 | ||
36fe835f DK |
125 | set testobjfiles "tmpdir/main.o tmpdir/func.o tmpdir/text.o" |
126 | set testobjfiles_notext "tmpdir/main.o tmpdir/func.o" | |
439b7f41 L |
127 | set testsrcfiles "tmpdir/main.o $srcdir/$subdir/func.c tmpdir/text.o" |
128 | set testsrcfiles_notext "tmpdir/main.o $srcdir/$subdir/func.c" | |
36fe835f DK |
129 | # Rather than having libs we just define dummy values for anything |
130 | # we may need to link a target exe; we aren't going to run it anyway. | |
d9816402 | 131 | set libs "[ld_link_defsyms] --defsym ${_}printf=${_}main --defsym ${_}puts=${_}main" |
4e95fbcd AM |
132 | if { $dotsym } { |
133 | append libs " --defsym .printf=.main --defsym .puts=.main" | |
134 | } | |
36fe835f | 135 | |
5d3236ee DK |
136 | set plugin_tests [list \ |
137 | [list "load plugin" "-plugin $plugin_path \ | |
897aea50 | 138 | $testobjfiles $libs" "" "" "" {{ld plugin-1.d}} "main.x" ] \ |
5d3236ee | 139 | [list "fail plugin onload" "-plugin $plugin_path -plugin-opt failonload \ |
897aea50 | 140 | $testobjfiles $libs" "" "" "" {{ld plugin-2.d}} "main.x" ] \ |
5d3236ee DK |
141 | [list "fail plugin allsymbolsread" "-plugin $plugin_path $regas \ |
142 | -plugin-opt failallsymbolsread \ | |
897aea50 | 143 | $testobjfiles $libs" "" "" "" {{ld plugin-3.d}} "main.x" ] \ |
5d3236ee DK |
144 | [list "fail plugin cleanup" "-plugin $plugin_path -plugin-opt failcleanup \ |
145 | $regcln \ | |
897aea50 | 146 | $testobjfiles $libs" "" "" "" {{ld plugin-4.d}} "main.x" ] \ |
5d3236ee | 147 | [list "plugin all hooks" "-plugin $plugin_path $regclm $regas $regcln \ |
897aea50 | 148 | $testobjfiles $libs" "" "" "" {{ld plugin-5.d}} "main.x" ] \ |
5d3236ee DK |
149 | [list "plugin claimfile lost symbol" "-plugin $plugin_path $regclm \ |
150 | $regas $regcln -plugin-opt claim:tmpdir/func.o \ | |
897aea50 | 151 | $testobjfiles $libs" "" "" "" {{ld plugin-6.d}} "main.x" ] \ |
5d3236ee DK |
152 | [list "plugin claimfile replace symbol" "-plugin $plugin_path $regclm \ |
153 | $regas $regcln -plugin-opt claim:tmpdir/func.o \ | |
154 | -plugin-opt sym:${_}func::0:0:0 \ | |
897aea50 | 155 | $testobjfiles $libs" "" "" "" {{ld plugin-7.d}} "main.x" ] \ |
5d3236ee DK |
156 | [list "plugin claimfile resolve symbol" "-plugin $plugin_path $regclm \ |
157 | $regas $regcln -plugin-opt claim:tmpdir/func.o \ | |
158 | -plugin-opt sym:${_}func::0:0:0 \ | |
159 | -plugin-opt sym:${_}func2::0:0:0 \ | |
160 | -plugin-opt dumpresolutions \ | |
897aea50 | 161 | $testobjfiles $libs" "" "" "" {{ld plugin-8.d}} "main.x" ] \ |
5d3236ee DK |
162 | [list "plugin claimfile replace file" "-plugin $plugin_path $regclm \ |
163 | $regas $regcln -plugin-opt claim:tmpdir/func.o \ | |
164 | -plugin-opt sym:${_}func::0:0:0 \ | |
165 | -plugin-opt sym:${_}func2::0:0:0 \ | |
166 | -plugin-opt dumpresolutions \ | |
167 | -plugin-opt add:tmpdir/func.o \ | |
897aea50 | 168 | $testobjfiles $libs" "" "" "" {{ld plugin-9.d}} "main.x" ] \ |
439b7f41 L |
169 | [list "load plugin with source" "-plugin $plugin_path $regclm \ |
170 | -plugin-opt claim:$srcdir/$subdir/func.c \ | |
171 | $testsrcfiles $libs" "" "" "" {{ld plugin-13.d}} "main.x" ] \ | |
172 | [list "plugin claimfile lost symbol with source" \ | |
173 | "-plugin $plugin_path $regclm $regas $regcln \ | |
174 | -plugin-opt claim:$srcdir/$subdir/func.c \ | |
175 | $testsrcfiles $libs" "" "" "" {{ld plugin-14.d}} "main.x" ] \ | |
176 | [list "plugin claimfile replace symbol with source" \ | |
177 | "-plugin $plugin_path $regclm $regas $regcln \ | |
178 | -plugin-opt claim:$srcdir/$subdir/func.c \ | |
179 | -plugin-opt sym:${_}func::0:0:0 \ | |
180 | $testsrcfiles $libs" "" "" "" {{ld plugin-15.d}} "main.x" ] \ | |
181 | [list "plugin claimfile resolve symbol with source" \ | |
182 | "-plugin $plugin_path $regclm $regas $regcln \ | |
183 | -plugin-opt claim:$srcdir/$subdir/func.c \ | |
184 | -plugin-opt sym:${_}func::0:0:0 \ | |
185 | -plugin-opt sym:${_}func2::0:0:0 \ | |
186 | -plugin-opt dumpresolutions \ | |
187 | $testsrcfiles $libs" "" "" "" {{ld plugin-16.d}} "main.x" ] \ | |
188 | [list "plugin claimfile replace file with source" \ | |
189 | "-plugin $plugin_path $regclm $regas $regcln \ | |
190 | -plugin-opt claim:$srcdir/$subdir/func.c \ | |
191 | -plugin-opt sym:${_}func::0:0:0 \ | |
192 | -plugin-opt sym:${_}func2::0:0:0 \ | |
193 | -plugin-opt dumpresolutions \ | |
194 | -plugin-opt add:tmpdir/func.o \ | |
195 | $testsrcfiles $libs" "" "" "" {{ld plugin-17.d}} "main.x" ] \ | |
196 | [list "load plugin with source not claimed" "-plugin $plugin_path $regclm \ | |
197 | $testsrcfiles $libs" "" "" "" {{ld plugin-26.d}} "main.x" ] \ | |
45e81354 L |
198 | [list "plugin fatal error" "-plugin $plugin2_path -plugin-opt fatal \ |
199 | $testobjfiles $libs" "" "" "" {{ld plugin-27.d}} "main.x" ] \ | |
200 | [list "plugin error" "-plugin $plugin2_path -plugin-opt error \ | |
201 | $testobjfiles $libs" "" "" "" {{ld plugin-28.d}} "main.x" ] \ | |
202 | [list "plugin warning" "-plugin $plugin2_path -plugin-opt warning \ | |
203 | $testobjfiles $libs" "" "" "" {{ld plugin-29.d}} "main.x" ] \ | |
5d3236ee DK |
204 | ] |
205 | ||
4a85cc09 SKS |
206 | if [check_shared_lib_support] { |
207 | lappend plugin_tests [list "PR ld/17973" "-plugin $plugin2_path -shared $regassilent \ | |
208 | -plugin-opt add:tmpdir/pr17973.o \ | |
209 | tmpdir/dummy.o" "" "" "" {{readelf -sW pr17973.d}} "main.x" ] | |
210 | } | |
211 | ||
212 | ||
5d3236ee DK |
213 | set plugin_lib_tests [list \ |
214 | [list "plugin ignore lib" "-plugin $plugin_path $regclm \ | |
215 | $regas $regcln -plugin-opt claim:tmpdir/func.o \ | |
216 | -plugin-opt sym:${_}func::0:0:0 \ | |
217 | -plugin-opt sym:${_}func2::0:0:0 \ | |
218 | -plugin-opt dumpresolutions \ | |
219 | -plugin-opt add:tmpdir/func.o \ | |
897aea50 | 220 | $testobjfiles_notext -Ltmpdir -ltext $libs" "" "" "" {{ld plugin-10.d}} "main.x" ] \ |
5d3236ee DK |
221 | [list "plugin claimfile replace lib" "-plugin $plugin_path $regclm \ |
222 | $regas $regcln -plugin-opt claim:tmpdir/func.o \ | |
223 | -plugin-opt sym:${_}func::0:0:0 \ | |
224 | -plugin-opt sym:${_}func2::0:0:0 \ | |
225 | -plugin-opt dumpresolutions \ | |
226 | -plugin-opt add:tmpdir/func.o \ | |
227 | -plugin-opt claim:tmpdir/libtext.a \ | |
228 | -plugin-opt sym:${_}text::0:0:0 \ | |
229 | -plugin-opt add:tmpdir/text.o \ | |
897aea50 | 230 | $testobjfiles_notext -Ltmpdir -ltext $libs" "" "" "" {{ld plugin-11.d}} "main.x" ] \ |
439b7f41 L |
231 | [list "plugin ignore lib with source" \ |
232 | "-plugin $plugin_path $regclm $regas $regcln \ | |
233 | -plugin-opt claim:$srcdir/$subdir/func.c \ | |
234 | -plugin-opt sym:${_}func::0:0:0 \ | |
235 | -plugin-opt sym:${_}func2::0:0:0 \ | |
236 | -plugin-opt dumpresolutions \ | |
237 | -plugin-opt add:tmpdir/func.o \ | |
238 | $testsrcfiles_notext -Ltmpdir -ltext $libs" "" "" "" {{ld plugin-18.d}} "main.x" ] \ | |
239 | [list "plugin claimfile replace lib with source" \ | |
240 | "-plugin $plugin_path $regclm $regas $regcln \ | |
241 | -plugin-opt claim:$srcdir/$subdir/func.c \ | |
242 | -plugin-opt sym:${_}func::0:0:0 \ | |
243 | -plugin-opt sym:${_}func2::0:0:0 \ | |
244 | -plugin-opt dumpresolutions \ | |
245 | -plugin-opt add:tmpdir/func.o \ | |
246 | -plugin-opt claim:tmpdir/libtext.a \ | |
247 | -plugin-opt sym:${_}text::0:0:0 \ | |
248 | -plugin-opt add:tmpdir/text.o \ | |
249 | $testsrcfiles_notext -Ltmpdir -ltext $libs" "" "" "" {{ld plugin-19.d}} "main.x" ] \ | |
ace667e5 AB |
250 | [list "plugin with empty archive" \ |
251 | "-plugin $plugin_path $regclm \ | |
252 | -plugin-opt read:8 \ | |
253 | $testobjfiles tmpdir/libempty.a $libs" "" "" "" {{ld plugin-30.d}} "main.x" ] \ | |
5d3236ee DK |
254 | ] |
255 | ||
256 | set plugin_extra_elf_tests [list \ | |
257 | [list "plugin set symbol visibility" "-plugin $plugin_path $regclm \ | |
258 | $regas $regcln -plugin-opt claim:tmpdir/func.o \ | |
259 | -plugin-opt sym:${_}func::0:0:0 \ | |
260 | -plugin-opt sym:${_}func1::0:1:0 \ | |
261 | -plugin-opt sym:${_}func2::0:2:0 \ | |
262 | -plugin-opt sym:${_}func3::0:3:0 \ | |
263 | -plugin-opt dumpresolutions \ | |
9e2278f5 | 264 | -plugin-opt add:tmpdir/func.o \ |
c4139418 L |
265 | -plugin-opt add:tmpdir/func1p.o \ |
266 | -plugin-opt add:tmpdir/func2i.o \ | |
267 | -plugin-opt add:tmpdir/func3h.o \ | |
897aea50 | 268 | $testobjfiles $libs --verbose=2" "" "" "" {{ld plugin-12.d} \ |
c4139418 | 269 | {readelf -s plugin-vis-1.d}} "main.x" ] \ |
439b7f41 L |
270 | [list "plugin set symbol visibility with source" \ |
271 | "-plugin $plugin_path $regclm $regas $regcln \ | |
272 | -plugin-opt claim:$srcdir/$subdir/func.c \ | |
273 | -plugin-opt sym:${_}func::0:0:0 \ | |
274 | -plugin-opt sym:${_}func1::0:1:0 \ | |
275 | -plugin-opt sym:${_}func2::0:2:0 \ | |
276 | -plugin-opt sym:${_}func3::0:3:0 \ | |
277 | -plugin-opt dumpresolutions \ | |
278 | -plugin-opt add:tmpdir/func.o \ | |
279 | -plugin-opt add:tmpdir/func1p.o \ | |
280 | -plugin-opt add:tmpdir/func2i.o \ | |
281 | -plugin-opt add:tmpdir/func3h.o \ | |
282 | $testsrcfiles $libs --verbose=2" "" "" "" {{ld plugin-12.d} \ | |
283 | {readelf -s plugin-vis-1.d}} "main.x" ] \ | |
5d3236ee DK |
284 | ] |
285 | ||
c3842ce5 | 286 | if { !$can_compile || $failed_compile } { |
5d3236ee | 287 | foreach testitem $plugin_tests { |
e0ae9e28 | 288 | $failure_kind [lindex $testitem 0] |
5d3236ee DK |
289 | } |
290 | if { [is_elf_format] } { | |
291 | foreach testitem $plugin_extra_elf_tests { | |
e0ae9e28 | 292 | $failure_kind [lindex $testitem 0] |
5d3236ee DK |
293 | } |
294 | } | |
295 | return | |
296 | } | |
297 | ||
298 | run_ld_link_tests $plugin_tests | |
299 | ||
c4139418 L |
300 | if { [is_elf_format] \ |
301 | && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func1p.c tmpdir/func1p.o] \ | |
302 | && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func2i.c tmpdir/func2i.o] \ | |
303 | && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func3h.c tmpdir/func3h.o] } { | |
5d3236ee DK |
304 | run_ld_link_tests $plugin_extra_elf_tests |
305 | } | |
306 | ||
ace667e5 AB |
307 | if {![ar_simple_create $ar "" "tmpdir/libtext.a" "tmpdir/text.o"] || \ |
308 | ![ar_simple_create $ar "" "tmpdir/libempty.a" ""]} { | |
5d3236ee DK |
309 | foreach testitem $plugin_lib_tests { |
310 | unresolved [lindex $testitem 0] | |
311 | } | |
312 | } else { | |
313 | run_ld_link_tests $plugin_lib_tests | |
314 | } | |
439b7f41 L |
315 | |
316 | set plugin_src_tests [list \ | |
317 | [list "plugin 2 with source lib" \ | |
318 | "-plugin $plugin2_path $regclm $regas $regcln \ | |
319 | -plugin-opt dumpresolutions \ | |
320 | tmpdir/main.o -Ltmpdir -ltext -lfunc $libs" "" "" "" {{ld plugin-20.d}} "main.x" ] \ | |
321 | [list "load plugin 2 with source" \ | |
322 | "-plugin $plugin2_path $regclm $regas $regcln \ | |
323 | -plugin-opt dumpresolutions \ | |
324 | $testsrcfiles $libs" "" "" "" {{ld plugin-21.d}} "main.x" ] \ | |
325 | [list "load plugin 2 with source and -r" \ | |
326 | "-r -plugin $plugin2_path $regclm $regas $regcln \ | |
327 | -plugin-opt dumpresolutions \ | |
328 | $testsrcfiles $libs" "" "" "" {{ld plugin-24.d}} "main.x" ] \ | |
329 | [list "plugin 3 with source lib" \ | |
330 | "-plugin $plugin3_path $regclm $regas $regcln \ | |
331 | -plugin-opt dumpresolutions \ | |
332 | tmpdir/main.o -Ltmpdir -ltext -lfunc $libs" "" "" "" {{ld plugin-22.d}} "main.x" ] \ | |
333 | [list "load plugin 3 with source" \ | |
334 | "-plugin $plugin3_path $regclm $regas $regcln \ | |
335 | -plugin-opt dumpresolutions \ | |
336 | $testsrcfiles $libs" "" "" "" {{ld plugin-23.d}} "main.x" ] \ | |
337 | [list "load plugin 3 with source and -r" \ | |
338 | "-r -plugin $plugin3_path $regclm $regas $regcln \ | |
339 | -plugin-opt dumpresolutions \ | |
340 | $testsrcfiles $libs" "" "" "" {{ld plugin-25.d}} "main.x" ] \ | |
341 | ] | |
342 | ||
343 | # Check if nm --plugin works. | |
344 | set testname "nm --plugin" | |
345 | set nm_plugin "$NM --plugin $plugin2_path $srcdir/$subdir/func.c" | |
346 | catch "exec $nm_plugin" plugin_nm_output | |
347 | send_log "$nm_plugin\n" | |
348 | send_log "$plugin_nm_output\n" | |
349 | if { [regexp "0+ T func" "$plugin_nm_output"] && | |
350 | [regexp "0+ T _func" "$plugin_nm_output"] } { | |
351 | pass $testname | |
352 | } else { | |
353 | fail $testname | |
354 | } | |
355 | ||
356 | # Check if ar --plugin works. | |
357 | file delete tmpdir/libfunc.a | |
358 | if [ar_simple_create $ar "--plugin $plugin2_path" "tmpdir/libfunc.a" \ | |
359 | "tmpdir/main.o $srcdir/$subdir/func.c"] { | |
360 | set testname "ar --plugin" | |
361 | set nm_plugin "$NM -s --plugin $plugin2_path tmpdir/libfunc.a" | |
362 | catch "exec $nm_plugin" plugin_nm_output | |
363 | send_log "$nm_plugin\n" | |
364 | send_log "$plugin_nm_output\n" | |
365 | if { [regexp "func in func.c" "$plugin_nm_output"] && | |
366 | [regexp "_func in func.c" "$plugin_nm_output"] } { | |
367 | pass $testname | |
368 | run_ld_link_tests $plugin_src_tests | |
369 | } else { | |
370 | fail $testname | |
371 | } | |
372 | } else { | |
373 | foreach testitem $plugin_src_tests { | |
374 | unresolved [lindex $testitem 0] | |
375 | } | |
376 | } | |
3355cb3b L |
377 | |
378 | file delete tmpdir/libpr20070.a | |
379 | if [ar_simple_create $ar "--plugin $plugin4_path" "tmpdir/libpr20070.a" \ | |
380 | "$srcdir/$subdir/pr20070b.c"] { | |
381 | run_ld_link_tests [list \ | |
382 | [list \ | |
383 | "PR ld/20070" \ | |
384 | "-Bstatic -plugin $plugin4_path $regclm \ | |
385 | $regas $regcln \ | |
386 | -plugin-opt claim:$srcdir/$subdir/pr20070b.c \ | |
387 | -plugin-opt claim:tmpdir/libpr20070.a \ | |
388 | -plugin-opt dumpresolutions \ | |
389 | tmpdir/pr20070a.o tmpdir/text.o tmpdir/libpr20070.a $libs" \ | |
390 | "" "" "" {{ld pr20070.d}} "pr20070.x" \ | |
391 | ] \ | |
392 | ] | |
393 | } else { | |
394 | unresolved "PR ld/20070" | |
395 | } |