OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [ld/] [testsuite/] [ld-bootstrap/] [bootstrap.exp] - Blame information for rev 84

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 36 khays
# Expect script for LD Bootstrap Tests
2
#   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2004,
3
#   2005, 2006, 2007, 2009, 2010  Free Software Foundation, Inc.
4
#
5
# This file is part of the GNU Binutils.
6
#
7
# This program is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20
# MA 02110-1301, USA.
21
#
22
# Written by Jeffrey Wheat (cassidy@cygnus.com)
23
# Rewritten by Ian Lance Taylor (ian@cygnus.com)
24
#
25
 
26
# Make sure that ld can bootstrap itself.
27
 
28
# This test can only be run if ld generates native executables.
29
if ![isnative] {
30
    return
31
}
32
 
33
# Determine if plugin support is present.
34
remote_exec host "$nm --help" "" "/dev/null" "plugin-support"
35
set tmp [file_contents "plugin-support"]
36
regexp ".*\(--plugin\).*\n" $tmp foo plugins
37
if [info exists plugins] then {
38
    set plugins "yes"
39
} else {
40
    set plugins "no"
41
}
42
 
43
# LD can have plugin support even if BFD does not.
44
if [check_plugin_api_available] {
45
    set plugins "yes"
46
}
47
 
48
# Bootstrap ld.  First link the object files together using -r, in
49
# order to test -r.  Then link the result into an executable, ld1, to
50
# really test -r.  Use ld1 to link a fresh ld, ld2.  Use ld2 to link a
51
# new ld, ld3.  ld2 and ld3 should be identical.
52
 
