Add ia64-*-aix* configuration.
[deliverable/binutils-gdb.git] / ld / testsuite / ld-bootstrap / bootstrap.exp
1 # Expect script for LD Bootstrap Tests
2 # Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998 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
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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 {"" "strip" "--static" "--traditional-format" "--no-keep-memory"} {
35 set do_strip "no"
36 if {"$flags" == "strip"} {
37 set testname "bootstrap with $flags"
38 set flags ""
39 set do_strip "yes"
40 } else { if {"$flags" != ""} {
41 set testname "bootstrap with $flags"
42 } else {
43 set testname "bootstrap"
44 }}
45
46 # This test can only be run if we have the ld build directory,
47 # since we need the object files.
48 if {$ld != "$objdir/ld-new"} {
49 untested $testname
50 continue
51 }
52
53 # If we only have a shared libbfd, we probably can't run the
54 # --static test.
55 if { $flags == "--static" && ! [string match "*libbfd.a*" $BFDLIB] } then {
56 untested $testname
57 continue
58 }
59
60 if ![ld_relocate $ld tmpdir/ld-partial.o "$flags $OFILES"] {
61 fail $testname
62 continue
63 }
64
65 # On AIX, you need to specify an import list when using --static.
66 # You only want the import list when creating the final
67 # executable.
68 if { [istarget "*-*-aix*"]
69 && ![istarget "ia64-*-aix*"]} {
70 if {"$flags" == "--static"} {
71 set flags "--static -bI:/lib/syscalls.exp"
72 }
73 }
74
75 # On Irix 5, linking with --static only works if all the files are
76 # compiled using -non_shared.
77 if {"$flags" == "--static"} {
78 setup_xfail "mips*-*-irix5*"
79 }
80
81 if ![ld_link $ld tmpdir/ld1 "$flags tmpdir/ld-partial.o $BFDLIB $LIBIBERTY"] {
82 fail $testname
83 continue
84 }
85
86 if {"$do_strip" == "yes"} {
87 verbose -log "$strip tmpdir/ld1"
88 catch "exec $strip tmpdir/ld1" exec_output
89 if ![string match "" $exec_output] then {
90 verbose -log "$exec_output"
91 fail $testname
92 continue
93 }
94 }
95
96 if ![ld_link tmpdir/ld1 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY"] {
97 fail $testname
98 continue
99 }
100
101 if ![ld_link tmpdir/ld2 tmpdir/ld3 "$flags $OFILES $BFDLIB $LIBIBERTY"] {
102 fail $testname
103 continue
104 }
105
106 if {"$flags" == "--static"} {
107 if { [istarget ia64-*-elf*]
108 || [istarget ia64-*-linux*] } {
109 # On ia64, tmpdir/ld2 != tmpdir/ld3 is normal since they are
110 # generated by different linkers, tmpdir/ld1 and tmpdir/ld2.
111 # So we rebuild tmpdir/ld2 with tmpdir/ld3.
112 if ![ld_link tmpdir/ld3 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY"] {
113 fail $testname
114 continue
115 }
116 }
117 }
118
119 send_log "cmp tmpdir/ld2 tmpdir/ld3\n"
120 verbose "cmp tmpdir/ld2 tmpdir/ld3"
121 catch "exec cmp tmpdir/ld2 tmpdir/ld3" exec_output
122 set exec_output [prune_warnings $exec_output]
123
124 if [string match "" $exec_output] then {
125 pass $testname
126 } else {
127 send_log "$exec_output\n"
128 verbose "$exec_output" 1
129
130 fail $testname
131 }
132 }
This page took 0.033405 seconds and 5 git commands to generate.