From: Ian Lance Taylor Date: Fri, 14 Jul 1995 17:11:53 +0000 (+0000) Subject: * ld-undefined/undefined.exp: New test, to check reporting of X-Git-Tag: gdb-4_18~11409 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=738844c1f1968013afe77d23718dec65353a1078;p=external%2Fbinutils.git * ld-undefined/undefined.exp: New test, to check reporting of undefined symbols. * ld-undefined/undefined.c: New file. --- diff --git a/ld/testsuite/.Sanitize b/ld/testsuite/.Sanitize index 3ffbc1c..d68fbc21 100644 --- a/ld/testsuite/.Sanitize +++ b/ld/testsuite/.Sanitize @@ -31,6 +31,7 @@ ld-cdtest ld-empic ld-scripts ld-shared +ld-undefined ld-versados Things-to-lose: diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index f70f382..c2d4ed4 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,9 +1,19 @@ +Fri Jul 14 13:07:48 1995 Ian Lance Taylor + + * ld-undefined/undefined.exp: New test, to check reporting of + undefined symbols. + * ld-undefined/undefined.c: New file. + Mon Jul 10 11:13:39 1995 Ian Lance Taylor * ld-versados/versados.exp: If a test fails, report it correctly: don't try to run the next test, and don't report a pass as well as a fail. +Mon Jul 3 14:26:37 1995 Steve Chamberlain + + * ld/testsuite/versados/(t1,t2).ld: End in newlines. + Mon May 22 20:19:38 1995 Ken Raeburn * lib/ld.exp (default_ld_compile): If cc argument is multiple diff --git a/ld/testsuite/ld-undefined/.Sanitize b/ld/testsuite/ld-undefined/.Sanitize new file mode 100644 index 0000000..d244856 --- /dev/null +++ b/ld/testsuite/ld-undefined/.Sanitize @@ -0,0 +1,37 @@ +# .Sanitize for ld dejagnu testsuites + +# Each directory to survive it's way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order.. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this directory. + +Do-first: + +# All files listed between the "Things-to-keep:" line and the +# "Do-last:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +undefined.c +undefined.exp + +Things-to-lose: + +# The lines between the "Do-last:" line and the end of the file +# are executed as a /bin/sh shell script after everything else is +# done. + +Do-last: + +#eof diff --git a/ld/testsuite/ld-undefined/undefined.c b/ld/testsuite/ld-undefined/undefined.c new file mode 100644 index 0000000..ef2aec6 --- /dev/null +++ b/ld/testsuite/ld-undefined/undefined.c @@ -0,0 +1,10 @@ +/* This file is used to test the linker's reporting of undefined + symbols. */ + +extern int this_function_is_not_defined (); + +int +function () +{ + return this_function_is_not_defined (); +} 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