1 |
12 |
jlechner |
# Copyright (C) 1999, 2001, 2003, 2004, 2005 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 2 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 |
|
|
# gcc-patches@gcc.gnu.org
|
19 |
|
|
|
20 |
|
|
# This file defines procs for determining features supported by the target.
|
21 |
|
|
|
22 |
|
|
# Try to compile some code and return the messages printed by the compiler.
|
23 |
|
|
#
|
24 |
|
|
# BASENAME is a basename to use for temporary files.
|
25 |
|
|
# TYPE is the type of compilation to perform (see target_compile).
|
26 |
|
|
# CONTENTS gives the contents of the input file.
|
27 |
|
|
# The rest is optional:
|
28 |
|
|
# OPTIONS: additional compiler options to use.
|
29 |
|
|
proc get_compiler_messages {basename type contents args} {
|
30 |
|
|
global tool
|
31 |
|
|
|
32 |
|
|
if { [llength $args] > 0 } {
|
33 |
|
|
set options "additional_flags=[lindex $args 0]"
|
34 |
|
|
} else {
|
35 |
|
|
set options ""
|
36 |
|
|
}
|
37 |
|
|
|
38 |
|
|
set src ${basename}[pid].c
|
39 |
|
|
switch $type {
|
40 |
|
|
assembly { set output ${basename}[pid].s }
|
41 |
|
|
object { set output ${basename}[pid].o }
|
42 |
|
|
}
|
43 |
|
|
set f [open $src "w"]
|
44 |
|
|
puts $f $contents
|
45 |
|
|
close $f
|
46 |
|
|
set lines [${tool}_target_compile $src $output $type "$options"]
|
47 |
|
|
file delete $src
|
48 |
|
|
remote_file build delete $output
|
49 |
|
|
|
50 |
|
|
return $lines
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
proc current_target_name { } {
|
54 |
|
|
global target_info
|
55 |
|
|
if [info exists target_info(target,name)] {
|
56 |
|
|
set answer $target_info(target,name)
|
57 |
|
|
} else {
|
58 |
|
|
set answer ""
|
59 |
|
|
}
|
60 |
|
|
return $answer
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
###############################
|
64 |
|
|
# proc check_weak_available { }
|
65 |
|
|
###############################
|
66 |
|
|
|
67 |
|
|
# weak symbols are only supported in some configs/object formats
|
68 |
|
|
# this proc returns 1 if they're supported, 0 if they're not, or -1 if unsure
|
69 |
|
|
|
70 |
|
|
proc check_weak_available { } {
|
71 |
|
|
global target_triplet
|
72 |
|
|
global target_cpu
|
73 |
|
|
|
74 |
|
|
# All mips targets should support it
|
75 |
|
|
|
76 |
|
|
if { [ string first "mips" $target_cpu ] >= 0 } {
|
77 |
|
|
return 1
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
# All solaris2 targets should support it
|
81 |
|
|
|
82 |
|
|
if { [regexp ".*-solaris2.*" $target_triplet] } {
|
83 |
|
|
return 1
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
# DEC OSF/1/Digital UNIX/Tru64 UNIX supports it
|
87 |
|
|
|
88 |
|
|
if { [regexp "alpha.*osf.*" $target_triplet] } {
|
89 |
|
|
return 1
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
# Windows targets Cygwin and MingW32 support it
|
93 |
|
|
|
94 |
|
|
if { [regexp ".*mingw32|.*cygwin" $target_triplet] } {
|
95 |
|
|
return 1
|
96 |
|
|
}
|
97 |
|
|
|
98 |
|
|
# HP-UX 10.X doesn't support it
|
99 |
|
|
|
100 |
|
|
if { [regexp "hppa.*hpux10" $target_triplet] } {
|
101 |
|
|
return 0
|
102 |
|
|
}
|
103 |
|
|
|
104 |
|
|
# ELF and ECOFF support it. a.out does with gas/gld but may also with
|
105 |
|
|
# other linkers, so we should try it
|
106 |
|
|
|
107 |
|
|
set objformat [gcc_target_object_format]
|
108 |
|
|
|
109 |
|
|
switch $objformat {
|
110 |
|
|
elf { return 1 }
|
111 |
|
|
ecoff { return 1 }
|
112 |
|
|
a.out { return 1 }
|
113 |
|
|
mach-o { return 1 }
|
114 |
|
|
som { return 1 }
|
115 |
|
|
unknown { return -1 }
|
116 |
|
|
default { return 0 }
|
117 |
|
|
}
|
118 |
|
|
}
|
119 |
|
|
|
120 |
|
|
###############################
|
121 |
|
|
# proc check_visibility_available { what_kind }
|
122 |
|
|
###############################
|
123 |
|
|
|
124 |
|
|
# The visibility attribute is only support in some object formats
|
125 |
|
|
# This proc returns 1 if it is supported, 0 if not.
|
126 |
|
|
# The argument is the kind of visibility, default/protected/hidden/internal.
|
127 |
|
|
|
128 |
|
|
proc check_visibility_available { what_kind } {
|
129 |
|
|
global visibility_available_saved
|
130 |
|
|
global tool
|
131 |
|
|
global target_triplet
|
132 |
|
|
|
133 |
|
|
# On NetWare, support makes no sense.
|
134 |
|
|
if { [istarget *-*-netware*] } {
|
135 |
|
|
return 0
|
136 |
|
|
}
|
137 |
|
|
|
138 |
|
|
if [string match "" $what_kind] { set what_kind "hidden" }
|
139 |
|
|
|
140 |
|
|
if { [info exists visibility_available_saved] } {
|
141 |
|
|
verbose "Saved result is <$visibility_available_saved>" 1
|
142 |
|
|
if { [ lsearch -exact $visibility_available_saved $what_kind ] != -1 } {
|
143 |
|
|
return 1
|
144 |
|
|
} elseif { [ lsearch -exact $visibility_available_saved "!$what_kind" ] != -1 } {
|
145 |
|
|
return 0
|
146 |
|
|
}
|
147 |
|
|
}
|
148 |
|
|
|
149 |
|
|
set lines [get_compiler_messages visibility object "
|
150 |
|
|
void f() __attribute__((visibility(\"$what_kind\")));
|
151 |
|
|
void f() {}
|
152 |
|
|
"]
|
153 |
|
|
if [string match "" $lines] then {
|
154 |
|
|
set answer 1
|
155 |
|
|
lappend visibility_available_saved $what_kind
|
156 |
|
|
} else {
|
157 |
|
|
set answer 0
|
158 |
|
|
lappend visibility_available_saved "!$what_kind"
|
159 |
|
|
}
|
160 |
|
|
return $answer
|
161 |
|
|
}
|
162 |
|
|
|
163 |
|
|
###############################
|
164 |
|
|
# proc check_alias_available { }
|
165 |
|
|
###############################
|
166 |
|
|
|
167 |
|
|
# Determine if the target toolchain supports the alias attribute.
|
168 |
|
|
|
169 |
|
|
# Returns 2 if the target supports aliases. Returns 1 if the target
|
170 |
|
|
# only supports weak aliased. Returns 0 if the target does not
|
171 |
|
|
# support aliases at all. Returns -1 if support for aliases could not
|
172 |
|
|
# be determined.
|
173 |
|
|
|
174 |
|
|
proc check_alias_available { } {
|
175 |
|
|
global alias_available_saved
|
176 |
|
|
global tool
|
177 |
|
|
|
178 |
|
|
if [info exists alias_available_saved] {
|
179 |
|
|
verbose "check_alias_available returning saved $alias_available_saved" 2
|
180 |
|
|
} else {
|
181 |
|
|
set src alias[pid].c
|
182 |
|
|
set obj alias[pid].o
|
183 |
|
|
verbose "check_alias_available compiling testfile $src" 2
|
184 |
|
|
set f [open $src "w"]
|
185 |
|
|
# Compile a small test program. The definition of "g" is
|
186 |
|
|
# necessary to keep the Solaris assembler from complaining
|
187 |
|
|
# about the program.
|
188 |
|
|
puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
|
189 |
|
|
puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
|
190 |
|
|
close $f
|
191 |
|
|
set lines [${tool}_target_compile $src $obj object ""]
|
192 |
|
|
file delete $src
|
193 |
|
|
remote_file build delete $obj
|
194 |
|
|
|
195 |
|
|
if [string match "" $lines] then {
|
196 |
|
|
# No error messages, everything is OK.
|
197 |
|
|
set alias_available_saved 2
|
198 |
|
|
} else {
|
199 |
|
|
if [regexp "alias definitions not supported" $lines] {
|
200 |
|
|
verbose "check_alias_available target does not support aliases" 2
|
201 |
|
|
|
202 |
|
|
set objformat [gcc_target_object_format]
|
203 |
|
|
|
204 |
|
|
if { $objformat == "elf" } {
|
205 |
|
|
verbose "check_alias_available but target uses ELF format, so it ought to" 2
|
206 |
|
|
set alias_available_saved -1
|
207 |
|
|
} else {
|
208 |
|
|
set alias_available_saved 0
|
209 |
|
|
}
|
210 |
|
|
} else {
|
211 |
|
|
if [regexp "only weak aliases are supported" $lines] {
|
212 |
|
|
verbose "check_alias_available target supports only weak aliases" 2
|
213 |
|
|
set alias_available_saved 1
|
214 |
|
|
} else {
|
215 |
|
|
set alias_available_saved -1
|
216 |
|
|
}
|
217 |
|
|
}
|
218 |
|
|
}
|
219 |
|
|
|
220 |
|
|
verbose "check_alias_available returning $alias_available_saved" 2
|
221 |
|
|
}
|
222 |
|
|
|
223 |
|
|
return $alias_available_saved
|
224 |
|
|
}
|
225 |
|
|
|
226 |
|
|
# Returns true if --gc-sections is supported on the target.
|
227 |
|
|
|
228 |
|
|
proc check_gc_sections_available { } {
|
229 |
|
|
global gc_sections_available_saved
|
230 |
|
|
global tool
|
231 |
|
|
|
232 |
|
|
if {![info exists gc_sections_available_saved]} {
|
233 |
|
|
# Some targets don't support gc-sections despite whatever's
|
234 |
|
|
# advertised by ld's options.
|
235 |
|
|
if { [istarget alpha*-*-*]
|
236 |
|
|
|| [istarget ia64-*-*] } {
|
237 |
|
|
set gc_sections_available_saved 0
|
238 |
|
|
return 0
|
239 |
|
|
}
|
240 |
|
|
|
241 |
|
|
# Check if the ld used by gcc supports --gc-sections.
|
242 |
|
|
set gcc_spec [${tool}_target_compile "-dumpspecs" "" "none" ""]
|
243 |
|
|
regsub ".*\n\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
|
244 |
|
|
set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=$linker" "" "none" ""] 0]
|
245 |
|
|
set ld_output [remote_exec host "$gcc_ld" "--help"]
|
246 |
|
|
if { [ string first "--gc-sections" $ld_output ] >= 0 } {
|
247 |
|
|
set gc_sections_available_saved 1
|
248 |
|
|
} else {
|
249 |
|
|
set gc_sections_available_saved 0
|
250 |
|
|
}
|
251 |
|
|
}
|
252 |
|
|
return $gc_sections_available_saved
|
253 |
|
|
}
|
254 |
|
|
|
255 |
|
|
# Return true if profiling is supported on the target.
|
256 |
|
|
|
257 |
|
|
proc check_profiling_available { test_what } {
|
258 |
|
|
global profiling_available_saved
|
259 |
|
|
|
260 |
|
|
verbose "Profiling argument is <$test_what>" 1
|
261 |
|
|
|
262 |
|
|
# These conditions depend on the argument so examine them before
|
263 |
|
|
# looking at the cache variable.
|
264 |
|
|
|
265 |
|
|
# Support for -p on solaris2 relies on mcrt1.o which comes with the
|
266 |
|
|
# vendor compiler. We cannot reliably predict the directory where the
|
267 |
|
|
# vendor compiler (and thus mcrt1.o) is installed so we can't
|
268 |
|
|
# necessarily find mcrt1.o even if we have it.
|
269 |
|
|
if { [istarget *-*-solaris2*] && [lindex $test_what 1] == "-p" } {
|
270 |
|
|
return 0
|
271 |
|
|
}
|
272 |
|
|
|
273 |
|
|
# Support for -p on irix relies on libprof1.a which doesn't appear to
|
274 |
|
|
# exist on any irix6 system currently posting testsuite results.
|
275 |
|
|
# Support for -pg on irix relies on gcrt1.o which doesn't exist yet.
|
276 |
|
|
# See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html
|
277 |
|
|
if { [istarget mips*-*-irix*]
|
278 |
|
|
&& ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } {
|
279 |
|
|
return 0
|
280 |
|
|
}
|
281 |
|
|
|
282 |
|
|
# At present, there is no profiling support on NetWare.
|
283 |
|
|
if { [istarget *-*-netware*] } {
|
284 |
|
|
return 0
|
285 |
|
|
}
|
286 |
|
|
|
287 |
|
|
# Now examine the cache variable.
|
288 |
|
|
if {![info exists profiling_available_saved]} {
|
289 |
|
|
# Some targets don't have any implementation of __bb_init_func or are
|
290 |
|
|
# missing other needed machinery.
|
291 |
|
|
if { [istarget mmix-*-*]
|
292 |
|
|
|| [istarget arm*-*-eabi*]
|
293 |
|
|
|| [istarget arm*-*-elf]
|
294 |
|
|
|| [istarget arm*-*-symbianelf*]
|
295 |
|
|
|| [istarget powerpc-*-eabi*]
|
296 |
|
|
|| [istarget strongarm*-*-elf]
|
297 |
|
|
|| [istarget xscale*-*-elf]
|
298 |
|
|
|| [istarget cris-*-*]
|
299 |
|
|
|| [istarget h8300-*-*]
|
300 |
|
|
|| [istarget mips*-*-elf]
|
301 |
|
|
|| [istarget xtensa-*-elf]
|
302 |
|
|
|| [istarget *-*-windiss] } {
|
303 |
|
|
set profiling_available_saved 0
|
304 |
|
|
} else {
|
305 |
|
|
set profiling_available_saved 1
|
306 |
|
|
}
|
307 |
|
|
}
|
308 |
|
|
|
309 |
|
|
return $profiling_available_saved
|
310 |
|
|
}
|
311 |
|
|
|
312 |
|
|
# Return 1 if target has packed layout of structure members by
|
313 |
|
|
# default, 0 otherwise. Note that this is slightly different than
|
314 |
|
|
# whether the target has "natural alignment": both attributes may be
|
315 |
|
|
# false.
|
316 |
|
|
|
317 |
|
|
proc check_effective_target_default_packed { } {
|
318 |
|
|
global et_default_packed_saved
|
319 |
|
|
global et_default_packed_target_name
|
320 |
|
|
|
321 |
|
|
if { ![info exists et_default_packed_target_name] } {
|
322 |
|
|
set et_default_packed_target_name ""
|
323 |
|
|
}
|
324 |
|
|
|
325 |
|
|
# If the target has changed since we set the cached value, clear it.
|
326 |
|
|
set current_target [current_target_name]
|
327 |
|
|
if { $current_target != $et_default_packed_target_name } {
|
328 |
|
|
verbose "check_effective_target_default_packed: `$et_default_packed_target_name'" 2
|
329 |
|
|
set et_default_packed_target_name $current_target
|
330 |
|
|
if [info exists et_default_packed_saved] {
|
331 |
|
|
verbose "check_effective_target_default_packed: removing cached result" 2
|
332 |
|
|
unset et_default_packed_saved
|
333 |
|
|
}
|
334 |
|
|
}
|
335 |
|
|
|
336 |
|
|
if [info exists et_default_packed_saved] {
|
337 |
|
|
verbose "check_effective_target_default_packed: using cached result" 2
|
338 |
|
|
} else {
|
339 |
|
|
verbose "check_effective_target_default_packed: compiling source" 2
|
340 |
|
|
|
341 |
|
|
set et_default_packed_saved \
|
342 |
|
|
[string match "" [get_compiler_messages default_packed assembly {
|
343 |
|
|
struct x { char a; long b; } c;
|
344 |
|
|
int s[sizeof (c) == sizeof (char) + sizeof (long) ? 1 : -1];
|
345 |
|
|
} ]]
|
346 |
|
|
|
347 |
|
|
}
|
348 |
|
|
verbose "check_effective_target_default_packed: returning $et_default_packed_saved" 2
|
349 |
|
|
return $et_default_packed_saved
|
350 |
|
|
}
|
351 |
|
|
|
352 |
|
|
# Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
|
353 |
|
|
# documentation, where the test also comes from.
|
354 |
|
|
|
355 |
|
|
proc check_effective_target_pcc_bitfield_type_matters { } {
|
356 |
|
|
global et_pcc_bitfield_type_matters_saved
|
357 |
|
|
global et_pcc_bitfield_type_matters_target_name
|
358 |
|
|
|
359 |
|
|
if { ![info exists et_pcc_bitfield_type_matters_target_name] } {
|
360 |
|
|
set et_pcc_bitfield_type_matters_target_name ""
|
361 |
|
|
}
|
362 |
|
|
|
363 |
|
|
# If the target has changed since we set the cached value, clear it.
|
364 |
|
|
set current_target [current_target_name]
|
365 |
|
|
if { $current_target != $et_pcc_bitfield_type_matters_target_name } {
|
366 |
|
|
verbose "check_effective_target_pcc_bitfield_type_matters: `$et_pcc_bitfield_type_matters_target_name'" 2
|
367 |
|
|
set et_pcc_bitfield_type_matters_target_name $current_target
|
368 |
|
|
if [info exists et_pcc_bitfield_type_matters_saved] {
|
369 |
|
|
verbose "check_effective_target_pcc_bitfield_type_matters: removing cached result" 2
|
370 |
|
|
unset et_pcc_bitfield_type_matters_saved
|
371 |
|
|
}
|
372 |
|
|
}
|
373 |
|
|
|
374 |
|
|
if [info exists et_pcc_bitfield_type_matters_saved] {
|
375 |
|
|
verbose "check_effective_target_pcc_bitfield_type_matters: using cached result" 2
|
376 |
|
|
} else {
|
377 |
|
|
verbose "check_effective_target_pcc_bitfield_type_matters: compiling source" 2
|
378 |
|
|
|
379 |
|
|
# PCC_BITFIELD_TYPE_MATTERS isn't just about unnamed or empty
|
380 |
|
|
# bitfields, but let's stick to the example code from the docs.
|
381 |
|
|
set et_pcc_bitfield_type_matters_saved \
|
382 |
|
|
[string match "" [get_compiler_messages pcc_bitfield_type_matters assembly {
|
383 |
|
|
struct foo1 { char x; char :0; char y; };
|
384 |
|
|
struct foo2 { char x; int :0; char y; };
|
385 |
|
|
int s[sizeof (struct foo1) != sizeof (struct foo2) ? 1 : -1];
|
386 |
|
|
} ]]
|
387 |
|
|
}
|
388 |
|
|
verbose "check_effective_target_pcc_bitfield_type_matters: returning $et_pcc_bitfield_type_matters_saved" 2
|
389 |
|
|
return $et_pcc_bitfield_type_matters_saved
|
390 |
|
|
}
|
391 |
|
|
|
392 |
|
|
# Return 1 if thread local storage (TLS) is supported, 0 otherwise.
|
393 |
|
|
#
|
394 |
|
|
# This won't change for different subtargets so cache the result.
|
395 |
|
|
|
396 |
|
|
proc check_effective_target_tls {} {
|
397 |
|
|
global et_tls_saved
|
398 |
|
|
|
399 |
|
|
if [info exists et_tls_saved] {
|
400 |
|
|
verbose "check_effective_target_tls: using cached result" 2
|
401 |
|
|
} else {
|
402 |
|
|
set et_tls_saved 1
|
403 |
|
|
|
404 |
|
|
set src tls[pid].c
|
405 |
|
|
set asm tls[pid].S
|
406 |
|
|
verbose "check_effective_target_tls: compiling testfile $src" 2
|
407 |
|
|
set f [open $src "w"]
|
408 |
|
|
# Compile a small test program.
|
409 |
|
|
puts $f "__thread int i;\n"
|
410 |
|
|
close $f
|
411 |
|
|
|
412 |
|
|
# Test for thread-local data supported by the platform.
|
413 |
|
|
set comp_output \
|
414 |
|
|
[target_compile $src $asm assembly ""]
|
415 |
|
|
file delete $src
|
416 |
|
|
if { [string match "*not supported*" $comp_output] } {
|
417 |
|
|
set et_tls_saved 0
|
418 |
|
|
}
|
419 |
|
|
remove-build-file $asm
|
420 |
|
|
}
|
421 |
|
|
verbose "check_effective_target_tls: returning $et_tls_saved" 2
|
422 |
|
|
return $et_tls_saved
|
423 |
|
|
}
|
424 |
|
|
|
425 |
|
|
# Return 1 if TLS executables can run correctly, 0 otherwise.
|
426 |
|
|
#
|
427 |
|
|
# This won't change for different subtargets so cache the result.
|
428 |
|
|
|
429 |
|
|
proc check_effective_target_tls_runtime {} {
|
430 |
|
|
global et_tls_runtime_saved
|
431 |
|
|
|
432 |
|
|
if [info exists et_tls_runtime_saved] {
|
433 |
|
|
verbose "check_effective_target_tls_runtime: using cached result" 2
|
434 |
|
|
} else {
|
435 |
|
|
set et_tls_runtime_saved 0
|
436 |
|
|
|
437 |
|
|
set src tls_runtime[pid].c
|
438 |
|
|
set exe tls_runtime[pid].x
|
439 |
|
|
verbose "check_effective_target_tls_runtime: compiling testfile $src" 2
|
440 |
|
|
set f [open $src "w"]
|
441 |
|
|
# Compile a small test program.
|
442 |
|
|
puts $f "__thread int thr = 0;\n"
|
443 |
|
|
puts $f "int main(void)\n {\n return thr;\n}"
|
444 |
|
|
close $f
|
445 |
|
|
|
446 |
|
|
set comp_output \
|
447 |
|
|
[target_compile $src $exe executable ""]
|
448 |
|
|
file delete $src
|
449 |
|
|
|
450 |
|
|
if [string match "" $comp_output] then {
|
451 |
|
|
# No error messages, everything is OK.
|
452 |
|
|
|
453 |
|
|
set result [remote_load target "./$exe" "" ""]
|
454 |
|
|
set status [lindex $result 0]
|
455 |
|
|
remote_file build delete $exe
|
456 |
|
|
|
457 |
|
|
verbose "check_effective_target_tls_runtime status is <$status>" 2
|
458 |
|
|
|
459 |
|
|
if { $status == "pass" } {
|
460 |
|
|
set et_tls_runtime_saved 1
|
461 |
|
|
}
|
462 |
|
|
|
463 |
|
|
verbose "check_effective_target_tls_runtime: returning $et_tls_runtime_saved" 2
|
464 |
|
|
}
|
465 |
|
|
}
|
466 |
|
|
|
467 |
|
|
return $et_tls_runtime_saved
|
468 |
|
|
}
|
469 |
|
|
|
470 |
|
|
# Return 1 if compilation with -freorder-blocks-and-partition is error-free
|
471 |
|
|
# for trivial code, 0 otherwise.
|
472 |
|
|
|
473 |
|
|
proc check_effective_target_freorder {} {
|
474 |
|
|
global et_freorder_saved
|
475 |
|
|
global et_freorder_target_name
|
476 |
|
|
|
477 |
|
|
if { ![info exists et_freorder_target_name] } {
|
478 |
|
|
set et_freorder_target_name ""
|
479 |
|
|
}
|
480 |
|
|
|
481 |
|
|
# If the target has changed since we set the cached value, clear it.
|
482 |
|
|
set current_target [current_target_name]
|
483 |
|
|
if { $current_target != $et_freorder_target_name } {
|
484 |
|
|
verbose "check_effective_target_freorder: `$et_freorder_target_name'" 2
|
485 |
|
|
set et_freorder_target_name $current_target
|
486 |
|
|
if [info exists et_freorder_saved] {
|
487 |
|
|
verbose "check_effective_target_freorder: removing cached result" 2
|
488 |
|
|
unset et_freorder_saved
|
489 |
|
|
}
|
490 |
|
|
}
|
491 |
|
|
|
492 |
|
|
if [info exists et_freorder_saved] {
|
493 |
|
|
verbose "check_effective_target_freorder: using cached result" 2
|
494 |
|
|
} else {
|
495 |
|
|
verbose "check_effective_target_freorder: compiling source" 2
|
496 |
|
|
|
497 |
|
|
set et_freorder_saved [string match "" [get_compiler_messages freorder object {
|
498 |
|
|
void foo (void) { }
|
499 |
|
|
} "-freorder-blocks-and-partition"]]
|
500 |
|
|
}
|
501 |
|
|
verbose "check_effective_target_freorder: returning $et_freorder_saved" 2
|
502 |
|
|
return $et_freorder_saved
|
503 |
|
|
}
|
504 |
|
|
|
505 |
|
|
# Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
|
506 |
|
|
# emitted, 0 otherwise. Whether a shared library can actually be built is
|
507 |
|
|
# out of scope for this test.
|
508 |
|
|
#
|
509 |
|
|
# When the target name changes, replace the cached result.
|
510 |
|
|
|
511 |
|
|
proc check_effective_target_fpic { } {
|
512 |
|
|
global et_fpic_saved
|
513 |
|
|
global et_fpic_target_name
|
514 |
|
|
|
515 |
|
|
if { ![info exists et_fpic_target_name] } {
|
516 |
|
|
set et_fpic_target_name ""
|
517 |
|
|
}
|
518 |
|
|
|
519 |
|
|
# If the target has changed since we set the cached value, clear it.
|
520 |
|
|
set current_target [current_target_name]
|
521 |
|
|
if { $current_target != $et_fpic_target_name } {
|
522 |
|
|
verbose "check_effective_target_fpic: `$et_fpic_target_name'" 2
|
523 |
|
|
set et_fpic_target_name $current_target
|
524 |
|
|
if [info exists et_fpic_saved] {
|
525 |
|
|
verbose "check_effective_target_fpic: removing cached result" 2
|
526 |
|
|
unset et_fpic_saved
|
527 |
|
|
}
|
528 |
|
|
}
|
529 |
|
|
|
530 |
|
|
if [info exists et_fpic_saved] {
|
531 |
|
|
verbose "check_effective_target_fpic: using cached result" 2
|
532 |
|
|
} else {
|
533 |
|
|
verbose "check_effective_target_fpic: compiling source" 2
|
534 |
|
|
|
535 |
|
|
# Note that M68K has a multilib that supports -fpic but not
|
536 |
|
|
# -fPIC, so we need to check both. We test with a program that
|
537 |
|
|
# requires GOT references.
|
538 |
|
|
set et_fpic_saved [string match "" [get_compiler_messages fpic object {
|
539 |
|
|
extern int foo (void); extern int bar;
|
540 |
|
|
int baz (void) { return foo () + bar; }
|
541 |
|
|
} "-fpic"]]
|
542 |
|
|
|
543 |
|
|
if { $et_fpic_saved != 0 } {
|
544 |
|
|
set et_fpic_saved [string match "" [get_compiler_messages fpic object {
|
545 |
|
|
extern int foo (void); extern int bar;
|
546 |
|
|
int baz (void) { return foo () + bar; }
|
547 |
|
|
} "-fPIC"]]
|
548 |
|
|
}
|
549 |
|
|
}
|
550 |
|
|
verbose "check_effective_target_fpic: returning $et_fpic_saved" 2
|
551 |
|
|
return $et_fpic_saved
|
552 |
|
|
}
|
553 |
|
|
|
554 |
|
|
# Return true if iconv is supported on the target. In particular IBM1047.
|
555 |
|
|
|
556 |
|
|
proc check_iconv_available { test_what } {
|
557 |
|
|
global tool
|
558 |
|
|
global libiconv
|
559 |
|
|
|
560 |
|
|
set result ""
|
561 |
|
|
|
562 |
|
|
set src iconv[pid].c
|
563 |
|
|
set exe iconv[pid].x
|
564 |
|
|
verbose "check_iconv_available compiling testfile $src" 2
|
565 |
|
|
set f [open $src "w"]
|
566 |
|
|
# Compile a small test program.
|
567 |
|
|
puts $f "#include \n"
|
568 |
|
|
puts $f "int main (void)\n {\n iconv_t cd; \n"
|
569 |
|
|
puts $f "cd = iconv_open (\"[lindex $test_what 1]\", \"UTF-8\");\n"
|
570 |
|
|
puts $f "if (cd == (iconv_t) -1)\n return 1;\n"
|
571 |
|
|
puts $f "return 0;\n}"
|
572 |
|
|
close $f
|
573 |
|
|
|
574 |
|
|
# If the tool configuration file has not set libiconv, try "-liconv"
|
575 |
|
|
if { ![info exists libiconv] } {
|
576 |
|
|
set libiconv "-liconv"
|
577 |
|
|
}
|
578 |
|
|
set lines [${tool}_target_compile $src $exe executable "libs=$libiconv" ]
|
579 |
|
|
file delete $src
|
580 |
|
|
|
581 |
|
|
if [string match "" $lines] then {
|
582 |
|
|
# No error messages, everything is OK.
|
583 |
|
|
|
584 |
|
|
set result [${tool}_load "./$exe" "" ""]
|
585 |
|
|
set status [lindex $result 0]
|
586 |
|
|
remote_file build delete $exe
|
587 |
|
|
|
588 |
|
|
verbose "check_iconv_available status is <$status>" 2
|
589 |
|
|
|
590 |
|
|
if { $status == "pass" } then {
|
591 |
|
|
return 1
|
592 |
|
|
}
|
593 |
|
|
}
|
594 |
|
|
|
595 |
|
|
return 0
|
596 |
|
|
}
|
597 |
|
|
|
598 |
|
|
# Return true if named sections are supported on this target.
|
599 |
|
|
# This proc does not cache results, because the answer may vary
|
600 |
|
|
# when cycling over subtarget options (e.g. irix o32/n32/n64) in
|
601 |
|
|
# the same test run.
|
602 |
|
|
proc check_named_sections_available { } {
|
603 |
|
|
verbose "check_named_sections_available: compiling source" 2
|
604 |
|
|
set answer [string match "" [get_compiler_messages named object {
|
605 |
|
|
int __attribute__ ((section("whatever"))) foo;
|
606 |
|
|
}]]
|
607 |
|
|
verbose "check_named_sections_available: returning $answer" 2
|
608 |
|
|
return $answer
|
609 |
|
|
}
|
610 |
|
|
|
611 |
|
|
# Return 1 if the target supports Fortran real kinds larger than real(8),
|
612 |
|
|
# 0 otherwise.
|
613 |
|
|
#
|
614 |
|
|
# When the target name changes, replace the cached result.
|
615 |
|
|
|
616 |
|
|
proc check_effective_target_fortran_large_real { } {
|
617 |
|
|
global et_fortran_large_real_saved
|
618 |
|
|
global et_fortran_large_real_target_name
|
619 |
|
|
global tool
|
620 |
|
|
|
621 |
|
|
if { ![info exists et_fortran_large_real_target_name] } {
|
622 |
|
|
set et_fortran_large_real_target_name ""
|
623 |
|
|
}
|
624 |
|
|
|
625 |
|
|
# If the target has changed since we set the cached value, clear it.
|
626 |
|
|
set current_target [current_target_name]
|
627 |
|
|
if { $current_target != $et_fortran_large_real_target_name } {
|
628 |
|
|
verbose "check_effective_target_fortran_large_real: `$et_fortran_large_real_target_name' `$current_target'" 2
|
629 |
|
|
set et_fortran_large_real_target_name $current_target
|
630 |
|
|
if [info exists et_fortran_large_real_saved] {
|
631 |
|
|
verbose "check_effective_target_fortran_large_real: removing cached result" 2
|
632 |
|
|
unset et_fortran_large_real_saved
|
633 |
|
|
}
|
634 |
|
|
}
|
635 |
|
|
|
636 |
|
|
if [info exists et_fortran_large_real_saved] {
|
637 |
|
|
verbose "check_effective_target_fortran_large_real returning saved $et_fortran_large_real_saved" 2
|
638 |
|
|
} else {
|
639 |
|
|
set et_fortran_large_real_saved 0
|
640 |
|
|
|
641 |
|
|
# Set up, compile, and execute a test program using large real
|
642 |
|
|
# kinds. Include the current process ID in the file names to
|
643 |
|
|
# prevent conflicts with invocations for multiple testsuites.
|
644 |
|
|
set src real[pid].f90
|
645 |
|
|
set exe real[pid].x
|
646 |
|
|
|
647 |
|
|
set f [open $src "w"]
|
648 |
|
|
puts $f "integer,parameter :: k = &"
|
649 |
|
|
puts $f " selected_real_kind (precision (0.0_8) + 1)"
|
650 |
|
|
puts $f "real(kind=k) :: x"
|
651 |
|
|
puts $f "x = cos (x);"
|
652 |
|
|
puts $f "end"
|
653 |
|
|
close $f
|
654 |
|
|
|
655 |
|
|
verbose "check_effective_target_fortran_large_real compiling testfile $src" 2
|
656 |
|
|
set lines [${tool}_target_compile $src $exe executable ""]
|
657 |
|
|
file delete $src
|
658 |
|
|
|
659 |
|
|
if [string match "" $lines] then {
|
660 |
|
|
# No error message, compilation succeeded.
|
661 |
|
|
set et_fortran_large_real_saved 1
|
662 |
|
|
}
|
663 |
|
|
}
|
664 |
|
|
|
665 |
|
|
return $et_fortran_large_real_saved
|
666 |
|
|
}
|
667 |
|
|
|
668 |
|
|
# Return 1 if the target supports Fortran integer kinds larger than
|
669 |
|
|
# integer(8), 0 otherwise.
|
670 |
|
|
#
|
671 |
|
|
# When the target name changes, replace the cached result.
|
672 |
|
|
|
673 |
|
|
proc check_effective_target_fortran_large_int { } {
|
674 |
|
|
global et_fortran_large_int_saved
|
675 |
|
|
global et_fortran_large_int_target_name
|
676 |
|
|
global tool
|
677 |
|
|
|
678 |
|
|
if { ![info exists et_fortran_large_int_target_name] } {
|
679 |
|
|
set et_fortran_large_int_target_name ""
|
680 |
|
|
}
|
681 |
|
|
|
682 |
|
|
# If the target has changed since we set the cached value, clear it.
|
683 |
|
|
set current_target [current_target_name]
|
684 |
|
|
if { $current_target != $et_fortran_large_int_target_name } {
|
685 |
|
|
verbose "check_effective_target_fortran_large_int: `$et_fortran_large_int_target_name' `$current_target'" 2
|
686 |
|
|
set et_fortran_large_int_target_name $current_target
|
687 |
|
|
if [info exists et_fortran_large_int_saved] {
|
688 |
|
|
verbose "check_effective_target_fortran_large_int: removing cached result" 2
|
689 |
|
|
unset et_fortran_large_int_saved
|
690 |
|
|
}
|
691 |
|
|
}
|
692 |
|
|
|
693 |
|
|
if [info exists et_fortran_large_int_saved] {
|
694 |
|
|
verbose "check_effective_target_fortran_large_int returning saved $et_fortran_large_int_saved" 2
|
695 |
|
|
} else {
|
696 |
|
|
set et_fortran_large_int_saved 0
|
697 |
|
|
|
698 |
|
|
# Set up, compile, and execute a test program using large integer
|
699 |
|
|
# kinds. Include the current process ID in the file names to
|
700 |
|
|
# prevent conflicts with invocations for multiple testsuites.
|
701 |
|
|
set src int[pid].f90
|
702 |
|
|
set exe int[pid].x
|
703 |
|
|
|
704 |
|
|
set f [open $src "w"]
|
705 |
|
|
puts $f "integer,parameter :: k = &"
|
706 |
|
|
puts $f " selected_int_kind (range (0_8) + 1)"
|
707 |
|
|
puts $f "integer(kind=k) :: i"
|
708 |
|
|
puts $f "end"
|
709 |
|
|
close $f
|
710 |
|
|
|
711 |
|
|
verbose "check_effective_target_fortran_large_int compiling testfile $src" 2
|
712 |
|
|
set lines [${tool}_target_compile $src $exe executable ""]
|
713 |
|
|
file delete $src
|
714 |
|
|
|
715 |
|
|
if [string match "" $lines] then {
|
716 |
|
|
# No error message, compilation succeeded.
|
717 |
|
|
set et_fortran_large_int_saved 1
|
718 |
|
|
}
|
719 |
|
|
}
|
720 |
|
|
|
721 |
|
|
return $et_fortran_large_int_saved
|
722 |
|
|
}
|
723 |
|
|
|
724 |
|
|
# Return 1 if we can statically link libgfortran, 0 otherwise.
|
725 |
|
|
#
|
726 |
|
|
# When the target name changes, replace the cached result.
|
727 |
|
|
|
728 |
|
|
proc check_effective_target_static_libgfortran { } {
|
729 |
|
|
global et_static_libgfortran
|
730 |
|
|
global et_static_libgfortran_target_name
|
731 |
|
|
global tool
|
732 |
|
|
|
733 |
|
|
if { ![info exists et_static_libgfortran_target_name] } {
|
734 |
|
|
set et_static_libgfortran_target_name ""
|
735 |
|
|
}
|
736 |
|
|
|
737 |
|
|
# If the target has changed since we set the cached value, clear it.
|
738 |
|
|
set current_target [current_target_name]
|
739 |
|
|
if { $current_target != $et_static_libgfortran_target_name } {
|
740 |
|
|
verbose "check_effective_target_static_libgfortran: `$et_static_libgfortran_target_name' `$current_target'" 2
|
741 |
|
|
set et_static_libgfortran_target_name $current_target
|
742 |
|
|
if [info exists et_static_libgfortran_saved] {
|
743 |
|
|
verbose "check_effective_target_static_libgfortran: removing cached result" 2
|
744 |
|
|
unset et_static_libgfortran_saved
|
745 |
|
|
}
|
746 |
|
|
}
|
747 |
|
|
|
748 |
|
|
if [info exists et_static_libgfortran_saved] {
|
749 |
|
|
verbose "check_effective_target_static_libgfortran returning saved $et_static_libgfortran_saved" 2
|
750 |
|
|
} else {
|
751 |
|
|
set et_static_libgfortran_saved 0
|
752 |
|
|
|
753 |
|
|
# Set up, compile, and execute a test program using static linking.
|
754 |
|
|
# Include the current process ID in the file names to prevent
|
755 |
|
|
# conflicts with invocations for multiple testsuites.
|
756 |
|
|
set opts "additional_flags=-static"
|
757 |
|
|
set src static[pid].f
|
758 |
|
|
set exe static[pid].x
|
759 |
|
|
|
760 |
|
|
set f [open $src "w"]
|
761 |
|
|
puts $f " print *, 'test'"
|
762 |
|
|
puts $f " end"
|
763 |
|
|
close $f
|
764 |
|
|
|
765 |
|
|
verbose "check_effective_target_static_libgfortran compiling testfile $src" 2
|
766 |
|
|
set lines [${tool}_target_compile $src $exe executable "$opts"]
|
767 |
|
|
file delete $src
|
768 |
|
|
|
769 |
|
|
if [string match "" $lines] then {
|
770 |
|
|
# No error message, compilation succeeded.
|
771 |
|
|
set et_static_libgfortran_saved 1
|
772 |
|
|
}
|
773 |
|
|
}
|
774 |
|
|
|
775 |
|
|
return $et_static_libgfortran_saved
|
776 |
|
|
}
|
777 |
|
|
|
778 |
|
|
# Return 1 if the target supports executing AltiVec instructions, 0
|
779 |
|
|
# otherwise. Cache the result.
|
780 |
|
|
|
781 |
|
|
proc check_vmx_hw_available { } {
|
782 |
|
|
global vmx_hw_available_saved
|
783 |
|
|
global tool
|
784 |
|
|
|
785 |
|
|
if [info exists vmx_hw_available_saved] {
|
786 |
|
|
verbose "check_hw_available returning saved $vmx_hw_available_saved" 2
|
787 |
|
|
} else {
|
788 |
|
|
set vmx_hw_available_saved 0
|
789 |
|
|
|
790 |
|
|
# Some simulators are known to not support VMX instructions.
|
791 |
|
|
if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
|
792 |
|
|
verbose "check_hw_available returning 0" 2
|
793 |
|
|
return $vmx_hw_available_saved
|
794 |
|
|
}
|
795 |
|
|
|
796 |
|
|
# Set up, compile, and execute a test program containing VMX
|
797 |
|
|
# instructions. Include the current process ID in the file
|
798 |
|
|
# names to prevent conflicts with invocations for multiple
|
799 |
|
|
# testsuites.
|
800 |
|
|
set src vmx[pid].c
|
801 |
|
|
set exe vmx[pid].x
|
802 |
|
|
|
803 |
|
|
set f [open $src "w"]
|
804 |
|
|
puts $f "int main() {"
|
805 |
|
|
puts $f "#ifdef __MACH__"
|
806 |
|
|
puts $f " asm volatile (\"vor v0,v0,v0\");"
|
807 |
|
|
puts $f "#else"
|
808 |
|
|
puts $f " asm volatile (\"vor 0,0,0\");"
|
809 |
|
|
puts $f "#endif"
|
810 |
|
|
puts $f " return 0; }"
|
811 |
|
|
close $f
|
812 |
|
|
|
813 |
|
|
# Most targets don't require special flags for this test case, but
|
814 |
|
|
# Darwin does.
|
815 |
|
|
if [istarget *-*-darwin*] {
|
816 |
|
|
set opts "additional_flags=-maltivec"
|
817 |
|
|
} else {
|
818 |
|
|
set opts ""
|
819 |
|
|
}
|
820 |
|
|
|
821 |
|
|
verbose "check_vmx_hw_available compiling testfile $src" 2
|
822 |
|
|
set lines [${tool}_target_compile $src $exe executable "$opts"]
|
823 |
|
|
file delete $src
|
824 |
|
|
|
825 |
|
|
if [string match "" $lines] then {
|
826 |
|
|
# No error message, compilation succeeded.
|
827 |
|
|
set result [${tool}_load "./$exe" "" ""]
|
828 |
|
|
set status [lindex $result 0]
|
829 |
|
|
remote_file build delete $exe
|
830 |
|
|
verbose "check_vmx_hw_available testfile status is <$status>" 2
|
831 |
|
|
|
832 |
|
|
if { $status == "pass" } then {
|
833 |
|
|
set vmx_hw_available_saved 1
|
834 |
|
|
}
|
835 |
|
|
} else {
|
836 |
|
|
verbose "check_vmx_hw_availalble testfile compilation failed" 2
|
837 |
|
|
}
|
838 |
|
|
}
|
839 |
|
|
|
840 |
|
|
return $vmx_hw_available_saved
|
841 |
|
|
}
|
842 |
|
|
|
843 |
|
|
# GCC 3.4.0 for powerpc64-*-linux* included an ABI fix for passing
|
844 |
|
|
# complex float arguments. This affects gfortran tests that call cabsf
|
845 |
|
|
# in libm built by an earlier compiler. Return 1 if libm uses the same
|
846 |
|
|
# argument passing as the compiler under test, 0 otherwise.
|
847 |
|
|
#
|
848 |
|
|
# When the target name changes, replace the cached result.
|
849 |
|
|
|
850 |
|
|
proc check_effective_target_broken_cplxf_arg { } {
|
851 |
|
|
global et_broken_cplxf_arg_saved
|
852 |
|
|
global et_broken_cplxf_arg_target_name
|
853 |
|
|
global tool
|
854 |
|
|
|
855 |
|
|
# Skip the work for targets known not to be affected.
|
856 |
|
|
if { ![istarget powerpc64-*-linux*] } {
|
857 |
|
|
return 0
|
858 |
|
|
} elseif { [is-effective-target ilp32] } {
|
859 |
|
|
return 0
|
860 |
|
|
}
|
861 |
|
|
|
862 |
|
|
if { ![info exists et_broken_cplxf_arg_target_name] } {
|
863 |
|
|
set et_broken_cplxf_arg_target_name ""
|
864 |
|
|
}
|
865 |
|
|
|
866 |
|
|
# If the target has changed since we set the cached value, clear it.
|
867 |
|
|
set current_target [current_target_name]
|
868 |
|
|
if { $current_target != $et_broken_cplxf_arg_target_name } {
|
869 |
|
|
verbose "check_effective_target_broken_cplxf_arg: `$et_broken_cplxf_arg_target_name'" 2
|
870 |
|
|
set et_broken_cplxf_arg_target_name $current_target
|
871 |
|
|
if [info exists et_broken_cplxf_arg_saved] {
|
872 |
|
|
verbose "check_effective_target_broken_cplxf_arg: removing cached result" 2
|
873 |
|
|
unset et_broken_cplxf_arg_saved
|
874 |
|
|
}
|
875 |
|
|
}
|
876 |
|
|
|
877 |
|
|
if [info exists et_broken_cplxf_arg_saved] {
|
878 |
|
|
verbose "check_effective_target_broken_cplxf_arg: using cached result" 2
|
879 |
|
|
} else {
|
880 |
|
|
set et_broken_cplxf_arg_saved 0
|
881 |
|
|
# This is only known to affect one target.
|
882 |
|
|
if { ![istarget powerpc64-*-linux*] || ![is-effective-target lp64] } {
|
883 |
|
|
set et_broken_cplxf_arg_saved 0
|
884 |
|
|
verbose "check_effective_target_broken_cplxf_arg: caching 0" 2
|
885 |
|
|
return $et_broken_cplxf_arg_saved
|
886 |
|
|
}
|
887 |
|
|
|
888 |
|
|
# Set up, compile, and execute a C test program that calls cabsf.
|
889 |
|
|
set src cabsf[pid].c
|
890 |
|
|
set exe cabsf[pid].x
|
891 |
|
|
|
892 |
|
|
set f [open $src "w"]
|
893 |
|
|
puts $f "#include "
|
894 |
|
|
puts $f "extern void abort (void);"
|
895 |
|
|
puts $f "float fabsf (float);"
|
896 |
|
|
puts $f "float cabsf (_Complex float);"
|
897 |
|
|
puts $f "int main ()"
|
898 |
|
|
puts $f "{"
|
899 |
|
|
puts $f " _Complex float cf;"
|
900 |
|
|
puts $f " float f;"
|
901 |
|
|
puts $f " cf = 3 + 4.0fi;"
|
902 |
|
|
puts $f " f = cabsf (cf);"
|
903 |
|
|
puts $f " if (fabsf (f - 5.0) > 0.0001) abort ();"
|
904 |
|
|
puts $f " return 0;"
|
905 |
|
|
puts $f "}"
|
906 |
|
|
close $f
|
907 |
|
|
|
908 |
|
|
set lines [${tool}_target_compile $src $exe executable "-lm"]
|
909 |
|
|
file delete $src
|
910 |
|
|
|
911 |
|
|
if [string match "" $lines] {
|
912 |
|
|
# No error message, compilation succeeded.
|
913 |
|
|
set result [${tool}_load "./$exe" "" ""]
|
914 |
|
|
set status [lindex $result 0]
|
915 |
|
|
remote_file build delete $exe
|
916 |
|
|
|
917 |
|
|
verbose "check_effective_target_broken_cplxf_arg: status is <$status>" 2
|
918 |
|
|
|
919 |
|
|
if { $status != "pass" } {
|
920 |
|
|
set et_broken_cplxf_arg_saved 1
|
921 |
|
|
}
|
922 |
|
|
} else {
|
923 |
|
|
verbose "check_effective_target_broken_cplxf_arg: compilation failed" 2
|
924 |
|
|
}
|
925 |
|
|
}
|
926 |
|
|
return $et_broken_cplxf_arg_saved
|
927 |
|
|
}
|
928 |
|
|
|
929 |
|
|
proc check_alpha_max_hw_available { } {
|
930 |
|
|
global alpha_max_hw_available_saved
|
931 |
|
|
global tool
|
932 |
|
|
|
933 |
|
|
if [info exists alpha_max_hw_available_saved] {
|
934 |
|
|
verbose "check_alpha_max_hw_available returning saved $alpha_max_hw_available_saved" 2
|
935 |
|
|
} else {
|
936 |
|
|
set alpha_max_hw_available_saved 0
|
937 |
|
|
|
938 |
|
|
# Set up, compile, and execute a test program probing bit 8 of the
|
939 |
|
|
# architecture mask, which indicates presence of MAX instructions.
|
940 |
|
|
set src max[pid].c
|
941 |
|
|
set exe max[pid].x
|
942 |
|
|
|
943 |
|
|
set f [open $src "w"]
|
944 |
|
|
puts $f "int main() { return __builtin_alpha_amask(1<<8) != 0; }"
|
945 |
|
|
close $f
|
946 |
|
|
|
947 |
|
|
verbose "check_alpha_max_hw_available compiling testfile $src" 2
|
948 |
|
|
set lines [${tool}_target_compile $src $exe executable ""]
|
949 |
|
|
file delete $src
|
950 |
|
|
|
951 |
|
|
if [string match "" $lines] then {
|
952 |
|
|
# No error message, compilation succeeded.
|
953 |
|
|
set result [${tool}_load "./$exe" "" ""]
|
954 |
|
|
set status [lindex $result 0]
|
955 |
|
|
remote_file build delete $exe
|
956 |
|
|
verbose "check_alpha_max_hw_available testfile status is <$status>" 2
|
957 |
|
|
|
958 |
|
|
if { $status == "pass" } then {
|
959 |
|
|
set alpha_max_hw_available_saved 1
|
960 |
|
|
}
|
961 |
|
|
} else {
|
962 |
|
|
verbose "check_alpha_max_hw_availalble testfile compilation failed" 2
|
963 |
|
|
}
|
964 |
|
|
}
|
965 |
|
|
|
966 |
|
|
return $alpha_max_hw_available_saved
|
967 |
|
|
}
|
968 |
|
|
|
969 |
|
|
# Returns true iff the FUNCTION is available on the target system.
|
970 |
|
|
# (This is essentially a Tcl implementation of Autoconf's
|
971 |
|
|
# AC_CHECK_FUNC.)
|
972 |
|
|
|
973 |
|
|
proc check_function_available { function } {
|
974 |
|
|
set var "${function}_available_saved"
|
975 |
|
|
global $var
|
976 |
|
|
global tool
|
977 |
|
|
|
978 |
|
|
if {![info exists $var]} {
|
979 |
|
|
# Assume it exists.
|
980 |
|
|
set $var 1
|
981 |
|
|
# Check to make sure.
|
982 |
|
|
set src "function[pid].c"
|
983 |
|
|
set exe "function[pid].exe"
|
984 |
|
|
|
985 |
|
|
set f [open $src "w"]
|
986 |
|
|
puts $f "int main () { $function (); }"
|
987 |
|
|
close $f
|
988 |
|
|
|
989 |
|
|
set lines [${tool}_target_compile $src $exe executable ""]
|
990 |
|
|
file delete $src
|
991 |
|
|
file delete $exe
|
992 |
|
|
|
993 |
|
|
if {![string match "" $lines]} then {
|
994 |
|
|
set $var 0
|
995 |
|
|
verbose -log "$function is not available"
|
996 |
|
|
} else {
|
997 |
|
|
verbose -log "$function is available"
|
998 |
|
|
}
|
999 |
|
|
}
|
1000 |
|
|
|
1001 |
|
|
eval return \$$var
|
1002 |
|
|
}
|
1003 |
|
|
|
1004 |
|
|
# Returns true iff "fork" is available on the target system.
|
1005 |
|
|
|
1006 |
|
|
proc check_fork_available {} {
|
1007 |
|
|
return [check_function_available "fork"]
|
1008 |
|
|
}
|
1009 |
|
|
|
1010 |
|
|
# Returns true iff "mkfifo" is available on the target system.
|
1011 |
|
|
|
1012 |
|
|
proc check_mkfifo_available {} {
|
1013 |
|
|
if {[istarget *-*-cygwin*]} {
|
1014 |
|
|
# Cygwin has mkfifo, but support is incomplete.
|
1015 |
|
|
return 0
|
1016 |
|
|
}
|
1017 |
|
|
|
1018 |
|
|
return [check_function_available "mkfifo"]
|
1019 |
|
|
}
|
1020 |
|
|
|
1021 |
|
|
# Return 1 if we're generating 32-bit code using default options, 0
|
1022 |
|
|
# otherwise.
|
1023 |
|
|
#
|
1024 |
|
|
# When the target name changes, replace the cached result.
|
1025 |
|
|
|
1026 |
|
|
proc check_effective_target_ilp32 { } {
|
1027 |
|
|
global et_ilp32_saved
|
1028 |
|
|
global et_ilp32_target_name
|
1029 |
|
|
|
1030 |
|
|
if { ![info exists et_ilp32_target_name] } {
|
1031 |
|
|
set et_ilp32_target_name ""
|
1032 |
|
|
}
|
1033 |
|
|
|
1034 |
|
|
# If the target has changed since we set the cached value, clear it.
|
1035 |
|
|
set current_target [current_target_name]
|
1036 |
|
|
if { $current_target != $et_ilp32_target_name } {
|
1037 |
|
|
verbose "check_effective_target_ilp32: `$et_ilp32_target_name' `$current_target'" 2
|
1038 |
|
|
set et_ilp32_target_name $current_target
|
1039 |
|
|
if { [info exists et_ilp32_saved] } {
|
1040 |
|
|
verbose "check_effective_target_ilp32: removing cached result" 2
|
1041 |
|
|
unset et_ilp32_saved
|
1042 |
|
|
}
|
1043 |
|
|
}
|
1044 |
|
|
|
1045 |
|
|
if [info exists et_ilp32_saved] {
|
1046 |
|
|
verbose "check-effective_target_ilp32: using cached result" 2
|
1047 |
|
|
} else {
|
1048 |
|
|
verbose "check_effective_target_ilp32: compiling source" 2
|
1049 |
|
|
set et_ilp32_saved [string match "" [get_compiler_messages ilp32 object {
|
1050 |
|
|
int dummy[(sizeof (int) == 4 && sizeof (void *) == 4 && sizeof (long) == 4 ) ? 1 : -1];
|
1051 |
|
|
}]]
|
1052 |
|
|
}
|
1053 |
|
|
verbose "check_effective_target_ilp32: returning $et_ilp32_saved" 2
|
1054 |
|
|
return $et_ilp32_saved
|
1055 |
|
|
}
|
1056 |
|
|
|
1057 |
|
|
# Return 1 if we're generating 64-bit code using default options, 0
|
1058 |
|
|
# otherwise.
|
1059 |
|
|
#
|
1060 |
|
|
# When the target name changes, replace the cached result.
|
1061 |
|
|
|
1062 |
|
|
proc check_effective_target_lp64 { } {
|
1063 |
|
|
global et_lp64_saved
|
1064 |
|
|
global et_lp64_target_name
|
1065 |
|
|
|
1066 |
|
|
if { ![info exists et_lp64_target_name] } {
|
1067 |
|
|
set et_lp64_target_name ""
|
1068 |
|
|
}
|
1069 |
|
|
|
1070 |
|
|
# If the target has changed since we set the cached value, clear it.
|
1071 |
|
|
set current_target [current_target_name]
|
1072 |
|
|
if { $current_target != $et_lp64_target_name } {
|
1073 |
|
|
verbose "check_effective_target_lp64: `$et_lp64_target_name' `$current_target'" 2
|
1074 |
|
|
set et_lp64_target_name $current_target
|
1075 |
|
|
if [info exists et_lp64_saved] {
|
1076 |
|
|
verbose "check_effective_target_lp64: removing cached result" 2
|
1077 |
|
|
unset et_lp64_saved
|
1078 |
|
|
}
|
1079 |
|
|
}
|
1080 |
|
|
|
1081 |
|
|
if [info exists et_lp64_saved] {
|
1082 |
|
|
verbose "check_effective_target_lp64: using cached result" 2
|
1083 |
|
|
} else {
|
1084 |
|
|
verbose "check_effective_target_lp64: compiling source" 2
|
1085 |
|
|
set et_lp64_saved [string match "" [get_compiler_messages lp64 object {
|
1086 |
|
|
int dummy[(sizeof (int) == 4 && sizeof (void *) == 8 && sizeof (long) == 8 ) ? 1 : -1];
|
1087 |
|
|
}]]
|
1088 |
|
|
}
|
1089 |
|
|
verbose "check_effective_target_lp64: returning $et_lp64_saved" 2
|
1090 |
|
|
return $et_lp64_saved
|
1091 |
|
|
}
|
1092 |
|
|
|
1093 |
|
|
# Return 1 if the target needs a command line argument to enable a SIMD
|
1094 |
|
|
# instruction set.
|
1095 |
|
|
#
|
1096 |
|
|
# This won't change for different subtargets so cache the result.
|
1097 |
|
|
|
1098 |
|
|
proc check_effective_target_vect_cmdline_needed { } {
|
1099 |
|
|
global et_vect_cmdline_needed_saved
|
1100 |
|
|
|
1101 |
|
|
if [info exists et_vect_cmdline_needed_saved] {
|
1102 |
|
|
verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
|
1103 |
|
|
} else {
|
1104 |
|
|
set et_vect_cmdline_needed_saved 1
|
1105 |
|
|
if { [istarget ia64-*-*]
|
1106 |
|
|
|| [istarget x86_64-*-*] } {
|
1107 |
|
|
set et_vect_cmdline_needed_saved 0
|
1108 |
|
|
}
|
1109 |
|
|
}
|
1110 |
|
|
|
1111 |
|
|
verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
|
1112 |
|
|
return $et_vect_cmdline_needed_saved
|
1113 |
|
|
}
|
1114 |
|
|
|
1115 |
|
|
# Return 1 if the target supports hardware vectors of int, 0 otherwise.
|
1116 |
|
|
#
|
1117 |
|
|
# This won't change for different subtargets so cache the result.
|
1118 |
|
|
|
1119 |
|
|
proc check_effective_target_vect_int { } {
|
1120 |
|
|
global et_vect_int_saved
|
1121 |
|
|
|
1122 |
|
|
if [info exists et_vect_int_saved] {
|
1123 |
|
|
verbose "check_effective_target_vect_int: using cached result" 2
|
1124 |
|
|
} else {
|
1125 |
|
|
set et_vect_int_saved 0
|
1126 |
|
|
if { [istarget i?86-*-*]
|
1127 |
|
|
|| [istarget powerpc*-*-*]
|
1128 |
|
|
|| [istarget x86_64-*-*]
|
1129 |
|
|
|| [istarget sparc*-*-*]
|
1130 |
|
|
|| [istarget alpha*-*-*]
|
1131 |
|
|
|| [istarget ia64-*-*] } {
|
1132 |
|
|
set et_vect_int_saved 1
|
1133 |
|
|
}
|
1134 |
|
|
}
|
1135 |
|
|
|
1136 |
|
|
verbose "check_effective_target_vect_int: returning $et_vect_int_saved" 2
|
1137 |
|
|
return $et_vect_int_saved
|
1138 |
|
|
}
|
1139 |
|
|
|
1140 |
|
|
# Return 1 is this is an arm target using 32-bit instructions
|
1141 |
|
|
proc check_effective_target_arm32 { } {
|
1142 |
|
|
global et_arm32_saved
|
1143 |
|
|
global et_arm32_target_name
|
1144 |
|
|
global compiler_flags
|
1145 |
|
|
|
1146 |
|
|
if { ![info exists et_arm32_target_name] } {
|
1147 |
|
|
set et_arm32_target_name ""
|
1148 |
|
|
}
|
1149 |
|
|
|
1150 |
|
|
# If the target has changed since we set the cached value, clear it.
|
1151 |
|
|
set current_target [current_target_name]
|
1152 |
|
|
if { $current_target != $et_arm32_target_name } {
|
1153 |
|
|
verbose "check_effective_target_arm32: `$et_arm32_target_name' `$current_target'" 2
|
1154 |
|
|
set et_arm32_target_name $current_target
|
1155 |
|
|
if { [info exists et_arm32_saved] } {
|
1156 |
|
|
verbose "check_effective_target_arm32: removing cached result" 2
|
1157 |
|
|
unset et_arm32_saved
|
1158 |
|
|
}
|
1159 |
|
|
}
|
1160 |
|
|
|
1161 |
|
|
if [info exists et_arm32_saved] {
|
1162 |
|
|
verbose "check-effective_target_arm32: using cached result" 2
|
1163 |
|
|
} else {
|
1164 |
|
|
set et_arm32_saved 0
|
1165 |
|
|
if { [istarget arm-*-*]
|
1166 |
|
|
|| [istarget strongarm*-*-*]
|
1167 |
|
|
|| [istarget xscale-*-*] } {
|
1168 |
|
|
if ![string match "*-mthumb *" $compiler_flags] {
|
1169 |
|
|
set et_arm32_saved 1
|
1170 |
|
|
}
|
1171 |
|
|
}
|
1172 |
|
|
}
|
1173 |
|
|
verbose "check_effective_target_arm32: returning $et_arm32_saved" 2
|
1174 |
|
|
return $et_arm32_saved
|
1175 |
|
|
}
|
1176 |
|
|
|
1177 |
|
|
# Return 1 if the target supports hardware vector shift operation.
|
1178 |
|
|
|
1179 |
|
|
proc check_effective_target_vect_shift { } {
|
1180 |
|
|
global et_vect_shift_saved
|
1181 |
|
|
|
1182 |
|
|
if [info exists et_vect_shift_saved] {
|
1183 |
|
|
verbose "check_effective_target_vect_shift: using cached result" 2
|
1184 |
|
|
} else {
|
1185 |
|
|
set et_vect_shift_saved 0
|
1186 |
|
|
if { [istarget powerpc*-*-*]
|
1187 |
|
|
|| [istarget ia64-*-*]
|
1188 |
|
|
|| [istarget i?86-*-*]
|
1189 |
|
|
|| [istarget x86_64-*-*] } {
|
1190 |
|
|
set et_vect_shift_saved 1
|
1191 |
|
|
}
|
1192 |
|
|
}
|
1193 |
|
|
|
1194 |
|
|
verbose "check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
|
1195 |
|
|
return $et_vect_shift_saved
|
1196 |
|
|
}
|
1197 |
|
|
|
1198 |
|
|
# Return 1 if the target supports hardware vectors of long, 0 otherwise.
|
1199 |
|
|
#
|
1200 |
|
|
# This can change for different subtargets so do not cache the result.
|
1201 |
|
|
|
1202 |
|
|
proc check_effective_target_vect_long { } {
|
1203 |
|
|
if { [istarget i?86-*-*]
|
1204 |
|
|
|| ([istarget powerpc*-*-*] && [check_effective_target_ilp32])
|
1205 |
|
|
|| [istarget x86_64-*-*]
|
1206 |
|
|
|| ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
|
1207 |
|
|
set answer 1
|
1208 |
|
|
} else {
|
1209 |
|
|
set answer 0
|
1210 |
|
|
}
|
1211 |
|
|
|
1212 |
|
|
verbose "check_effective_target_vect_long: returning $answer" 2
|
1213 |
|
|
return $answer
|
1214 |
|
|
}
|
1215 |
|
|
|
1216 |
|
|
# Return 1 if the target supports hardware vectors of float, 0 otherwise.
|
1217 |
|
|
#
|
1218 |
|
|
# This won't change for different subtargets so cache the result.
|
1219 |
|
|
|
1220 |
|
|
proc check_effective_target_vect_float { } {
|
1221 |
|
|
global et_vect_float_saved
|
1222 |
|
|
|
1223 |
|
|
if [info exists et_vect_float_saved] {
|
1224 |
|
|
verbose "check_effective_target_vect_float: using cached result" 2
|
1225 |
|
|
} else {
|
1226 |
|
|
set et_vect_float_saved 0
|
1227 |
|
|
if { [istarget i?86-*-*]
|
1228 |
|
|
|| [istarget powerpc*-*-*]
|
1229 |
|
|
|| [istarget mipsisa64*-*-*]
|
1230 |
|
|
|| [istarget x86_64-*-*]
|
1231 |
|
|
|| [istarget ia64-*-*] } {
|
1232 |
|
|
set et_vect_float_saved 1
|
1233 |
|
|
}
|
1234 |
|
|
}
|
1235 |
|
|
|
1236 |
|
|
verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
|
1237 |
|
|
return $et_vect_float_saved
|
1238 |
|
|
}
|
1239 |
|
|
|
1240 |
|
|
# Return 1 if the target supports hardware vectors of double, 0 otherwise.
|
1241 |
|
|
#
|
1242 |
|
|
# This won't change for different subtargets so cache the result.
|
1243 |
|
|
|
1244 |
|
|
proc check_effective_target_vect_double { } {
|
1245 |
|
|
global et_vect_double_saved
|
1246 |
|
|
|
1247 |
|
|
if [info exists et_vect_double_saved] {
|
1248 |
|
|
verbose "check_effective_target_vect_double: using cached result" 2
|
1249 |
|
|
} else {
|
1250 |
|
|
set et_vect_double_saved 0
|
1251 |
|
|
if { [istarget i?86-*-*]
|
1252 |
|
|
|| [istarget x86_64-*-*] } {
|
1253 |
|
|
set et_vect_double_saved 1
|
1254 |
|
|
}
|
1255 |
|
|
}
|
1256 |
|
|
|
1257 |
|
|
verbose "check_effective_target_vect_double: returning $et_vect_double_saved" 2
|
1258 |
|
|
return $et_vect_double_saved
|
1259 |
|
|
}
|
1260 |
|
|
|
1261 |
|
|
# Return 1 if the target plus current options does not support a vector
|
1262 |
|
|
# max instruction on "int", 0 otherwise.
|
1263 |
|
|
#
|
1264 |
|
|
# This won't change for different subtargets so cache the result.
|
1265 |
|
|
|
1266 |
|
|
proc check_effective_target_vect_no_int_max { } {
|
1267 |
|
|
global et_vect_no_int_max_saved
|
1268 |
|
|
|
1269 |
|
|
if [info exists et_vect_no_int_max_saved] {
|
1270 |
|
|
verbose "check_effective_target_vect_no_int_max: using cached result" 2
|
1271 |
|
|
} else {
|
1272 |
|
|
set et_vect_no_int_max_saved 0
|
1273 |
|
|
if { [istarget sparc*-*-*]
|
1274 |
|
|
|| [istarget alpha*-*-*] } {
|
1275 |
|
|
set et_vect_no_int_max_saved 1
|
1276 |
|
|
}
|
1277 |
|
|
}
|
1278 |
|
|
verbose "check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
|
1279 |
|
|
return $et_vect_no_int_max_saved
|
1280 |
|
|
}
|
1281 |
|
|
|
1282 |
|
|
# Return 1 if the target plus current options does not support a vector
|
1283 |
|
|
# add instruction on "int", 0 otherwise.
|
1284 |
|
|
#
|
1285 |
|
|
# This won't change for different subtargets so cache the result.
|
1286 |
|
|
|
1287 |
|
|
proc check_effective_target_vect_no_int_add { } {
|
1288 |
|
|
global et_vect_no_int_add_saved
|
1289 |
|
|
|
1290 |
|
|
if [info exists et_vect_no_int_add_saved] {
|
1291 |
|
|
verbose "check_effective_target_vect_no_int_add: using cached result" 2
|
1292 |
|
|
} else {
|
1293 |
|
|
set et_vect_no_int_add_saved 0
|
1294 |
|
|
# Alpha only supports vector add on V8QI and V4HI.
|
1295 |
|
|
if { [istarget alpha*-*-*] } {
|
1296 |
|
|
set et_vect_no_int_add_saved 1
|
1297 |
|
|
}
|
1298 |
|
|
}
|
1299 |
|
|
verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
|
1300 |
|
|
return $et_vect_no_int_add_saved
|
1301 |
|
|
}
|
1302 |
|
|
|
1303 |
|
|
# Return 1 if the target plus current options does not support vector
|
1304 |
|
|
# bitwise instructions, 0 otherwise.
|
1305 |
|
|
#
|
1306 |
|
|
# This won't change for different subtargets so cache the result.
|
1307 |
|
|
|
1308 |
|
|
proc check_effective_target_vect_no_bitwise { } {
|
1309 |
|
|
global et_vect_no_bitwise_saved
|
1310 |
|
|
|
1311 |
|
|
if [info exists et_vect_no_bitwise_saved] {
|
1312 |
|
|
verbose "check_effective_target_vect_no_bitwise: using cached result" 2
|
1313 |
|
|
} else {
|
1314 |
|
|
set et_vect_no_bitwise_saved 0
|
1315 |
|
|
}
|
1316 |
|
|
verbose "check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
|
1317 |
|
|
return $et_vect_no_bitwise_saved
|
1318 |
|
|
}
|
1319 |
|
|
|
1320 |
|
|
# Return 1 if the target plus current options does not support a vector
|
1321 |
|
|
# alignment mechanism, 0 otherwise.
|
1322 |
|
|
#
|
1323 |
|
|
# This won't change for different subtargets so cache the result.
|
1324 |
|
|
|
1325 |
|
|
proc check_effective_target_vect_no_align { } {
|
1326 |
|
|
global et_vect_no_align_saved
|
1327 |
|
|
|
1328 |
|
|
if [info exists et_vect_no_align_saved] {
|
1329 |
|
|
verbose "check_effective_target_vect_no_align: using cached result" 2
|
1330 |
|
|
} else {
|
1331 |
|
|
set et_vect_no_align_saved 0
|
1332 |
|
|
if { [istarget mipsisa64*-*-*]
|
1333 |
|
|
|| [istarget sparc*-*-*]
|
1334 |
|
|
|| [istarget ia64-*-*] } {
|
1335 |
|
|
set et_vect_no_align_saved 1
|
1336 |
|
|
}
|
1337 |
|
|
}
|
1338 |
|
|
verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
|
1339 |
|
|
return $et_vect_no_align_saved
|
1340 |
|
|
}
|
1341 |
|
|
|
1342 |
|
|
# Return 1 if the target supports vector conditional operations, 0 otherwise.
|
1343 |
|
|
|
1344 |
|
|
proc check_effective_target_vect_condition { } {
|
1345 |
|
|
global et_vect_cond_saved
|
1346 |
|
|
|
1347 |
|
|
if [info exists et_vect_cond_saved] {
|
1348 |
|
|
verbose "check_effective_target_vect_cond: using cached result" 2
|
1349 |
|
|
} else {
|
1350 |
|
|
set et_vect_cond_saved 0
|
1351 |
|
|
if { [istarget powerpc*-*-*]
|
1352 |
|
|
|| [istarget ia64-*-*]
|
1353 |
|
|
|| [istarget i?86-*-*]
|
1354 |
|
|
|| [istarget x86_64-*-*] } {
|
1355 |
|
|
set et_vect_cond_saved 1
|
1356 |
|
|
}
|
1357 |
|
|
}
|
1358 |
|
|
|
1359 |
|
|
verbose "check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
|
1360 |
|
|
return $et_vect_cond_saved
|
1361 |
|
|
}
|
1362 |
|
|
|
1363 |
|
|
# Return 1 if the target supports vector int multiplication, 0 otherwise.
|
1364 |
|
|
|
1365 |
|
|
proc check_effective_target_vect_int_mult { } {
|
1366 |
|
|
global et_vect_int_mult_saved
|
1367 |
|
|
|
1368 |
|
|
if [info exists et_vect_int_mult_saved] {
|
1369 |
|
|
verbose "check_effective_target_vect_int_mult: using cached result" 2
|
1370 |
|
|
} else {
|
1371 |
|
|
set et_vect_int_mult_saved 0
|
1372 |
|
|
if { [istarget powerpc*-*-*]
|
1373 |
|
|
|| [istarget i?86-*-*]
|
1374 |
|
|
|| [istarget x86_64-*-*] } {
|
1375 |
|
|
set et_vect_int_mult_saved 1
|
1376 |
|
|
}
|
1377 |
|
|
}
|
1378 |
|
|
|
1379 |
|
|
verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
|
1380 |
|
|
return $et_vect_int_mult_saved
|
1381 |
|
|
}
|
1382 |
|
|
|
1383 |
|
|
# Return 1 if the target supports atomic operations on "int" and "long".
|
1384 |
|
|
|
1385 |
|
|
proc check_effective_target_sync_int_long { } {
|
1386 |
|
|
global et_sync_int_long_saved
|
1387 |
|
|
|
1388 |
|
|
if [info exists et_sync_int_long_saved] {
|
1389 |
|
|
verbose "check_effective_target_sync_int_long: using cached result" 2
|
1390 |
|
|
} else {
|
1391 |
|
|
set et_sync_int_long_saved 0
|
1392 |
|
|
# This is intentionally powerpc but not rs6000, rs6000 doesn't have the
|
1393 |
|
|
# load-reserved/store-conditional instructions.
|
1394 |
|
|
if { [istarget ia64-*-*]
|
1395 |
|
|
|| [istarget i?86-*-*]
|
1396 |
|
|
|| [istarget x86_64-*-*]
|
1397 |
|
|
|| [istarget alpha*-*-*]
|
1398 |
|
|
|| [istarget s390*-*-*]
|
1399 |
|
|
|| [istarget powerpc*-*-*] } {
|
1400 |
|
|
set et_sync_int_long_saved 1
|
1401 |
|
|
}
|
1402 |
|
|
}
|
1403 |
|
|
|
1404 |
|
|
verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
|
1405 |
|
|
return $et_sync_int_long_saved
|
1406 |
|
|
}
|
1407 |
|
|
|
1408 |
|
|
# Return 1 if the target supports atomic operations on "char" and "short".
|
1409 |
|
|
|
1410 |
|
|
proc check_effective_target_sync_char_short { } {
|
1411 |
|
|
global et_sync_char_short_saved
|
1412 |
|
|
|
1413 |
|
|
if [info exists et_sync_char_short_saved] {
|
1414 |
|
|
verbose "check_effective_target_sync_char_short: using cached result" 2
|
1415 |
|
|
} else {
|
1416 |
|
|
set et_sync_char_short_saved 0
|
1417 |
|
|
# This is intentionally powerpc but not rs6000, rs6000 doesn't have the
|
1418 |
|
|
# load-reserved/store-conditional instructions.
|
1419 |
|
|
if { [istarget ia64-*-*]
|
1420 |
|
|
|| [istarget i?86-*-*]
|
1421 |
|
|
|| [istarget x86_64-*-*]
|
1422 |
|
|
|| [istarget alpha*-*-*]
|
1423 |
|
|
|| [istarget s390*-*-*]
|
1424 |
|
|
|| [istarget powerpc*-*-*] } {
|
1425 |
|
|
set et_sync_char_short_saved 1
|
1426 |
|
|
}
|
1427 |
|
|
}
|
1428 |
|
|
|
1429 |
|
|
verbose "check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
|
1430 |
|
|
return $et_sync_char_short_saved
|
1431 |
|
|
}
|
1432 |
|
|
|
1433 |
|
|
# Return 1 if the target matches the effective target 'arg', 0 otherwise.
|
1434 |
|
|
# This can be used with any check_* proc that takes no argument and
|
1435 |
|
|
# returns only 1 or 0. It could be used with check_* procs that take
|
1436 |
|
|
# arguments with keywords that pass particular arguments.
|
1437 |
|
|
|
1438 |
|
|
proc is-effective-target { arg } {
|
1439 |
|
|
set selected 0
|
1440 |
|
|
if { [info procs check_effective_target_${arg}] != [list] } {
|
1441 |
|
|
set selected [check_effective_target_${arg}]
|
1442 |
|
|
} else {
|
1443 |
|
|
switch $arg {
|
1444 |
|
|
"vmx_hw" { set selected [check_vmx_hw_available] }
|
1445 |
|
|
"named_sections" { set selected [check_named_sections_available] }
|
1446 |
|
|
"gc_sections" { set selected [check_gc_sections_available] }
|
1447 |
|
|
default { error "unknown effective target keyword `$arg'" }
|
1448 |
|
|
}
|
1449 |
|
|
}
|
1450 |
|
|
verbose "is-effective-target: $arg $selected" 2
|
1451 |
|
|
return $selected
|
1452 |
|
|
}
|
1453 |
|
|
|
1454 |
|
|
# Return 1 if the argument is an effective-target keyword, 0 otherwise.
|
1455 |
|
|
|
1456 |
|
|
proc is-effective-target-keyword { arg } {
|
1457 |
|
|
if { [info procs check_effective_target_${arg}] != [list] } {
|
1458 |
|
|
return 1
|
1459 |
|
|
} else {
|
1460 |
|
|
# These have different names for their check_* procs.
|
1461 |
|
|
switch $arg {
|
1462 |
|
|
"vmx_hw" { return 1 }
|
1463 |
|
|
"named_sections" { return 1 }
|
1464 |
|
|
"gc_sections" { return 1 }
|
1465 |
|
|
default { return 0 }
|
1466 |
|
|
}
|
1467 |
|
|
}
|
1468 |
|
|
}
|
1469 |
|
|
|
1470 |
|
|
# Return 1 if target default to short enums
|
1471 |
|
|
|
1472 |
|
|
proc check_effective_target_short_enums { } {
|
1473 |
|
|
global et_short_enums_saved
|
1474 |
|
|
global et_short_enums_target_name
|
1475 |
|
|
|
1476 |
|
|
if { ![info exists et_short_enums_target_name] } {
|
1477 |
|
|
set et_short_enums_target_name ""
|
1478 |
|
|
}
|
1479 |
|
|
|
1480 |
|
|
# If the target has changed since we set the cached value, clear it.
|
1481 |
|
|
set current_target [current_target_name]
|
1482 |
|
|
if { $current_target != $et_short_enums_target_name } {
|
1483 |
|
|
verbose "check_effective_target_short_enums: `$et_short_enums_target_name'" 2
|
1484 |
|
|
set et_short_enums_target_name $current_target
|
1485 |
|
|
if [info exists et_short_enums_saved] {
|
1486 |
|
|
verbose "check_effective_target_short_enums: removing cached result" 2
|
1487 |
|
|
unset et_short_enums_saved
|
1488 |
|
|
}
|
1489 |
|
|
}
|
1490 |
|
|
|
1491 |
|
|
if [info exists et_short_enums_saved] {
|
1492 |
|
|
verbose "check_effective_target_short_enums: using cached result" 2
|
1493 |
|
|
} else {
|
1494 |
|
|
verbose "check_effective_target_short_enums: compiling source" 2
|
1495 |
|
|
|
1496 |
|
|
# PCC_BITFIELD_TYPE_MATTERS isn't just about unnamed or empty
|
1497 |
|
|
# bitfields, but let's stick to the example code from the docs.
|
1498 |
|
|
set et_short_enums_saved \
|
1499 |
|
|
[string match "" [get_compiler_messages short_enums assembly {
|
1500 |
|
|
enum foo { bar };
|
1501 |
|
|
int s[sizeof (enum foo) == 1 ? 1 : -1];
|
1502 |
|
|
} ]]
|
1503 |
|
|
}
|
1504 |
|
|
verbose "check_effective_target_short_enums: returning $et_short_enums_saved" 2
|
1505 |
|
|
return $et_short_enums_saved
|
1506 |
|
|
}
|
1507 |
|
|
|