]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/lib/target-supports.exp
vlad.exp: Remove trailing semicolons.
[gcc.git] / gcc / testsuite / lib / target-supports.exp
1 # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 proc get_compiler_messages {basename type contents} {
28 global tool
29
30 set src ${basename}[pid].c
31 switch $type {
32 assembly { set output ${basename}[pid].s }
33 object { set output ${basename}[pid].o }
34 }
35 set f [open $src "w"]
36 puts $f $contents
37 close $f
38 set lines [${tool}_target_compile $src $output $type ""]
39 file delete $src
40 remote_file build delete $output
41
42 return $lines
43 }
44
45 proc current_target_name { } {
46 global target_info
47 if [info exists target_info(target,name)] {
48 set answer $target_info(target,name)
49 } else {
50 set answer ""
51 }
52 return $answer
53 }
54
55 ###############################
56 # proc check_weak_available { }
57 ###############################
58
59 # weak symbols are only supported in some configs/object formats
60 # this proc returns 1 if they're supported, 0 if they're not, or -1 if unsure
61
62 proc check_weak_available { } {
63 global target_triplet
64 global target_cpu
65
66 # All mips targets should support it
67
68 if { [ string first "mips" $target_cpu ] >= 0 } {
69 return 1
70 }
71
72 # All solaris2 targets should support it
73
74 if { [regexp ".*-solaris2.*" $target_triplet] } {
75 return 1
76 }
77
78 # DEC OSF/1/Digital UNIX/Tru64 UNIX supports it
79
80 if { [regexp "alpha.*osf.*" $target_triplet] } {
81 return 1
82 }
83
84 # Windows targets Cygwin and MingW32 support it
85
86 if { [regexp ".*mingw32|.*cygwin" $target_triplet] } {
87 return 1
88 }
89
90 # HP-UX 10.X doesn't support it
91
92 if { [regexp "hppa.*hpux10" $target_triplet] } {
93 return 0
94 }
95
96 # ELF and ECOFF support it. a.out does with gas/gld but may also with
97 # other linkers, so we should try it
98
99 set objformat [gcc_target_object_format]
100
101 switch $objformat {
102 elf { return 1 }
103 ecoff { return 1 }
104 a.out { return 1 }
105 mach-o { return 1 }
106 som { return 1 }
107 unknown { return -1 }
108 default { return 0 }
109 }
110 }
111
112 ###############################
113 # proc check_visibility_available { }
114 ###############################
115
116 # The visibility attribute is only support in some object formats
117 # This proc returns 1 if it is supported, 0 if not.
118
119 proc check_visibility_available { } {
120 global visibility_available_saved
121 global tool
122 global target_triplet
123
124 # On NetWare, support makes no sense.
125 if { [string match "*-*-netware*" $target_triplet] } {
126 return 0
127 }
128
129 if {![info exists visibility_available_saved] } {
130 set lines [get_compiler_messages visibility object {
131 void f() __attribute__((visibility("hidden")));
132 void f() {}
133 }]
134 if [string match "" $lines] then {
135 set visibility_available_saved 1
136 } else {
137 set visibility_available_saved 0
138 }
139 }
140 return $visibility_available_saved
141 }
142
143 ###############################
144 # proc check_alias_available { }
145 ###############################
146
147 # Determine if the target toolchain supports the alias attribute.
148
149 # Returns 2 if the target supports aliases. Returns 1 if the target
150 # only supports weak aliased. Returns 0 if the target does not
151 # support aliases at all. Returns -1 if support for aliases could not
152 # be determined.
153
154 proc check_alias_available { } {
155 global alias_available_saved
156 global tool
157
158 if [info exists alias_available_saved] {
159 verbose "check_alias_available returning saved $alias_available_saved" 2
160 } else {
161 set src alias[pid].c
162 set obj alias[pid].o
163 verbose "check_alias_available compiling testfile $src" 2
164 set f [open $src "w"]
165 # Compile a small test program. The definition of "g" is
166 # necessary to keep the Solaris assembler from complaining
167 # about the program.
168 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
169 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
170 close $f
171 set lines [${tool}_target_compile $src $obj object ""]
172 file delete $src
173 remote_file build delete $obj
174
175 if [string match "" $lines] then {
176 # No error messages, everything is OK.
177 set alias_available_saved 2
178 } else {
179 if [regexp "alias definitions not supported" $lines] {
180 verbose "check_alias_available target does not support aliases" 2
181
182 set objformat [gcc_target_object_format]
183
184 if { $objformat == "elf" } {
185 verbose "check_alias_available but target uses ELF format, so it ought to" 2
186 set alias_available_saved -1
187 } else {
188 set alias_available_saved 0
189 }
190 } else {
191 if [regexp "only weak aliases are supported" $lines] {
192 verbose "check_alias_available target supports only weak aliases" 2
193 set alias_available_saved 1
194 } else {
195 set alias_available_saved -1
196 }
197 }
198 }
199
200 verbose "check_alias_available returning $alias_available_saved" 2
201 }
202
203 return $alias_available_saved
204 }
205
206 # Returns true if --gc-sections is supported on the target.
207
208 proc check_gc_sections_available { } {
209 global gc_sections_available_saved
210 global tool
211
212 if {![info exists gc_sections_available_saved]} {
213 # Some targets don't support gc-sections despite whatever's
214 # advertised by ld's options.
215 if { [istarget alpha*-*-*]
216 || [istarget ia64-*-*] } {
217 set gc_sections_available_saved 0
218 return 0
219 }
220
221 # Check if the ld used by gcc supports --gc-sections.
222 set gcc_spec [${tool}_target_compile "-dumpspecs" "" "none" ""]
223 regsub ".*\n\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
224 set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=$linker" "" "none" ""] 0]
225 set ld_output [remote_exec host "$gcc_ld" "--help"]
226 if { [ string first "--gc-sections" $ld_output ] >= 0 } {
227 set gc_sections_available_saved 1
228 } else {
229 set gc_sections_available_saved 0
230 }
231 }
232 return $gc_sections_available_saved
233 }
234
235 # Return true if profiling is supported on the target.
236
237 proc check_profiling_available { test_what } {
238 global profiling_available_saved
239
240 verbose "Profiling argument is <$test_what>" 1
241
242 # These conditions depend on the argument so examine them before
243 # looking at the cache variable.
244
245 # Support for -p on solaris2 relies on mcrt1.o which comes with the
246 # vendor compiler. We cannot reliably predict the directory where the
247 # vendor compiler (and thus mcrt1.o) is installed so we can't
248 # necessarily find mcrt1.o even if we have it.
249 if { [istarget *-*-solaris2*] && [lindex $test_what 1] == "-p" } {
250 return 0
251 }
252
253 # Support for -p on irix relies on libprof1.a which doesn't appear to
254 # exist on any irix6 system currently posting testsuite results.
255 # Support for -pg on irix relies on gcrt1.o which doesn't exist yet.
256 # See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html
257 if { [istarget mips*-*-irix*]
258 && ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } {
259 return 0
260 }
261
262 # Now examine the cache variable.
263 if {![info exists profiling_available_saved]} {
264 # Some targets don't have any implementation of __bb_init_func or are
265 # missing other needed machinery.
266 if { [istarget mmix-*-*]
267 || [istarget arm*-*-eabi*]
268 || [istarget arm*-*-elf]
269 || [istarget arm*-*-symbianelf*]
270 || [istarget powerpc-*-eabi*]
271 || [istarget strongarm*-*-elf]
272 || [istarget xscale*-*-elf]
273 || [istarget cris-*-*]
274 || [istarget h8300-*-*]
275 || [istarget mips*-*-elf]
276 || [istarget *-*-windiss] } {
277 set profiling_available_saved 0
278 } else {
279 set profiling_available_saved 1
280 }
281 }
282
283 return $profiling_available_saved
284 }
285
286 # Return true if iconv is supported on the target. In particular IBM1047.
287
288 proc check_iconv_available { test_what } {
289 global tool
290 global libiconv
291
292 set result ""
293
294 set src iconv[pid].c
295 set exe iconv[pid].x
296 verbose "check_iconv_available compiling testfile $src" 2
297 set f [open $src "w"]
298 # Compile a small test program.
299 puts $f "#include <iconv.h>\n"
300 puts $f "int main (void)\n {\n iconv_t cd; \n"
301 puts $f "cd = iconv_open (\"[lindex $test_what 1]\", \"UTF-8\");\n"
302 puts $f "if (cd == (iconv_t) -1)\n return 1;\n"
303 puts $f "return 0;\n}"
304 close $f
305
306 set lines [${tool}_target_compile $src $exe executable "libs=$libiconv" ]
307 file delete $src
308
309 if [string match "" $lines] then {
310 # No error messages, everything is OK.
311
312 set result [${tool}_load "./$exe" "" ""]
313 set status [lindex $result 0]
314 remote_file build delete $exe
315
316 verbose "check_iconv_available status is <$status>" 2
317
318 if { $status == "pass" } then {
319 return 1
320 }
321 }
322
323 return 0
324 }
325
326 # Return true if named sections are supported on this target.
327 # This proc does not cache results, because the answer may vary
328 # when cycling over subtarget options (e.g. irix o32/n32/n64) in
329 # the same test run.
330 proc check_named_sections_available { } {
331 verbose "check_named_sections_available: compiling source" 2
332 set answer [string match "" [get_compiler_messages named object {
333 int __attribute__ ((section("whatever"))) foo;
334 }]]
335 verbose "check_named_sections_available: returning $answer" 2
336 return $answer
337 }
338
339 # Return 1 if the target supports executing AltiVec instructions, 0
340 # otherwise. Cache the result.
341
342 proc check_vmx_hw_available { } {
343 global vmx_hw_available_saved
344 global tool
345
346 if [info exists vmx_hw_available_saved] {
347 verbose "check_hw_available returning saved $vmx_hw_available_saved" 2
348 } else {
349 set vmx_hw_available_saved 0
350
351 # Some simulators are known to not support VMX instructions.
352 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
353 verbose "check_hw_available returning 0" 2
354 return $vmx_hw_available_saved
355 }
356
357 # Set up, compile, and execute a test program containing VMX
358 # instructions. Include the current process ID in the file
359 # names to prevent conflicts with invocations for multiple
360 # testsuites.
361 set src vmx[pid].c
362 set exe vmx[pid].x
363
364 set f [open $src "w"]
365 puts $f "int main() {"
366 puts $f "#ifdef __MACH__"
367 puts $f " asm volatile (\"vor v0,v0,v0\");"
368 puts $f "#else"
369 puts $f " asm volatile (\"vor 0,0,0\");"
370 puts $f "#endif"
371 puts $f " return 0; }"
372 close $f
373
374 verbose "check_vmx_hw_available compiling testfile $src" 2
375 set lines [${tool}_target_compile $src $exe executable ""]
376 file delete $src
377
378 if [string match "" $lines] then {
379 # No error message, compilation succeeded.
380 set result [${tool}_load "./$exe" "" ""]
381 set status [lindex $result 0]
382 remote_file build delete $exe
383 verbose "check_vmx_hw_available testfile status is <$status>" 2
384
385 if { $status == "pass" } then {
386 set vmx_hw_available_saved 1
387 }
388 } else {
389 verbose "check_vmx_hw_availalble testfile compilation failed" 2
390 }
391 }
392
393 return $vmx_hw_available_saved
394 }
395
396 # GCC 3.4.0 for powerpc64-*-linux* included an ABI fix for passing
397 # complex float arguments. This affects gfortran tests that call cabsf
398 # in libm built by an earlier compiler. Return 1 if libm uses the same
399 # argument passing as the compiler under test, 0 otherwise.
400 #
401 # When the target name changes, replace the cached result.
402
403 proc check_effective_target_broken_cplxf_arg { } {
404 global et_broken_cplxf_arg_saved
405 global et_broken_cplxf_arg_target_name
406 global tool
407
408 # Skip the work for targets known not to be affected.
409 if { ![istarget powerpc64-*-linux*] } {
410 return 0
411 } elseif { [is-effective-target ilp32] } {
412 return 0
413 }
414
415 if { ![info exists et_broken_cplxf_arg_target_name] } {
416 set et_broken_cplxf_arg_target_name ""
417 }
418
419 # If the target has changed since we set the cached value, clear it.
420 set current_target [current_target_name]
421 if { $current_target != $et_broken_cplxf_arg_target_name } {
422 verbose "check_effective_target_broken_cplxf_arg: `$et_broken_cplxf_arg_target_name'" 2
423 set et_broken_cplxf_arg_target_name $current_target
424 if [info exists et_broken_cplxf_arg_saved] {
425 verbose "check_effective_target_broken_cplxf_arg: removing cached result" 2
426 unset et_broken_cplxf_arg_saved
427 }
428 }
429
430 if [info exists et_broken_cplxf_arg_saved] {
431 verbose "check_effective_target_broken_cplxf_arg: using cached result" 2
432 } else {
433 set et_broken_cplxf_arg_saved 0
434 # This is only known to affect one target.
435 if { ![istarget powerpc64-*-linux*] || ![is-effective-target lp64] } {
436 set et_broken_cplxf_arg_saved 0
437 verbose "check_effective_target_broken_cplxf_arg: caching 0" 2
438 return $et_broken_cplxf_arg_saved
439 }
440
441 # Set up, compile, and execute a C test program that calls cabsf.
442 set src cabsf[pid].c
443 set exe cabsf[pid].x
444
445 set f [open $src "w"]
446 puts $f "#include <complex.h>"
447 puts $f "extern void abort (void);"
448 puts $f "float fabsf (float);"
449 puts $f "float cabsf (_Complex float);"
450 puts $f "int main ()"
451 puts $f "{"
452 puts $f " _Complex float cf;"
453 puts $f " float f;"
454 puts $f " cf = 3 + 4.0fi;"
455 puts $f " f = cabsf (cf);"
456 puts $f " if (fabsf (f - 5.0) > 0.0001) abort ();"
457 puts $f " return 0;"
458 puts $f "}"
459 close $f
460
461 set lines [${tool}_target_compile $src $exe executable "-lm"]
462 file delete $src
463
464 if [string match "" $lines] {
465 # No error message, compilation succeeded.
466 set result [${tool}_load "./$exe" "" ""]
467 set status [lindex $result 0]
468 remote_file build delete $exe
469
470 verbose "check_effective_target_broken_cplxf_arg: status is <$status>" 2
471
472 if { $status != "pass" } {
473 set et_broken_cplxf_arg_saved 1
474 }
475 } else {
476 verbose "check_effective_target_broken_cplxf_arg: compilation failed" 2
477 }
478 }
479 return $et_broken_cplxf_arg_saved
480 }
481
482 proc check_alpha_max_hw_available { } {
483 global alpha_max_hw_available_saved
484 global tool
485
486 if [info exists alpha_max_hw_available_saved] {
487 verbose "check_alpha_max_hw_available returning saved $alpha_max_hw_available_saved" 2
488 } else {
489 set alpha_max_hw_available_saved 0
490
491 # Set up, compile, and execute a test program probing bit 8 of the
492 # architecture mask, which indicates presence of MAX instructions.
493 set src max[pid].c
494 set exe max[pid].x
495
496 set f [open $src "w"]
497 puts $f "int main() { return __builtin_alpha_amask(1<<8) != 0; }"
498 close $f
499
500 verbose "check_alpha_max_hw_available compiling testfile $src" 2
501 set lines [${tool}_target_compile $src $exe executable ""]
502 file delete $src
503
504 if [string match "" $lines] then {
505 # No error message, compilation succeeded.
506 set result [${tool}_load "./$exe" "" ""]
507 set status [lindex $result 0]
508 remote_file build delete $exe
509 verbose "check_alpha_max_hw_available testfile status is <$status>" 2
510
511 if { $status == "pass" } then {
512 set alpha_max_hw_available_saved 1
513 }
514 } else {
515 verbose "check_alpha_max_hw_availalble testfile compilation failed" 2
516 }
517 }
518
519 return $alpha_max_hw_available_saved
520 }
521
522 # Return 1 if we're generating 32-bit code using default options, 0
523 # otherwise.
524 #
525 # When the target name changes, replace the cached result.
526
527 proc check_effective_target_ilp32 { } {
528 global et_ilp32_saved
529 global et_ilp32_target_name
530
531 if { ![info exists et_ilp32_target_name] } {
532 set et_ilp32_target_name ""
533 }
534
535 # If the target has changed since we set the cached value, clear it.
536 set current_target [current_target_name]
537 if { $current_target != $et_ilp32_target_name } {
538 verbose "check_effective_target_ilp32: `$et_ilp32_target_name' `$current_target'" 2
539 set et_ilp32_target_name $current_target
540 if { [info exists et_ilp32_saved] } {
541 verbose "check_effective_target_ilp32: removing cached result" 2
542 unset et_ilp32_saved
543 }
544 }
545
546 if [info exists et_ilp32_saved] {
547 verbose "check-effective_target_ilp32: using cached result" 2
548 } else {
549 verbose "check_effective_target_ilp32: compiling source" 2
550 set et_ilp32_saved [string match "" [get_compiler_messages ilp32 object {
551 int dummy[(sizeof (int) == 4 && sizeof (void *) == 4 && sizeof (long) == 4 ) ? 1 : -1];
552 }]]
553 }
554 verbose "check_effective_target_ilp32: returning $et_ilp32_saved" 2
555 return $et_ilp32_saved
556 }
557
558 # Return 1 if we're generating 64-bit code using default options, 0
559 # otherwise.
560 #
561 # When the target name changes, replace the cached result.
562
563 proc check_effective_target_lp64 { } {
564 global et_lp64_saved
565 global et_lp64_target_name
566
567 if { ![info exists et_lp64_target_name] } {
568 set et_lp64_target_name ""
569 }
570
571 # If the target has changed since we set the cached value, clear it.
572 set current_target [current_target_name]
573 if { $current_target != $et_lp64_target_name } {
574 verbose "check_effective_target_lp64: `$et_lp64_target_name' `$current_target'" 2
575 set et_lp64_target_name $current_target
576 if [info exists et_lp64_saved] {
577 verbose "check_effective_target_lp64: removing cached result" 2
578 unset et_lp64_saved
579 }
580 }
581
582 if [info exists et_lp64_saved] {
583 verbose "check_effective_target_lp64: using cached result" 2
584 } else {
585 verbose "check_effective_target_lp64: compiling source" 2
586 set et_lp64_saved [string match "" [get_compiler_messages lp64 object {
587 int dummy[(sizeof (int) == 4 && sizeof (void *) == 8 && sizeof (long) == 8 ) ? 1 : -1];
588 }]]
589 }
590 verbose "check_effective_target_lp64: returning $et_lp64_saved" 2
591 return $et_lp64_saved
592 }
593
594 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
595 #
596 # This won't change for different subtargets so cache the result.
597
598 proc check_effective_target_vect_int { } {
599 global et_vect_int_saved
600
601 if [info exists et_vect_int_saved] {
602 verbose "check_effective_target_vect_int: using cached result" 2
603 } else {
604 set et_vect_int_saved 0
605 if { [istarget i?86-*-*]
606 || [istarget powerpc*-*-*]
607 || [istarget x86_64-*-*]
608 || [istarget sparc*-*-*]
609 || [istarget alpha*-*-*]
610 || [istarget ia64-*-*] } {
611 set et_vect_int_saved 1
612 }
613 }
614
615 verbose "check_effective_target_vect_int: returning $et_vect_int_saved" 2
616 return $et_vect_int_saved
617 }
618
619 # Return 1 if the target supports hardware vectors of long, 0 otherwise.
620 #
621 # This can change for different subtargets so do not cache the result.
622
623 proc check_effective_target_vect_long { } {
624 if { [istarget i?86-*-*]
625 || ([istarget powerpc*-*-*] && [check_effective_target_ilp32])
626 || [istarget x86_64-*-*]
627 || ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
628 set answer 1
629 } else {
630 set answer 0
631 }
632
633 verbose "check_effective_target_vect_long: returning $answer" 2
634 return $answer
635 }
636
637 # Return 1 if the target supports hardware vectors of float, 0 otherwise.
638 #
639 # This won't change for different subtargets so cache the result.
640
641 proc check_effective_target_vect_float { } {
642 global et_vect_float_saved
643
644 if [info exists et_vect_float_saved] {
645 verbose "check_effective_target_vect_float: using cached result" 2
646 } else {
647 set et_vect_float_saved 0
648 if { [istarget i?86-*-*]
649 || [istarget powerpc*-*-*]
650 || [istarget mipsisa64*-*-*]
651 || [istarget x86_64-*-*]
652 || [istarget ia64-*-*] } {
653 set et_vect_float_saved 1
654 }
655 }
656
657 verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
658 return $et_vect_float_saved
659 }
660
661 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
662 #
663 # This won't change for different subtargets so cache the result.
664
665 proc check_effective_target_vect_double { } {
666 global et_vect_double_saved
667
668 if [info exists et_vect_double_saved] {
669 verbose "check_effective_target_vect_double: using cached result" 2
670 } else {
671 set et_vect_double_saved 0
672 if { [istarget i?86-*-*]
673 || [istarget x86_64-*-*] } {
674 set et_vect_double_saved 1
675 }
676 }
677
678 verbose "check_effective_target_vect_double: returning $et_vect_double_saved" 2
679 return $et_vect_double_saved
680 }
681
682 # Return 1 if the target plus current options does not support a vector
683 # max instruction, 0 otherwise.
684 #
685 # This won't change for different subtargets so cache the result.
686
687 proc check_effective_target_vect_no_max { } {
688 global et_vect_no_max_saved
689
690 if [info exists et_vect_no_max_saved] {
691 verbose "check_effective_target_vect_no_max: using cached result" 2
692 } else {
693 set et_vect_no_max_saved 0
694 if { [istarget i?86-*-*]
695 || [istarget x86_64-*-*]
696 || [istarget sparc*-*-*]
697 || [istarget alpha*-*-*] } {
698 set et_vect_no_max_saved 1
699 }
700 }
701 verbose "check_effective_target_vect_no_max: returning $et_vect_no_max_saved" 2
702 return $et_vect_no_max_saved
703 }
704
705 # Return 1 if the target plus current options does not support vector
706 # bitwise instructions, 0 otherwise.
707 #
708 # This won't change for different subtargets so cache the result.
709
710 proc check_effective_target_vect_no_bitwise { } {
711 global et_vect_no_bitwise_saved
712
713 if [info exists et_vect_no_bitwise_saved] {
714 verbose "check_effective_target_vect_no_bitwise: using cached result" 2
715 } else {
716 set et_vect_no_bitwise_saved 0
717 }
718 verbose "check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
719 return $et_vect_no_bitwise_saved
720 }
721
722 # Return 1 if the target plus current options does not support a vector
723 # alignment mechanism, 0 otherwise.
724 #
725 # This won't change for different subtargets so cache the result.
726
727 proc check_effective_target_vect_no_align { } {
728 global et_vect_no_align_saved
729
730 if [info exists et_vect_no_align_saved] {
731 verbose "check_effective_target_vect_no_align: using cached result" 2
732 } else {
733 set et_vect_no_align_saved 0
734 if { [istarget mipsisa64*-*-*]
735 || [istarget sparc*-*-*]
736 || [istarget ia64-*-*] } {
737 set et_vect_no_align_saved 1
738 }
739 }
740 verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
741 return $et_vect_no_align_saved
742 }
743
744 # Return 1 if the target matches the effective target 'arg', 0 otherwise.
745 # This can be used with any check_* proc that takes no argument and
746 # returns only 1 or 0. It could be used with check_* procs that take
747 # arguments with keywords that pass particular arguments.
748
749 proc is-effective-target { arg } {
750 set selected 0
751 if { [info procs check_effective_target_${arg}] != [list] } {
752 set selected [check_effective_target_${arg}]
753 } else {
754 switch $arg {
755 "vmx_hw" { set selected [check_vmx_hw_available] }
756 "named_sections" { set selected [check_named_sections_available] }
757 "gc_sections" { set selected [check_gc_sections_available] }
758 default { error "unknown effective target keyword `$arg'" }
759 }
760 }
761 verbose "is-effective-target: $arg $selected" 2
762 return $selected
763 }
764
765 # Return 1 if the argument is an effective-target keyword, 0 otherwise.
766
767 proc is-effective-target-keyword { arg } {
768 if { [info procs check_effective_target_${arg}] != [list] } {
769 return 1
770 } else {
771 # These have different names for their check_* procs.
772 switch $arg {
773 "vmx_hw" { return 1 }
774 "named_sections" { return 1 }
775 "gc_sections" { return 1 }
776 default { return 0 }
777 }
778 }
779 }
This page took 0.072454 seconds and 5 git commands to generate.