1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
|
# Expect script for ld-visibility tests
# Copyright (C) 2000-2024 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
#
# Written by Ian Lance Taylor (ian@cygnus.com)
# and H.J. Lu (hjl@gnu.org)
#
# Make sure that ld can generate ELF shared libraries with visibility.
# Check to see if the C compiler works
if { ![check_compiler_available] } {
return
}
# This test can only be run on a couple of ELF platforms or with
# XCOFF formats.
# Square bracket expressions seem to confuse istarget.
if { ![istarget hppa*64*-*-hpux*] \
&& ![istarget hppa*-*-linux*] \
&& ![istarget i?86-*-linux*] \
&& ![istarget i?86-*-gnu*] \
&& ![istarget *-*-nacl*] \
&& ![istarget ia64-*-linux*] \
&& ![istarget m68k-*-linux*] \
&& ![istarget mips*-*-linux*] \
&& ![istarget powerpc*-*-linux*] \
&& ![istarget arm*-*-linux*] \
&& ![istarget alpha*-*-linux*] \
&& ![istarget sparc*-*-linux*] \
&& ![istarget s390*-*-linux*] \
&& ![istarget sh\[34\]*-*-linux*] \
&& ![istarget x86_64-*-linux*] \
&& ![is_xcoff_format] } {
return
}
if [is_xcoff_format] {
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*-xcoff*.d]]
} else {
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*-elf.d]]
}
foreach t $test_list {
# We need to strip the ".d", but can leave the dirname.
verbose [file rootname $t]
run_dump_test [file rootname $t]
}
set tmpdir tmpdir
set SHCFLAG ""
set shared_needs_pic "no"
set COMPRESS_LDFLAG "-Wl,--compress-debug-sections=zlib-gabi"
if { [is_xcoff_format] } {
# Not all the useful features are available with AIX shared
# libraries by default.
# We can manage to simulate some of them with export/import
# files but the overriding of shared library functions or
# variables by the main program doesn't seem possible.
# We avoid testing those features.
set SHCFLAG "-DXCOFF_TEST"
# In order to avoid listing every symbols in an export file,
# the export will be done with -bexpall flag.
# However for imports, we must create the import file.
set file [open $tmpdir/xcoff-shared.imp w]
puts $file "#! ."
puts $file mainvar
puts $file main_called
close $file
# XCOFF doesn't yet support debug sections compresion.
set COMPRESS_LDFLAG ""
}
if [istarget arm*-*-linux*] {
# On ARM section anchors can change the symbol pre-emptability for
# non-PIC shared libraries, causing these tests to fail. Turn section
# anchors off.
set SHCFLAG "-fno-section-anchors"
# On targets that have MOVW the compiler will emit relocations which
# the linker doesn't support when compiling -shared without -fpic. The
# test to find out whether we want to XFAIL the non-PIC tests requires
# a compile - so we pre-calculate it here. We also note that this can
# only affect arm*-*-*eabi* targets as the old ABI doesn't support v7.
if [istarget arm*-*-*eabi*] {
set file [open $tmpdir/movw-detect.c w]
puts $file "void foo(void) { __asm (\"movw r0, #0\"); }"
close $file
if [run_host_cmd_yesno "$CC_FOR_TARGET" "$CFLAGS_FOR_TARGET -c $tmpdir/movw-detect.c -o $tmpdir/movw-detect.o"] {
set shared_needs_pic "yes"
}
}
}
set support_protected "no"
if { [istarget *-*-linux*]
|| [istarget *-*-nacl*]
|| [istarget *-*-gnu*] } {
if [ld_compile "$CC_FOR_TARGET -g -DPROTECTED_CHECK" $srcdir/$subdir/main.c $tmpdir/main.o] {
if [ld_link $CC_FOR_TARGET $tmpdir/main "$tmpdir/main.o"] {
catch "exec $tmpdir/main" support_protected
}
}
}
# The test procedure.
proc visibility_test { visibility progname testname main sh1 sh2 dat args } {
global CC_FOR_TARGET
global srcdir
global subdir
global exec_output
global link_output
global host_triplet
global tmpdir
if [llength $args] { set shldflags [lindex $args 0] } else { set shldflags "" }
# Build the shared library.
set shared -shared
if { [is_xcoff_format] } {
# On AIX, setup imports and exports.
append shared " -Wl,-bexpall -Wl,-bI:$tmpdir/xcoff-shared.imp"
}
if { [is_elf_format] && [check_shared_lib_support] } {
append shared " -Wl,-z,notext"
}
if {![ld_link $CC_FOR_TARGET $tmpdir/$progname.so "$shared $shldflags $tmpdir/$sh1 $tmpdir/$sh2"]} {
if { [ string match $visibility "hidden_undef" ]
&& [regexp "undefined reference to \`\.?visibility\'" $link_output]
&& [regexp "undefined reference to \`visibility_var\'" $link_output] } {
pass "$testname"
} else { if { [ string match $visibility "protected_undef" ]
&& [regexp "undefined reference to \`\.?visibility\'" $link_output]
&& [regexp "undefined reference to \`visibility_var\'" $link_output] } {
pass "$testname"
} else {
fail "$testname"
}}
return
}
# Link against the shared library. Use -rpath so that the
# dynamic linker can locate the shared library at runtime.
# On AIX, we must include /lib in -rpath, as otherwise the loader
# can not find -lc.
set rpath $tmpdir
set exportflag ""
if { [is_xcoff_format] } {
set rpath /lib:$tmpdir
set exportflag " -Wl,-bexpall"
}
if ![ld_link $CC_FOR_TARGET $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so $exportflag"] {
if { [ string match $visibility "hidden" ]
&& [regexp "undefined reference to \`\.?visibility\'" $link_output]
&& [regexp "undefined reference to \`visibility_var\'" $link_output] } {
pass "$testname"
} else { if { [ string match $visibility "hidden_undef_def" ]
&& [regexp "undefined reference to \`\.?visibility\'" $link_output]
&& [regexp "undefined reference to \`visibility_def\'" $link_output]
&& [regexp "undefined reference to \`\.?visibility_func\'" $link_output]
&& [regexp "undefined reference to \`visibility_var\'" $link_output] } {
pass "$testname"
} else {
fail "$testname"
}}
return
}
if { [ string match $visibility "hidden" ]
|| [ string match $visibility "hidden_undef" ]
|| [ string match $visibility "protected_undef" ] } {
fail "$testname"
}
if ![isnative] {
unsupported "$testname"
return
}
# Run the resulting program
send_log "$tmpdir/$progname >$tmpdir/$progname.out\n"
verbose "$tmpdir/$progname >$tmpdir/$progname.out"
catch "exec $tmpdir/$progname >$tmpdir/$progname.out" exec_output
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output"
fail "$testname"
return
}
send_log "diff $tmpdir/$progname.out $srcdir/$subdir/$dat.dat\n"
verbose "diff $tmpdir/$progname.out $srcdir/$subdir/$dat.dat"
catch "exec diff $tmpdir/$progname.out $srcdir/$subdir/$dat.dat" exec_output
set exec_output [prune_warnings $exec_output]
if {![string match "" $exec_output]} then {
send_log "$exec_output\n"
verbose "$exec_output"
fail "$testname"
return
}
pass "$testname"
}
proc visibility_run {visibility} {
global CC_FOR_TARGET
global SHCFLAG
global srcdir
global subdir
global tmpdir
global picflag
global target_triplet
global support_protected
global shared_needs_pic
global PLT_CFLAGS
global NOPIE_CFLAGS
global COMPRESS_LDFLAG
global NOSANITIZE_CFLAGS
global NOLTO_CFLAGS
if [ string match $visibility "hidden" ] {
set VSBCFLAG "-DHIDDEN_TEST"
} else { if [ string match $visibility "hidden_normal" ] {
set VSBCFLAG "-DHIDDEN_NORMAL_TEST"
} else { if [ string match $visibility "hidden_undef" ] {
set VSBCFLAG "-DHIDDEN_UNDEF_TEST"
} else { if [ string match $visibility "hidden_undef_def" ] {
set VSBCFLAG "-DHIDDEN_UNDEF_TEST -DDSO_DEFINE_TEST"
} else { if [ string match $visibility "hidden_weak" ] {
set VSBCFLAG "-DHIDDEN_WEAK_TEST"
} else { if [ string match $visibility "protected" ] {
set VSBCFLAG "-DPROTECTED_TEST"
} else { if [ string match $visibility "protected_undef" ] {
set VSBCFLAG "-DPROTECTED_UNDEF_TEST"
} else { if [ string match $visibility "protected_undef_def" ] {
set VSBCFLAG "-DPROTECTED_UNDEF_TEST -DDSO_DEFINE_TEST"
} else { if [ string match $visibility "protected_weak" ] {
set VSBCFLAG "-DPROTECTED_WEAK_TEST"
} else {
set VSBCFLAG ""
}}}}}}}}}
# Ensure we always start with a clean slate, for the "file exists"
# tests below.
remote_file host delete $tmpdir/sh1p.o $tmpdir/sh2p.o $tmpdir/sh1np.o $tmpdir/sh2np.o
set datfile elfvsb
if { [is_xcoff_format] } {
# As explained above, XCOFF shared libraries doesn't support
# all the ELF features. Thus, the output of the tests are
# a bit different.
set datfile xcoffvsb
}
if { [istarget powerpc*-*-linux*] \
|| ( [istarget mips*-*-linux*] && [at_least_gcc_version 4 3] )} {
# Testing non-PIC libraries is a waste of effort on any target.
# If you don't pass -fpic or -fPIC to gcc, gcc will assume quite
# reasonably that you are not compiling for a shared library.
# It can then make optimisations that result in shared library
# functions and variables not being overridable. Newer versions
# of gcc are more likely to do this.
} else {
# Compile the main program. Make sure that PLT is used since PLT
# is expected.
if ![ld_compile "$CC_FOR_TARGET -g $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
unsupported "visibility ($visibility) (non PIC)"
unsupported "visibility ($visibility)"
} else {
# The shared library is composed of two files. First compile them
# without using -fpic. That should work on an ELF system,
# although it will be less efficient because the dynamic linker
# will need to do more relocation work. However, note that not
# using -fpic will cause some of the tests to return different
# results. Make sure that PLT is used since PLT is expected.
if { ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
|| ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
unsupported "visibility ($visibility) (non PIC)"
} else {
# SunOS non PIC shared libraries don't permit some cases of
# overriding.
if { [ string match $visibility "protected" ]
|| [ string match $visibility "protected_undef_def" ] } {
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
}
# Non-pic code uses name binding rules for applications to
# reference variables by gp-relative relocs, which can't be
# used with overridable symbols.
if { ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "protected_undef" ] } {
setup_xfail "ia64-*-linux*"
setup_xfail "alpha*-*-linux*"
}
if { ![ string match $visibility "hidden" ]
&& ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "hidden_undef_def" ]
&& ![ string match $visibility "protected_undef" ] } {
setup_xfail "s390x-*-linux*"
if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainnp.o] } {
setup_xfail "sparc*-*-linux*"
}
}
if { [is_elf64 $tmpdir/mainnp.o] } {
setup_xfail "x86_64-*-linux*"
}
setup_xfail "x86_64-*-linux-gnux32"
if { ![istarget hppa*64*-*-linux*] } {
setup_xfail "hppa*-*-linux*"
}
if [ string match $shared_needs_pic "yes" ] {
setup_xfail "arm*-*-linux*"
}
# XCOFF format doesn't know how to handle weak undefined symbols
# in shared objects.
if { [ string match $visibility "hidden_weak" ]
|| [ string match $visibility "protected_weak" ] } {
setup_xfail "*-*-aix*"
setup_xfail "*-*-beos*"
}
visibility_test $visibility vnp "visibility ($visibility) (non PIC)" mainnp.o sh1np.o sh2np.o $datfile
# Test ELF shared library relocations with a non-zero load
# address for the library. Near as I can tell, the R_*_RELATIVE
# relocations for various targets are broken in the case where
# the load address is not zero (which is the default).
if { [ string match $visibility "protected" ]
|| [ string match $visibility "protected_undef_def" ] } {
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
}
if { [ string match $visibility "hidden_normal" ]
|| [ string match $visibility "hidden_weak" ]
|| [ string match $visibility "protected" ]
|| [ string match $visibility "protected_undef_def" ]
|| [ string match $visibility "protected_weak" ]
|| [ string match $visibility "normal" ] } {
setup_xfail "powerpc-*-linux*"
setup_xfail "s390x-*-linux*"
if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainnp.o] } {
setup_xfail "sparc*-*-linux*"
}
}
if { ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "protected_undef" ] } {
setup_xfail "ia64-*-linux*"
setup_xfail "alpha*-*-linux*"
setup_xfail "mips*-*-linux*"
}
if { [is_elf64 $tmpdir/mainnp.o] } {
setup_xfail "x86_64-*-linux*"
}
setup_xfail "x86_64-*-linux-gnux32"
if { ![istarget hppa*64*-*-linux*] } {
setup_xfail "hppa*-*-linux*"
}
if [ string match $shared_needs_pic "yes" ] {
setup_xfail "arm*-*-linux*"
}
# XCOFF format doesn't know how to handle weak undefined symbols
# in shared objects.
if { [ string match $visibility "hidden_weak" ]
|| [ string match $visibility "protected_weak" ] } {
setup_xfail "*-*-aix*"
setup_xfail "*-*-beos*"
}
if { ![is_xcoff_format] } {
visibility_test $visibility vnp "visibility ($visibility) (non PIC, load offset)" \
mainnp.o sh1np.o sh2np.o $datfile \
"-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv"
}
}
# Now compile the code using -fpic.
if { ![ld_compile "$CC_FOR_TARGET -g $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o]
|| ![ld_compile "$CC_FOR_TARGET -g $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh2.c $tmpdir/sh2p.o] } {
unsupported "visibility ($visibility)"
} else {
if { [ string match $visibility "protected" ]
|| [ string match $visibility "protected_undef_def" ] } {
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
}
visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o $datfile $COMPRESS_LDFLAG
}
}}
if { [istarget powerpc*-*-linux*] } {
# Don't bother.
} else {
# Now do the same tests again, but this time compile main.c PIC.
if ![ld_compile "$CC_FOR_TARGET -g $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -DSHARED $picflag" $srcdir/$subdir/main.c $tmpdir/mainp.o] {
unsupported "visibility ($visibility) (PIC main, non PIC so)"
unsupported "visibility ($visibility) (PIC main)"
} else {
if { [ remote_file host exists $tmpdir/sh1np.o ]
&& [ remote_file host exists $tmpdir/sh2np.o ] } {
# SunOS non PIC shared libraries don't permit some cases of
# overriding.
if { [ string match $visibility "protected" ]
|| [ string match $visibility "protected_undef_def" ] } {
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
}
if { ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "protected_undef" ] } {
setup_xfail "ia64-*-linux*"
setup_xfail "alpha*-*-linux*"
}
if { ![ string match $visibility "hidden" ]
&& ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "hidden_undef_def" ]
&& ![ string match $visibility "protected_undef" ] } {
setup_xfail "s390x-*-linux*"
if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainp.o] } {
setup_xfail "sparc*-*-linux*"
}
}
if { [is_elf64 $tmpdir/mainp.o] } {
setup_xfail "x86_64-*-linux*"
}
setup_xfail "x86_64-*-linux-gnux32"
if { ![istarget hppa*64*-*-linux*] } {
setup_xfail "hppa*-*-linux*"
}
if [ string match $shared_needs_pic "yes" ] {
setup_xfail "arm*-*-linux*"
}
# XCOFF format doesn't know how to handle weak undefined symbols
# in shared objects.
if { [ string match $visibility "hidden_weak" ]
|| [ string match $visibility "protected_weak" ] } {
setup_xfail "*-*-aix*"
setup_xfail "*-*-beos*"
}
visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o $datfile
} else {
unsupported "visibility (PIC main, non PIC so)"
}
if { [ remote_file host exists $tmpdir/sh1p.o ]
&& [ remote_file host exists $tmpdir/sh2p.o ] } {
if { [ string match $visibility "protected" ]
|| [ string match $visibility "protected_undef_def" ] } {
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
}
# XCOFF format doesn't know how to handle weak undefined symbols
# in shared objects.
if { [ string match $visibility "hidden_weak" ]
|| [ string match $visibility "protected_weak" ] } {
setup_xfail "*-*-aix*"
setup_xfail "*-*-beos*"
}
visibility_test $visibility vmpp "visibility ($visibility) (PIC main)" mainp.o sh1p.o sh2p.o $datfile
} else {
unsupported "visibility ($visibility) (PIC main)"
}
}}
}
# Old version of GCC for MIPS default to enabling -fpic
# and get confused if it is used on the command line.
if { [istarget mips*-*-*] && ! [at_least_gcc_version 4 3] } then {
set picflag ""
} else {
# Unfortunately, the gcc argument is -fpic and the cc argument is
# -KPIC. We have to try both.
set picflag "-fpic"
send_log "$CC_FOR_TARGET $picflag\n"
verbose "$CC_FOR_TARGET $picflag"
catch "exec $CC_FOR_TARGET $picflag" exec_output
send_log "$exec_output\n"
verbose "--" "$exec_output"
if { [string match "*illegal option*" $exec_output] \
|| [string match "*option ignored*" $exec_output] \
|| [string match "*unrecognized option*" $exec_output] \
|| [string match "*passed to ld*" $exec_output] } {
set picflag "-KPIC"
}
}
verbose "Using $picflag to compile PIC code"
visibility_run hidden
visibility_run hidden_normal
visibility_run hidden_undef
visibility_run hidden_undef_def
visibility_run hidden_weak
visibility_run protected
visibility_run protected_undef
visibility_run protected_undef_def
visibility_run protected_weak
visibility_run normal
if { ![ld_compile "$CC_FOR_TARGET -g $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/common.c tmpdir/common.o] } {
unsupported "common hidden symbol"
} else {
if ![ld_link $ld tmpdir/common "tmpdir/common.o"] {
fail "common hidden symbol"
} else {
pass "common hidden symbol"
}
}
if { ![ld_compile "$CC_FOR_TARGET -g $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/test.c tmpdir/test.o] } {
unsupported "weak hidden symbol"
} else {
if { ![ld_compile "$CC_FOR_TARGET -g $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh3.c tmpdir/sh3.o] } {
unsupported "weak hidden symbol"
} else {
set shared "-shared"
if { [is_xcoff_format] } {
# On AIX, setup imports and exports.
append shared " -bexpall"
}
if ![ld_link $ld tmpdir/sh3.so "$shared tmpdir/sh3.o"] {
fail "weak hidden symbol"
} else {
if ![ld_link $ld tmpdir/weak "tmpdir/test.o tmpdir/sh3.so"] {
fail "weak hidden symbol DSO last"
} else {
pass "weak hidden symbol DSO last"
}
if ![ld_link $ld tmpdir/weak "tmpdir/sh3.so tmpdir/test.o"] {
fail "weak hidden symbol DSO first"
} else {
pass "weak hidden symbol DSO first"
}
}
}
}
|