1 |
205 |
julius |
# Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2004, 2005, 2007, 2009
|
2 |
|
|
# Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
# This program 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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
17 |
|
|
|
18 |
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
19 |
|
|
# bug-dejagnu@prep.ai.mit.edu
|
20 |
|
|
|
21 |
|
|
# This file was written by Rob Savoye. (rob@cygnus.com)
|
22 |
|
|
|
23 |
|
|
load_lib utils-lib.exp
|
24 |
|
|
|
25 |
|
|
if ![info exists NM] then {
|
26 |
|
|
set NM [findfile $base_dir/nm-new $base_dir/nm-new [transform nm]]
|
27 |
|
|
}
|
28 |
|
|
if ![info exists NMFLAGS] then {
|
29 |
|
|
set NMFLAGS ""
|
30 |
|
|
}
|
31 |
|
|
if ![info exists SIZE] then {
|
32 |
|
|
set SIZE [findfile $base_dir/size]
|
33 |
|
|
}
|
34 |
|
|
if ![info exists SIZEFLAGS] then {
|
35 |
|
|
set SIZEFLAGS ""
|
36 |
|
|
}
|
37 |
|
|
if ![info exists OBJDUMP] then {
|
38 |
|
|
set OBJDUMP [findfile $base_dir/objdump]
|
39 |
|
|
}
|
40 |
|
|
if ![info exists OBJDUMPFLAGS] then {
|
41 |
|
|
set OBJDUMPFLAGS ""
|
42 |
|
|
}
|
43 |
|
|
if ![info exists OBJCOPY] then {
|
44 |
|
|
set OBJCOPY [findfile $base_dir/objcopy]
|
45 |
|
|
}
|
46 |
|
|
if ![info exists OBJCOPYFLAGS] then {
|
47 |
|
|
set OBJCOPYFLAGS ""
|
48 |
|
|
}
|
49 |
|
|
if ![info exists AR] then {
|
50 |
|
|
set AR [findfile $base_dir/ar]
|
51 |
|
|
}
|
52 |
|
|
if ![info exists STRIP] then {
|
53 |
|
|
set STRIP [findfile $base_dir/strip-new $base_dir/strip-new [transform strip]]
|
54 |
|
|
}
|
55 |
|
|
if ![info exists STRIPFLAGS] then {
|
56 |
|
|
set STRIPFLAGS ""
|
57 |
|
|
}
|
58 |
|
|
if ![info exists READELF] then {
|
59 |
|
|
set READELF [findfile $base_dir/readelf]
|
60 |
|
|
}
|
61 |
|
|
if ![info exists READELFFLAGS] then {
|
62 |
|
|
set READELFFLAGS ""
|
63 |
|
|
}
|
64 |
|
|
if ![info exists WINDRES] then {
|
65 |
|
|
set WINDRES [findfile $base_dir/windres]
|
66 |
|
|
}
|
67 |
|
|
if ![info exists DLLTOOL] then {
|
68 |
|
|
set DLLTOOL [findfile $base_dir/dlltool]
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status}
|
72 |
|
|
|
73 |
|
|
# Make a copy from tmpdir/gas/as and tmpdir/gas/ld to the assembler
|
74 |
|
|
# and linker in the build tree, so that we can use a -B option to gcc
|
75 |
|
|
# to force it to use the newly built assembler/linker.
|
76 |
|
|
if {![file isdirectory tmpdir/gas]} {catch "exec mkdir tmpdir/gas" status}
|
77 |
|
|
|
78 |
|
|
proc link_or_copy { src dst } {
|
79 |
|
|
if ![catch "exec ln -sf ../../../$src tmpdir/gas/$dst" status] then {return 0}
|
80 |
|
|
if ![catch "exec ln -f ../$src tmpdir/gas/$dst" status] then {return 0}
|
81 |
|
|
catch "exec cp -fpu ../$src tmpdir/gas/$dst" status
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
if {[file isfile gas/as-new[exe_ext]]} then {
|
85 |
|
|
link_or_copy gas/as-new[exe_ext] as[exe_ext]
|
86 |
|
|
} else {
|
87 |
|
|
# For non-Windows hosts there may be an executable
|
88 |
|
|
# without a .exe suffix, so try copying that instead.
|
89 |
|
|
link_or_copy gas/as-new as[exe_ext]
|
90 |
|
|
}
|
91 |
|
|
# This may not be needed any more...
|
92 |
|
|
if {[file isfile ld/ld-new[exe_ext]]} then {
|
93 |
|
|
link_or_copy ld/ld-new[exe_ext] ld[exe_ext]
|
94 |
|
|
} else {
|
95 |
|
|
link_or_copy ld/ld-new ld[exe_ext]
|
96 |
|
|
}
|
97 |
|
|
if {[file isfile tmpdir/gas/as[exe_ext]]} then {
|
98 |
|
|
set gcc_gas_flag "-B[pwd]/tmpdir/gas/"
|
99 |
|
|
set dlltool_gas_flag "-S [pwd]/tmpdir/gas/as[exe_ext]"
|
100 |
|
|
} else {
|
101 |
|
|
# Testing an installed toolchain.
|
102 |
|
|
set gcc_gas_flag ""
|
103 |
|
|
set dlltool_gas_flag ""
|
104 |
|
|
}
|
105 |
|
|
|
106 |
|
|
#
|
107 |
|
|
# binutils_run
|
108 |
|
|
# run a program, returning the output
|
109 |
|
|
# sets binutils_run_failed if the program does not exist
|
110 |
|
|
#
|
111 |
|
|
proc binutils_run { prog progargs } {
|
112 |
|
|
default_binutils_run $prog $progargs
|
113 |
|
|
}
|
114 |
|
|
|
115 |
|
|
#
|
116 |
|
|
# binutils_assemble
|
117 |
|
|
# assemble a file
|
118 |
|
|
#
|
119 |
|
|
proc binutils_assemble { source object } {
|
120 |
|
|
default_binutils_assemble $source $object
|
121 |
|
|
}
|