OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.20.1/] [ld/] [testsuite/] [ld-bootstrap/] [bootstrap.exp] - Blame information for rev 337

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

Line No. Rev Author Line
1 205 julius
# Expect script for LD Bootstrap Tests
2
#   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2004,
3
#   2005, 2006, 2007, 2009  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
# Bootstrap ld.  First link the object files together using -r, in
34
# order to test -r.  Then link the result into an executable, ld1, to
35
# really test -r.  Use ld1 to link a fresh ld, ld2.  Use ld2 to link a
36
# new ld, ld3.  ld2 and ld3 should be identical.
37
 
38
foreach flags {"" "strip" "--static" "--traditional-format"
39
               "--no-keep-memory" "--relax"} {
40
    set do_strip "no"
41
    if {"$flags" == "strip"} {
42
        set testname "bootstrap with $flags"
43
        set flags ""
44
        set do_strip "yes"
45
    } else { if {"$flags" != ""} {
46
        set testname "bootstrap with $flags"
47
    } else {
48
        set testname "bootstrap"
49
    }}
50
 
51
    # --static is meaningless and --relax is incompatible with -r.
52
    set partial_flags "$flags"
53
    if { "$flags" == "--static" || "$flags" == "--relax" } {
54
        set partial_flags ""
55
    }
56
 
57
    # This test can only be run if we have the ld build directory,
58
    # since we need the object files.
59
    if {$ld != "$objdir/ld-new"} {
60
        untested $testname
61
        continue
62
    }
63
 
64
    # If we only have a shared libbfd, we probably can't run the
65
    # --static test.
66
    if { $flags == "--static" && ! [string match "*libbfd.a*" $BFDLIB] } then {
67
        untested $testname
68
        continue
69
    }
70
 
71
    if ![ld_relocate $ld tmpdir/ld-partial.o "$partial_flags $OFILES"] {
72
        fail $testname
73
        continue
74
    }
75
 
76
    # On AIX, you need to specify an import list when using --static.
77
    # You only want the import list when creating the final
78
    # executable.
79
    if { [istarget "*-*-aix*"]
80
         && ![istarget "ia64-*-aix*"]} {
81
        if {"$flags" == "--static"} {
82
            set flags "--static -bI:/lib/syscalls.exp"
83
        }
84
    }
85
 
86
    # On Cygwin, -lintl may require -liconv when linking statically.
87
    set extralibs ""
88
    if { [istarget "*-*-cygwin*"]} {
89
        if {"$flags" == "--static"} {
90
            set extralibs "-liconv"
91
        }
92
    }
93
 
94
    # On Irix 5, linking with --static only works if all the files are
95
    # compiled using -non_shared.
96
    if {"$flags" == "--static"} {
97
        setup_xfail "mips*-*-irix5*"
98
    }
99
 
100
    if ![ld_link $ld tmpdir/ld1 "$flags tmpdir/ld-partial.o $BFDLIB $LIBIBERTY $extralibs"] {
101
        fail $testname
102
        continue
103
    }
104
 
105
    if {"$do_strip" == "yes"} {
106
        verbose -log "$strip tmpdir/ld1"
107
        catch "exec $strip tmpdir/ld1" exec_output
108
        if ![string match "" $exec_output] then {
109
            verbose -log "$exec_output"
110
            fail $testname
111
            continue
112
        }
113
    }
114
 
115
    if ![ld_link tmpdir/ld1 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY $extralibs"] {
116
        fail $testname
117
        continue
118
    }
119
 
120
    if ![ld_link tmpdir/ld2 tmpdir/ld3 "$flags $OFILES $BFDLIB $LIBIBERTY $extralibs"] {
121
        fail $testname
122
        continue
123
    }
124
 
125
    if {"$flags" == "--static"} {
126
        if { [istarget ia64-*-elf*]
127
             || [istarget ia64-*-linux*] } {
128
            # On ia64, tmpdir/ld2 != tmpdir/ld3 is normal since they are
129
            # generated by different linkers, tmpdir/ld1 and tmpdir/ld2.
130
            # So we rebuild tmpdir/ld2 with tmpdir/ld3.
131
            if ![ld_link tmpdir/ld3 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY"] {
132
                fail $testname
133
                continue
134
            }
135
        }
136
    } else {
137
        if { [istarget mips*-*-linux*] } {
138
            # On Linux/mips, tmpdir/ld2 != tmpdir/ld3 is normal since
139
            # they are generated by different linkers, tmpdir/ld1 and
140
            # tmpdir/ld2. So we rebuild tmpdir/ld2 with tmpdir/ld3.
141
            if ![ld_link tmpdir/ld3 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY"] {
142
                fail $testname
143
                continue
144
            }
145
        }
146
    }
147
 
148
    if {[istarget "*-*-pe"]
149
        || [istarget "*-*-wince"]
150
        || [istarget "*-*-cygwin*"]
151
        || [istarget "*-*-winnt*"]
152
        || [istarget "*-*-mingw*"]
153
        || [istarget "*-*-interix*"]
154
        || [istarget "*-*-beospe*"]
155
        || [istarget "*-*-netbsdpe*"]} {
156
        # Trim off the date present in PE binaries by only looking
157
        #   at the ends of the files
158
        # Although this works, a way to set the date would be better.
159
        # Removing or zeroing the date stamp in the binary produced by
160
        # the linker is not possible as it is required by the target OS.
161
        set do_compare [string map {16 220 f1 tmpdir/ld2 f2 tmpdir/ld3 tmp-foo1 tmpdir/ld2tail tmp-foo2 tmpdir/ld3tail} $DO_COMPARE]
162
        send_log "$do_compare\n"
163
        verbose  "$do_compare"
164
        catch "exec sh -c [list $do_compare]" exec_output
165
    } else {
166
        send_log "cmp tmpdir/ld2 tmpdir/ld3\n"
167
        verbose  "cmp tmpdir/ld2 tmpdir/ld3"
168
        catch "exec cmp tmpdir/ld2 tmpdir/ld3" exec_output
169
    }
170
    set exec_output [prune_warnings $exec_output]
171
 
172
    if [string match "" $exec_output] then {
173
        pass $testname
174
    } else {
175
        send_log "$exec_output\n"
176
        verbose "$exec_output" 1
177
 
178
        fail $testname
179
    }
180
}
181
 
182
catch "exec rm -f tmpdir/ld-partial.o tmpdir/ld1 tmpdir/ld2 tmpdir/ld3" status
183
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.