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-bootstrap / bootstrap.exp
Text File  |  1996-09-28  |  3KB  |  97 lines

  1. # Expect script for LD Bootstrap Tests
  2. #   Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation
  3. #
  4. # This file is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2 of the License, or
  7. # (at your option) any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program; if not, write to the Free Software
  14. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. #
  16. # Written by Jeffrey Wheat (cassidy@cygnus.com)
  17. # Rewritten by Ian Lance Taylor (ian@cygnus.com)
  18. #
  19.  
  20. # Make sure that ld can bootstrap itself.
  21.  
  22. # This test can only be run if ld generates native executables.
  23. if ![isnative] {
  24.     return
  25. }
  26.  
  27. # Bootstrap ld.  First link the object files together using -r, in
  28. # order to test -r.  Then link the result into an executable, ld1, to
  29. # really test -r.  Use ld1 to link a fresh ld, ld2.  Use ld2 to link a
  30. # new ld, ld3.  ld2 and ld3 should be identical.
  31.  
  32. foreach flags {"" "--static" "--traditional-format" "--no-keep-memory"} {
  33.     if {"$flags" != ""} { 
  34.     set testname "bootstrap with $flags"
  35.     } else {
  36.     set testname "bootstrap"
  37.     }
  38.  
  39.     # This test can only be run if we have the ld build directory,
  40.     # since we need the object files.
  41.     if {$ld != "$objdir/ld.new"} {
  42.     untested $testname
  43.     continue
  44.     }
  45.  
  46.     if ![ld_relocate $ld tmpdir/ld-partial.o "$flags $OFILES"] {
  47.     fail $testname
  48.     continue
  49.     }
  50.  
  51.     # On AIX, you need to specify an import list when using --static.
  52.     # You only want the import list when creating the final
  53.     # executable.
  54.     if [istarget "*-*-aix*"] {
  55.     if {"$flags" == "--static"} {
  56.         set flags "--static -bI:/lib/syscalls.exp"
  57.     }
  58.     }
  59.  
  60.     # On Irix 5, linking with --static only works if all the files are
  61.     # compiled using -non_shared.
  62.     if {"$flags" == "--static"} {
  63.     setup_xfail "mips*-*-irix5*"
  64.     }
  65.  
  66.     if ![ld_link $ld tmpdir/ld1 "$flags tmpdir/ld-partial.o $BFDLIB $LIBIBERTY"] {
  67.     fail $testname
  68.     continue
  69.     }
  70.  
  71.     if ![ld_link tmpdir/ld1 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY"] {
  72.     fail $testname
  73.     continue
  74.     }
  75.  
  76.     if ![ld_link tmpdir/ld2 tmpdir/ld3 "$flags $OFILES $BFDLIB $LIBIBERTY"] {
  77.     fail $testname
  78.     continue
  79.     }
  80.  
  81.     send_log "cmp tmpdir/ld2 tmpdir/ld3\n"
  82.     verbose "cmp tmpdir/ld2 tmpdir/ld3"
  83.     catch "exec cmp tmpdir/ld2 tmpdir/ld3" exec_output
  84.     set exec_output [prune_system_crud $host_triplet $exec_output]
  85.  
  86.     if [string match "" $exec_output] then {
  87.     pass $testname
  88.     } else {
  89.     send_log "$exec_output\n"
  90.     verbose "$exec_output" 1
  91.  
  92.     fail $testname
  93.     }
  94. }
  95.