diff options
author | Ian Lance Taylor <ian@airs.com> | 1995-07-14 17:11:53 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1995-07-14 17:11:53 +0000 |
commit | 738844c1f1968013afe77d23718dec65353a1078 (patch) | |
tree | 29523fb8ca2b63ec380fb31d1a753e6455bb0b40 /ld/testsuite/ld-undefined/undefined.exp | |
parent | 8a0683c1fa71457d458ef58f14901c79ed2713ee (diff) | |
download | binutils-738844c1f1968013afe77d23718dec65353a1078.zip binutils-738844c1f1968013afe77d23718dec65353a1078.tar.gz binutils-738844c1f1968013afe77d23718dec65353a1078.tar.bz2 |
* ld-undefined/undefined.exp: New test, to check reporting of
undefined symbols.
* ld-undefined/undefined.c: New file.
Diffstat (limited to 'ld/testsuite/ld-undefined/undefined.exp')
-rw-r--r-- | ld/testsuite/ld-undefined/undefined.exp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/ld/testsuite/ld-undefined/undefined.exp b/ld/testsuite/ld-undefined/undefined.exp new file mode 100644 index 0000000..168f51c --- /dev/null +++ b/ld/testsuite/ld-undefined/undefined.exp @@ -0,0 +1,64 @@ +# Test that the linker reports undefined symbol errors correctly. +# By Ian Lance Taylor, Cygnus Support +# +# Copyright (C) 1995 Free Software Foundation +# +# This file 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +set testund "undefined" +set testfn "undefined function" +set testline "undefined line" + +if ![ld_compile "$CC -g" $srcdir$subdir/undefined.c tmpdir/undefined.o] { + unresolved $testund + unresolved $testfn + unresolved $testline + return +} + +catch "exec rm -f tmpdir/undefined" exec_output + +send_log "$ld -o tmpdir/undefined tmpdir/undefined.o\n" +verbose "$ld -o tmpdir/undefined tmpdir/undefined.o" + +catch "exec $ld -o tmpdir/undefined tmpdir/undefined.o" exec_output +send_log "$exec_output\n" +verbose "$exec_output" + +proc checkund { string testname } { + global exec_output + + if [string match "*$string*" $exec_output] { + pass $testname + } else { + fail $testname + } +} + +set mu "undefined reference to `this_function_is_not_defined'" +checkund $mu $testund + +set mf "tmpdir/undefined.o: In function `function':" +checkund $mf $testfn + +# ELF targets currently can not get line number information (except +# for MIPS ELF). +setup_xfail "*-*-elf*" "*-*-sysv4*" "*-*-unixware*" "*-*-solaris*" "*-*-gnu*" +setup_xfail "hppa*-*-lites*" "m88*-harris-cxux*" "m88*-*-dgux*" +setup_xfail "powerpc*-*-eabi*" "*-stratus-*" "*-cbm-*" "*-ncr-*" +clear_xfail "mips-*-elf*" "mips-*-sysv4*" "mips-*-gnu*" + +set ml "undefined.c:9: undefined reference to `this_function_is_not_defined'" +checkund $ml $testline |