home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / binutils-2.7-src.tgz / tar.out / fsf / binutils / ld / testsuite / ld-undefined / undefined.exp < prev   
Text File  |  1996-09-28  |  3KB  |  86 lines

  1. # Test that the linker reports undefined symbol errors correctly.
  2. # By Ian Lance Taylor, Cygnus Support
  3. #
  4. #   Copyright (C) 1995 Free Software Foundation
  5. #
  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.
  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.
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17.  
  18. set testund "undefined"
  19. set testfn "undefined function"
  20. set testline "undefined line"
  21.  
  22. if { [which $CC] == 0 } {
  23.     untested $testund
  24.     untested $testfn
  25.     untested $testline
  26.     return
  27. }
  28.  
  29. if ![ld_compile "$CC -g" $srcdir$subdir/undefined.c tmpdir/undefined.o] {
  30.     unresolved $testund
  31.     unresolved $testfn
  32.     unresolved $testline
  33.     return
  34. }
  35.  
  36. catch "exec rm -f tmpdir/undefined" exec_output
  37.  
  38. # Using -e start prevents the SunOS linker from trying to build a
  39. # shared library.
  40. send_log "$ld -e start -o tmpdir/undefined tmpdir/undefined.o\n"
  41. verbose "$ld -e start -o tmpdir/undefined tmpdir/undefined.o"
  42.  
  43. catch "exec $ld -e start -o tmpdir/undefined tmpdir/undefined.o" exec_output
  44. send_log "$exec_output\n"
  45. verbose "$exec_output"
  46.  
  47. proc checkund { string testname } {
  48.     global exec_output
  49.  
  50.     if [string match "*$string*" $exec_output] {
  51.     pass $testname
  52.     } else {
  53.     fail $testname
  54.     }
  55. }
  56.  
  57. set mu "undefined reference to `this_function_is_not_defined'"
  58. checkund $mu $testund
  59.  
  60. # ARM PE defaults to using stabs debugging, which we can't handle for
  61. # a COFF file.
  62. setup_xfail "arm*-*-pe*"
  63.  
  64. # Just doesn't work for PA ELF.  No clue why.
  65. setup_xfail "hppa*-*-*elf*"
  66.  
  67. set mf "tmpdir/undefined.o: In function `function':"
  68. checkund $mf $testfn
  69.  
  70. # COFF SH gets this test wrong--it reports line 10, because although
  71. # the jump is at line 9, the function address, and the reloc, is
  72. # stored at the end of the function.
  73. setup_xfail "sh-*-*"
  74.  
  75. # ARM PE defaults to using stabs debugging, which we can't handle for
  76. # a COFF file.
  77. setup_xfail "arm*-*-pe*"
  78.  
  79. # Just doesn't work for PA ELF.  No clue why.
  80. setup_xfail "hppa*-*-*elf*"
  81.  
  82. set ml "undefined.c:9: undefined reference to `this_function_is_not_defined'"
  83. checkund $ml $testline
  84.