2001-01-01 Philip Blundell <philb@gnu.org>
[deliverable/binutils-gdb.git] / ld / testsuite / ld-undefined / weak-undef.exp
CommitLineData
7dc542b2
PB
1# Test handling of weak undefined symbols
2
3set testname "weak undefined symbols"
4
5# This test only works for ELF targets. It ought to work for some
6# a.out targets, but it doesn't.
7
8if { ![istarget *-*-sysv4*] \
9 && ![istarget *-*-unixware*] \
10 && ![istarget *-*-elf*] \
11 && ![istarget *-*-eabi*] \
12 && ![istarget *-*-linux*] \
13 && ![istarget *-*-irix5*] \
14 && ![istarget *-*-irix6*] \
15 && ![istarget *-*-solaris2*] } then {
16 return
17}
18
19if { [istarget *-*-linux*aout*] \
20 || [istarget *-*-linux*oldld*] } {
21 return
22}
23
24if {! [ld_assemble $as $srcdir/$subdir/weak-undef.s tmpdir/weak-undef.o]} then {
25 # It's OK if .weak doesn't work on this target.
26 unresolved $testname
27 return
28}
29
30# The linker should accept references to undefined weaks without error,
31# and resolve them to zero.
32
33set output_regexp \
34".*Contents of section .data:.*0000 00000000 11111111.*"
35
36if {! [ld_simple_link $ld tmpdir/weak-undef "$flags tmpdir/weak-undef.o -T $srcdir/$subdir/weak-undef.t"] } then {
37 fail $testname
38} else {
39 if {[which $objdump] == 0} then {
40 unresolved $testname
41 return
42 }
43
44 verbose -log "$objdump -s tmpdir/weak-undef"
45 catch "exec $objdump -s tmpdir/weak-undef" exec_output
46 set exec_output [prune_warnings $exec_output]
47 verbose -log $exec_output
48
49 if {[regexp $output_regexp $exec_output]} then {
50 pass $testname
51 } else {
52 fail $testname
53 }
54}
This page took 0.023604 seconds and 4 git commands to generate.