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