1 # Test handling of weak undefined symbols
2 # Copyright
2001, 2002, 2004
3 # Free Software Foundation
, Inc.
5 # This file is free software
; you can redistribute it and
/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation
; either version
2 of the License
, or
8 #
(at your option
) any later version.
10 # This
program is distributed in the hope that it will be useful
,
11 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License
for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this
program; if not
, write to the Free Software
17 # Foundation
, Inc.
, 51 Franklin Street
- Fifth Floor
, Boston
, MA
02110-1301, USA.
19 set testname
"weak undefined symbols"
21 # This test only works
for ELF targets. It ought to work
for some
22 # a.out targets
, but it doesn
't.
24 if { ![istarget *-*-sysv4*] \
25 && ![istarget *-*-unixware*] \
26 && ![istarget *-*-elf*] \
27 && ![istarget *-*-eabi*] \
28 && ![istarget hppa*64*-*-hpux*] \
29 && ![istarget *-*-linux*] \
30 && ![istarget *-*-irix5*] \
31 && ![istarget *-*-irix6*] \
32 && ![is_pecoff_format] \
33 && ![istarget *-*-solaris2*] } then {
38 if { [istarget *-*-linux*aout*] \
39 || [istarget *-*-linux*oldld*] } {
44 # Weak symbols are broken for non-i386 PE targets.
45 if {! [istarget i?86-*-*]} {
49 setup_xfail hppa64-*-* pj-*-*
51 if {! [ld_assemble $as $srcdir/$subdir/weak-undef.s tmpdir/weak-undef.o]} then {
52 # It's OK
if .weak doesn
't work on this target.
57 # The linker should accept references to undefined weaks without error,
58 # and resolve them to zero.
61 ".*Contents of section .data:.*0000 00000000 11111111.*"
63 if {! [ld_simple_link $ld tmpdir/weak-undef "$flags tmpdir/weak-undef.o -T $srcdir/$subdir/weak-undef.t"] } then {
66 if {[which $objdump] == 0} then {
71 verbose -log "$objdump -s tmpdir/weak-undef"
72 catch "exec $objdump -s tmpdir/weak-undef" exec_output
73 set exec_output [prune_warnings $exec_output]
74 verbose -log $exec_output
76 if {[regexp $output_regexp $exec_output]} then {