]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - binutils/testsuite/config/default.exp
Emit a warning when -z relro is unsupported
[thirdparty/binutils-gdb.git] / binutils / testsuite / config / default.exp
1 # Copyright (C) 1993-2020 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-dejagnu@prep.ai.mit.edu
19
20 # This file was written by Rob Savoye. (rob@cygnus.com)
21
22 load_lib utils-lib.exp
23
24 if ![info exists AS] then {
25 set AS [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
26 }
27 if ![info exists ASFLAGS] then {
28 set ASFLAGS ""
29 }
30
31 if ![info exists LD] then {
32 set LD [findfile $base_dir/../ld/ld-new $base_dir/../ld/ld-new [transform ld]]
33 }
34 if ![info exists LDFLAGS] then {
35 set LDFLAGS ""
36 }
37 if ![info exists NM] then {
38 set NM [findfile $base_dir/nm-new $base_dir/nm-new [transform nm]]
39 }
40 if ![info exists NMFLAGS] then {
41 set NMFLAGS ""
42 }
43 if ![info exists SIZE] then {
44 set SIZE [findfile $base_dir/size]
45 }
46 if ![info exists SIZEFLAGS] then {
47 set SIZEFLAGS ""
48 }
49 if ![info exists OBJDUMP] then {
50 set OBJDUMP [findfile $base_dir/objdump]
51 }
52 if ![info exists OBJDUMPFLAGS] then {
53 set OBJDUMPFLAGS ""
54 }
55 if ![info exists OBJCOPY] then {
56 set OBJCOPY [findfile $base_dir/objcopy]
57 }
58 if ![info exists OBJCOPYFLAGS] then {
59 set OBJCOPYFLAGS ""
60 }
61 if ![info exists AR] then {
62 set AR [findfile $base_dir/ar]
63 }
64 if ![info exists STRINGS] then {
65 set STRINGS [findfile $base_dir/strings]
66 }
67 if ![info exists STRINGSFLAGS] then {
68 set STRINGSFLAGS ""
69 }
70 if ![info exists STRIP] then {
71 set STRIP [findfile $base_dir/strip-new $base_dir/strip-new [transform strip]]
72 }
73 if ![info exists STRIPFLAGS] then {
74 set STRIPFLAGS ""
75 }
76 if ![info exists READELF] then {
77 set READELF [findfile $base_dir/readelf]
78 }
79 if ![info exists READELFFLAGS] then {
80 set READELFFLAGS ""
81 }
82 if ![info exists ELFEDIT] then {
83 set ELFEDIT [findfile $base_dir/elfedit]
84 }
85 if ![info exists ELFEDITFLAGS] then {
86 set ELFEDITFLAGS ""
87 }
88 if ![info exists WINDRES] then {
89 set WINDRES [findfile $base_dir/windres]
90 }
91 if ![info exists DLLTOOL] then {
92 set DLLTOOL [findfile $base_dir/dlltool]
93 }
94 if ![info exists CXXFILT] then {
95 set CXXFILT [findfile $base_dir/cxxfilt]
96 }
97 if ![info exists CXXFILTFLAGS] then {
98 set CXXFILTFLAGS ""
99 }
100
101 if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status}
102
103 # Make a copy from tmpdir/gas/as and tmpdir/gas/ld to the assembler
104 # and linker in the build tree, so that we can use a -B option to gcc
105 # to force it to use the newly built assembler/linker.
106 if {![file isdirectory tmpdir/gas]} {catch "exec mkdir tmpdir/gas" status}
107
108 proc link_or_copy { src dst } {
109 if ![catch "exec ln -sf ../../../$src tmpdir/gas/$dst" status] then {return 0}
110 if ![catch "exec ln -f ../$src tmpdir/gas/$dst" status] then {return 0}
111 catch "exec cp -fpu ../$src tmpdir/gas/$dst" status
112 }
113
114 if {[file isfile gas/as-new[exe_ext]]} then {
115 link_or_copy gas/as-new[exe_ext] as[exe_ext]
116 } else {
117 # For non-Windows hosts there may be an executable
118 # without a .exe suffix, so try copying that instead.
119 link_or_copy gas/as-new as[exe_ext]
120 }
121 # This may not be needed any more...
122 if {[file isfile ld/ld-new[exe_ext]]} then {
123 link_or_copy ld/ld-new[exe_ext] ld[exe_ext]
124 } else {
125 link_or_copy ld/ld-new ld[exe_ext]
126 }
127 if {[file isfile tmpdir/gas/as[exe_ext]]} then {
128 set gcc_gas_flag "-B[pwd]/tmpdir/gas/"
129 set dlltool_gas_flag "-S [pwd]/tmpdir/gas/as[exe_ext]"
130 } else {
131 # Testing an installed toolchain.
132 set gcc_gas_flag ""
133 set dlltool_gas_flag ""
134 }
135
136 #
137 # binutils_run
138 # run a program, returning the output
139 # sets binutils_run_failed if the program does not exist
140 # sets binutils_run_status to the exit status of the program
141 #
142 proc binutils_run { prog progargs } {
143 default_binutils_run $prog $progargs
144 }
145
146 #
147 # binutils_assemble
148 # assemble a file
149 #
150 proc binutils_assemble { source object } {
151 default_binutils_assemble_flags $source $object ""
152 }
153
154 #
155 # binutils_assemble_flags
156 # assemble a file
157 #
158 proc binutils_assemble_flags { source object asflags } {
159 default_binutils_assemble_flags $source $object $asflags
160 }