1 # Test that the linker reports undefined symbol errors correctly.
2 # By Ian Lance Taylor, Cygnus Support
4 # Copyright (C) 1995 Free Software Foundation
6 # This file 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 set testund "undefined"
21 set testfn "undefined function"
22 set testline "undefined line"
24 if ![ld_compile "$CC -g" $srcdir$subdir/undefined.c tmpdir/undefined.o] {
31 catch "exec rm -f tmpdir/undefined" exec_output
33 send_log "$ld -o tmpdir/undefined tmpdir/undefined.o\n"
34 verbose "$ld -o tmpdir/undefined tmpdir/undefined.o"
36 catch "exec $ld -o tmpdir/undefined tmpdir/undefined.o" exec_output
37 send_log "$exec_output\n"
38 verbose "$exec_output"
40 proc checkund { string testname } {
43 if [string match "*$string*" $exec_output] {
50 set mu "undefined reference to `this_function_is_not_defined'"
53 set mf "tmpdir/undefined.o: In function `function':"
56 # ELF targets currently can not get line number information (except
58 setup_xfail "*-*-elf*" "*-*-sysv4*" "*-*-unixware*" "*-*-solaris*" "*-*-gnu*"
59 setup_xfail "hppa*-*-lites*" "m88*-harris-cxux*" "m88*-*-dgux*"
60 setup_xfail "powerpc*-*-eabi*" "*-stratus-*" "*-cbm-*" "*-ncr-*"
61 clear_xfail "mips-*-elf*" "mips-*-sysv4*" "mips-*-gnu*"
63 set ml "undefined.c:9: undefined reference to `this_function_is_not_defined'"
64 checkund $ml $testline