1 # Test handling of weak undefined symbols
2 # Copyright
(C
) 2001-2016 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
,
21 set testname
"weak undefined symbols"
23 # This test only works
for ELF targets. It ought to work
for some
24 # a.out targets
, but it doesn
't.
26 if { ![istarget *-*-sysv4*] \
27 && ![istarget *-*-unixware*] \
28 && ![istarget *-*-elf*] \
29 && ![istarget *-*-eabi*] \
30 && ![istarget hppa*64*-*-hpux*] \
31 && ![istarget *-*-linux*] \
32 && ![istarget *-*-gnu*] \
33 && ![istarget *-*-nacl*] \
34 && ![istarget *-*-irix5*] \
35 && ![istarget *-*-irix6*] \
36 && ![is_pecoff_format] \
37 && ![istarget *-*-solaris2*] } then {
42 if { [istarget *-*-linux*aout*] \
43 || [istarget *-*-linux*oldld*] } {
48 # Weak symbols are broken for non-i386 PE targets.
49 if {! [istarget i?86-*-*]} {
55 if {! [ld_assemble $as $srcdir/$subdir/weak-undef.s tmpdir/weak-undef.o]} then {
56 # It's OK
if .weak doesn
't work on this target.
61 # The linker should accept references to undefined weaks without error,
62 # and resolve them to zero.
65 ".*Contents of section .data:.*0000 00000000 11111111.*"
67 if {! [ld_simple_link $ld tmpdir/weak-undef "$flags tmpdir/weak-undef.o -T $srcdir/$subdir/weak-undef.t"] } then {
70 if {![is_remote host] && [which $objdump] == 0} then {
75 set exec_output [run_host_cmd "$objdump" "-s tmpdir/weak-undef"]
76 set exec_output [prune_warnings $exec_output]
77 verbose -log $exec_output
79 if {[regexp $output_regexp $exec_output]} then {