53
foreach flags {"" "strip" "--static" "--traditional-format"
54
               "--no-keep-memory" "--relax"} {
55
    set do_strip "no"
56
    if {"$flags" == "strip"} {
57
        set testname "bootstrap with $flags"
58
        set flags ""
59
        set do_strip "yes"
60
    } else { if {"$flags" != ""} {
61
        set testname "bootstrap with $flags"
62
    } else {
63
        set testname "bootstrap"
64
    }}
65
 
66
    # --static is meaningless and --relax is incompatible with -r.
67
    set partial_flags "$flags"
68
    if { "$flags" == "--static" || "$flags" == "--relax" } {
69
        set partial_flags ""
70
    }
71
 
72
    # This test can only be run if we have the ld build directory,
73
    # since we need the object files.
74
    if {$ld != "$objdir/ld-new"} {
75
        untested $testname
76
        continue
77
    }
78
 
79
    # Plugin support requires linking with a dynamic library which
80
    # means that these tests will fail.
81
    if { $flags == "--static" && $plugins == "yes" } then {
82
        untested $testname
83
        continue
84
    }
85
 
86
    # If we only have a shared libbfd, we probably can't run the
87
    # --static test.
88
    if { $flags == "--static" && ! [string match "*libbfd.a*" $BFDLIB] } then {
89
        untested $testname
90
        continue
91
    }
92
 
93
    if ![ld_relocate $ld tmpdir/ld-partial.o "$partial_flags $OFILES"] {
94
        fail $testname
95
        continue
96
    }
97
 
98
    # On AIX, you need to specify an import list when using --static.
99
    # You only want the import list when creating the final
100
    # executable.
101
    if { [istarget "*-*-aix*"]
102
         && ![istarget "ia64-*-aix*"]} {
103
        if {"$flags" == "--static"} {
104
            set flags "--static -bI:/lib/syscalls.exp"
105
        }
106
    }
107
 
108
    # On Cygwin, -lintl may require -liconv when linking statically.
109
    set extralibs ""
110
    if { [istarget "*-*-cygwin*"]} {
111
        if {"$flags" == "--static"} {
112
            set extralibs "-liconv"
113
        }
114
    }
115
 
116
    # Plugin support requires linking with libdl.
117
    if { $plugins == "yes" } {
118
        set extralibs "$extralibs -ldl"
119
    }
120
 
121
    # On Irix 5, linking with --static only works if all the files are
122
    # compiled using -non_shared.
123
    if {"$flags" == "--static"} {
124
        setup_xfail "mips*-*-irix5*"
125
    }
126
 
127
    if ![ld_link $ld tmpdir/ld1 "$flags tmpdir/ld-partial.o $BFDLIB $LIBIBERTY $extralibs"] {
128
        fail $testname
129
        continue
130
    }
131
 
132
    if {"$do_strip" == "yes"} {
133
        verbose -log "$strip tmpdir/ld1"
134
        catch "exec $strip tmpdir/ld1" exec_output
135
        if ![string match "" $exec_output] then {
136
            verbose -log "$exec_output"
137
            fail $testname
138
            continue
139
        }
140
    }
141
 
142
    if ![ld_link tmpdir/ld1 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY $extralibs"] {
143
        fail $testname
144
        continue
145
    }
146
 
147
    if ![ld_link tmpdir/ld2 tmpdir/ld3 "$flags $OFILES $BFDLIB $LIBIBERTY $extralibs"] {
148
        fail $testname
149
        continue
150
    }
151
 
152
    if {"$flags" == "--static"} {
153
        if { [istarget ia64-*-elf*]
154
             || [istarget ia64-*-linux*] } {
155
            # On ia64, tmpdir/ld2 != tmpdir/ld3 is normal since they are
156
            # generated by different linkers, tmpdir/ld1 and tmpdir/ld2.
157
            # So we rebuild tmpdir/ld2 with tmpdir/ld3.
158
            if ![ld_link tmpdir/ld3 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY"] {
159
                fail $testname
160
                continue
161
            }
162
        }
163
    } else {
164
        if { [istarget mips*-*-linux*] } {
165
            # On Linux/mips, tmpdir/ld2 != tmpdir/ld3 is normal since
166
            # they are generated by different linkers, tmpdir/ld1 and
167
            # tmpdir/ld2. So we rebuild tmpdir/ld2 with tmpdir/ld3.
168
            if ![ld_link tmpdir/ld3 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY"] {
169
                fail $testname
170
                continue
171
            }
172
        }
173
    }
174
 
175
    if {[istarget "*-*-pe"]
176
        || [istarget "*-*-wince"]
177
        || [istarget "*-*-cygwin*"]
178
        || [istarget "*-*-winnt*"]
179
        || [istarget "*-*-mingw*"]
180
        || [istarget "*-*-interix*"]
181
        || [istarget "*-*-beospe*"]
182
        || [istarget "*-*-netbsdpe*"]} {
183
        # Trim off the date present in PE binaries by only looking
184
        #   at the ends of the files
185
        # Although this works, a way to set the date would be better.
186
        # Removing or zeroing the date stamp in the binary produced by
187
        # the linker is not possible as it is required by the target OS.
188
        set do_compare [string map {16 220 f1 tmpdir/ld2 f2 tmpdir/ld3 tmp-foo1 tmpdir/ld2tail tmp-foo2 tmpdir/ld3tail} $DO_COMPARE]
189
        send_log "$do_compare\n"
190
        verbose  "$do_compare"
191
        catch "exec sh -c [list $do_compare]" exec_output
192
    } else {
193
        send_log "cmp tmpdir/ld2 tmpdir/ld3\n"
194
        verbose  "cmp tmpdir/ld2 tmpdir/ld3"
195
        catch "exec cmp tmpdir/ld2 tmpdir/ld3" exec_output
196
    }
197
    set exec_output [prune_warnings $exec_output]
198
 
199
    if [string match "" $exec_output] then {
200
        pass $testname
201
    } else {
202
        send_log "$exec_output\n"
203
        verbose "$exec_output" 1
204
 
205
        fail $testname
206
    }
207
}
208
 
209
catch "exec rm -f tmpdir/ld-partial.o tmpdir/ld1 tmpdir/ld2 tmpdir/ld3" status
210
catch "exec rm -f tmpdir/ld2tail tmpdir/ld3tail" status

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.