1 # Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006, 2007
2 # Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with GCC; see the file COPYING3. If not see
16 # <http://www.gnu.org/licenses/>.
18 # Please email any bugs, comments, and/or additions to this file to:
19 # gcc-patches@gcc.gnu.org
21 # This file defines procs for determining features supported by the target.
23 # Try to compile the code given by CONTENTS into an output file of
24 # type TYPE, where TYPE is as for target_compile. Return a list
25 # whose first element contains the compiler messages and whose
26 # second element is the name of the output file.
28 # BASENAME is a prefix to use for source and output files.
29 # If ARGS is not empty, its first element is a string that
30 # should be added to the command line.
32 # Assume by default that CONTENTS is C code. C++ code should contain
33 # "// C++" and Fortran code should contain "! Fortran".
34 proc check_compile {basename type contents args} {
37 if { [llength $args] > 0 } {
38 set options [list "additional_flags=[lindex $args 0]"]
42 switch -glob -- $contents {
43 "*! Fortran*" { set src ${basename}[pid].f90 }
44 "*// C++*" { set src ${basename}[pid].cc }
45 default { set src ${basename}[pid].c }
47 set compile_type $type
49 assembly { set output ${basename}[pid].s }
50 object { set output ${basename}[pid].o }
51 executable { set output ${basename}[pid].exe }
53 set output ${basename}[pid].s
54 lappend options "additional_flags=-fdump-$type"
55 set compile_type assembly
61 set lines [${tool}_target_compile $src $output $compile_type "$options"]
64 set scan_output $output
65 # Don't try folding this into the switch above; calling "glob" before the
66 # file is created won't work.
67 if [regexp "rtl-(.*)" $type dummy rtl_type] {
68 set scan_output "[glob $src.\[0-9\]\[0-9\]\[0-9\]r.$rtl_type]"
72 return [list $lines $scan_output]
75 proc current_target_name { } {
77 if [info exists target_info(target,name)] {
78 set answer $target_info(target,name)
85 # Implement an effective-target check for property PROP by invoking
86 # the Tcl command ARGS and seeing if it returns true.
88 proc check_cached_effective_target { prop args } {
91 set target [current_target_name]
92 if {![info exists et_cache($prop,target)]
93 || $et_cache($prop,target) != $target} {
94 verbose "check_cached_effective_target $prop: checking $target" 2
95 set et_cache($prop,target) $target
96 set et_cache($prop,value) [uplevel eval $args]
98 set value $et_cache($prop,value)
99 verbose "check_cached_effective_target $prop: returning $value for $target" 2
103 # Like check_compile, but delete the output file and return true if the
104 # compiler printed no messages.
105 proc check_no_compiler_messages_nocache {args} {
106 set result [eval check_compile $args]
107 set lines [lindex $result 0]
108 set output [lindex $result 1]
109 remote_file build delete $output
110 return [string match "" $lines]
113 # Like check_no_compiler_messages_nocache, but cache the result.
114 # PROP is the property we're checking, and doubles as a prefix for
115 # temporary filenames.
116 proc check_no_compiler_messages {prop args} {
117 return [check_cached_effective_target $prop {
118 eval [list check_no_compiler_messages_nocache $prop] $args
122 # Like check_compile, but return true if the compiler printed no
123 # messages and if the contents of the output file satisfy PATTERN.
124 # If PATTERN has the form "!REGEXP", the contents satisfy it if they
125 # don't match regular expression REGEXP, otherwise they satisfy it
126 # if they do match regular expression PATTERN. (PATTERN can start
127 # with something like "[!]" if the regular expression needs to match
128 # "!" as the first character.)
130 # Delete the output file before returning. The other arguments are
131 # as for check_compile.
132 proc check_no_messages_and_pattern_nocache {basename pattern args} {
135 set result [eval [list check_compile $basename] $args]
136 set lines [lindex $result 0]
137 set output [lindex $result 1]
140 if { [string match "" $lines] } {
141 set chan [open "$output"]
142 set invert [regexp {^!(.*)} $pattern dummy pattern]
143 set ok [expr { [regexp $pattern [read $chan]] != $invert }]
147 remote_file build delete $output
151 # Like check_no_messages_and_pattern_nocache, but cache the result.
152 # PROP is the property we're checking, and doubles as a prefix for
153 # temporary filenames.
154 proc check_no_messages_and_pattern {prop pattern args} {
155 return [check_cached_effective_target $prop {
156 eval [list check_no_messages_and_pattern_nocache $prop $pattern] $args
160 # Try to compile and run an executable from code CONTENTS. Return true
161 # if the compiler reports no messages and if execution "passes" in the
162 # usual DejaGNU sense. The arguments are as for check_compile, with
163 # TYPE implicitly being "executable".
164 proc check_runtime_nocache {basename contents args} {
167 set result [eval [list check_compile $basename executable $contents] $args]
168 set lines [lindex $result 0]
169 set output [lindex $result 1]
172 if { [string match "" $lines] } {
173 # No error messages, everything is OK.
174 set result [remote_load target "./$output" "" ""]
175 set status [lindex $result 0]
176 verbose "check_runtime_nocache $basename: status is <$status>" 2
177 if { $status == "pass" } {
181 remote_file build delete $output
185 # Like check_runtime_nocache, but cache the result. PROP is the
186 # property we're checking, and doubles as a prefix for temporary
188 proc check_runtime {prop args} {
191 return [check_cached_effective_target $prop {
192 eval [list check_runtime_nocache $prop] $args
196 ###############################
197 # proc check_weak_available { }
198 ###############################
200 # weak symbols are only supported in some configs/object formats
201 # this proc returns 1 if they're supported, 0 if they're not, or -1 if unsure
203 proc check_weak_available { } {
204 global target_triplet
207 # All mips targets should support it
209 if { [ string first "mips" $target_cpu ] >= 0 } {
213 # All solaris2 targets should support it
215 if { [regexp ".*-solaris2.*" $target_triplet] } {
219 # DEC OSF/1/Digital UNIX/Tru64 UNIX supports it
221 if { [regexp "alpha.*osf.*" $target_triplet] } {
225 # Windows targets Cygwin and MingW32 support it
227 if { [regexp ".*mingw32|.*cygwin" $target_triplet] } {
231 # HP-UX 10.X doesn't support it
233 if { [istarget "hppa*-*-hpux10*"] } {
237 # ELF and ECOFF support it. a.out does with gas/gld but may also with
238 # other linkers, so we should try it
240 set objformat [gcc_target_object_format]
248 unknown { return -1 }
253 ###############################
254 # proc check_visibility_available { what_kind }
255 ###############################
257 # The visibility attribute is only support in some object formats
258 # This proc returns 1 if it is supported, 0 if not.
259 # The argument is the kind of visibility, default/protected/hidden/internal.
261 proc check_visibility_available { what_kind } {
263 global target_triplet
265 # On NetWare, support makes no sense.
266 if { [istarget *-*-netware*] } {
270 if [string match "" $what_kind] { set what_kind "hidden" }
272 return [check_no_compiler_messages visibility_available_$what_kind object "
273 void f() __attribute__((visibility(\"$what_kind\")));
278 ###############################
279 # proc check_alias_available { }
280 ###############################
282 # Determine if the target toolchain supports the alias attribute.
284 # Returns 2 if the target supports aliases. Returns 1 if the target
285 # only supports weak aliased. Returns 0 if the target does not
286 # support aliases at all. Returns -1 if support for aliases could not
289 proc check_alias_available { } {
290 global alias_available_saved
293 if [info exists alias_available_saved] {
294 verbose "check_alias_available returning saved $alias_available_saved" 2
298 verbose "check_alias_available compiling testfile $src" 2
299 set f [open $src "w"]
300 # Compile a small test program. The definition of "g" is
301 # necessary to keep the Solaris assembler from complaining
303 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
304 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
306 set lines [${tool}_target_compile $src $obj object ""]
308 remote_file build delete $obj
310 if [string match "" $lines] then {
311 # No error messages, everything is OK.
312 set alias_available_saved 2
314 if [regexp "alias definitions not supported" $lines] {
315 verbose "check_alias_available target does not support aliases" 2
317 set objformat [gcc_target_object_format]
319 if { $objformat == "elf" } {
320 verbose "check_alias_available but target uses ELF format, so it ought to" 2
321 set alias_available_saved -1
323 set alias_available_saved 0
326 if [regexp "only weak aliases are supported" $lines] {
327 verbose "check_alias_available target supports only weak aliases" 2
328 set alias_available_saved 1
330 set alias_available_saved -1
335 verbose "check_alias_available returning $alias_available_saved" 2
338 return $alias_available_saved
341 # Returns true if --gc-sections is supported on the target.
343 proc check_gc_sections_available { } {
344 global gc_sections_available_saved
347 if {![info exists gc_sections_available_saved]} {
348 # Some targets don't support gc-sections despite whatever's
349 # advertised by ld's options.
350 if { [istarget alpha*-*-*]
351 || [istarget ia64-*-*] } {
352 set gc_sections_available_saved 0
356 # elf2flt uses -q (--emit-relocs), which is incompatible with
358 if { [board_info target exists ldflags]
359 && [regexp " -elf2flt\[ =\]" " [board_info target ldflags] "] } {
360 set gc_sections_available_saved 0
364 # VxWorks kernel modules are relocatable objects linked with -r,
365 # while RTP executables are linked with -q (--emit-relocs).
366 # Both of these options are incompatible with --gc-sections.
367 if { [istarget *-*-vxworks*] } {
368 set gc_sections_available_saved 0
372 # Check if the ld used by gcc supports --gc-sections.
373 set gcc_spec [${tool}_target_compile "-dumpspecs" "" "none" ""]
374 regsub ".*\n\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
375 set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=$linker" "" "none" ""] 0]
376 set ld_output [remote_exec host "$gcc_ld" "--help"]
377 if { [ string first "--gc-sections" $ld_output ] >= 0 } {
378 set gc_sections_available_saved 1
380 set gc_sections_available_saved 0
383 return $gc_sections_available_saved
386 # Return 1 if according to target_info struct and explicit target list
387 # target is supposed to support trampolines.
389 proc check_effective_target_trampolines { } {
390 if [target_info exists no_trampolines] {
393 if { [istarget avr-*-*]
394 || [istarget hppa2.0w-hp-hpux11.23]
395 || [istarget hppa64-hp-hpux11.23] } {
401 # Return 1 if according to target_info struct and explicit target list
402 # target is supposed to keep null pointer checks. This could be due to
403 # use of option fno-delete-null-pointer-checks or hardwired in target.
405 proc check_effective_target_keeps_null_pointer_checks { } {
406 if [target_info exists keeps_null_pointer_checks] {
409 if { [istarget avr-*-*] } {
415 # Return true if profiling is supported on the target.
417 proc check_profiling_available { test_what } {
418 global profiling_available_saved
420 verbose "Profiling argument is <$test_what>" 1
422 # These conditions depend on the argument so examine them before
423 # looking at the cache variable.
425 # Support for -p on solaris2 relies on mcrt1.o which comes with the
426 # vendor compiler. We cannot reliably predict the directory where the
427 # vendor compiler (and thus mcrt1.o) is installed so we can't
428 # necessarily find mcrt1.o even if we have it.
429 if { [istarget *-*-solaris2*] && [lindex $test_what 1] == "-p" } {
433 # Support for -p on irix relies on libprof1.a which doesn't appear to
434 # exist on any irix6 system currently posting testsuite results.
435 # Support for -pg on irix relies on gcrt1.o which doesn't exist yet.
436 # See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html
437 if { [istarget mips*-*-irix*]
438 && ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } {
442 # We don't yet support profiling for MIPS16.
443 if { [istarget mips*-*-*]
444 && ![check_effective_target_nomips16]
445 && ([lindex $test_what 1] == "-p"
446 || [lindex $test_what 1] == "-pg") } {
450 # MinGW does not support -p.
451 if { [istarget *-*-mingw*] && [lindex $test_what 1] == "-p" } {
455 # At present, there is no profiling support on NetWare.
456 if { [istarget *-*-netware*] } {
460 # uClibc does not have gcrt1.o.
461 if { [check_effective_target_uclibc]
462 && ([lindex $test_what 1] == "-p"
463 || [lindex $test_what 1] == "-pg") } {
467 # Now examine the cache variable.
468 if {![info exists profiling_available_saved]} {
469 # Some targets don't have any implementation of __bb_init_func or are
470 # missing other needed machinery.
471 if { [istarget mmix-*-*]
472 || [istarget arm*-*-eabi*]
473 || [istarget arm*-*-elf]
474 || [istarget arm*-*-symbianelf*]
475 || [istarget avr-*-*]
476 || [istarget bfin-*-*]
477 || [istarget powerpc-*-eabi*]
478 || [istarget cris-*-*]
479 || [istarget crisv32-*-*]
480 || [istarget fido-*-elf]
481 || [istarget h8300-*-*]
482 || [istarget m32c-*-elf]
483 || [istarget m68k-*-elf]
484 || [istarget m68k-*-uclinux*]
485 || [istarget mips*-*-elf*]
486 || [istarget xstormy16-*]
487 || [istarget xtensa*-*-elf]
488 || [istarget *-*-vxworks*] } {
489 set profiling_available_saved 0
491 set profiling_available_saved 1
495 return $profiling_available_saved
498 # Return 1 if target has packed layout of structure members by
499 # default, 0 otherwise. Note that this is slightly different than
500 # whether the target has "natural alignment": both attributes may be
503 proc check_effective_target_default_packed { } {
504 return [check_no_compiler_messages default_packed assembly {
505 struct x { char a; long b; } c;
506 int s[sizeof (c) == sizeof (char) + sizeof (long) ? 1 : -1];
510 # Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
511 # documentation, where the test also comes from.
513 proc check_effective_target_pcc_bitfield_type_matters { } {
514 # PCC_BITFIELD_TYPE_MATTERS isn't just about unnamed or empty
515 # bitfields, but let's stick to the example code from the docs.
516 return [check_no_compiler_messages pcc_bitfield_type_matters assembly {
517 struct foo1 { char x; char :0; char y; };
518 struct foo2 { char x; int :0; char y; };
519 int s[sizeof (struct foo1) != sizeof (struct foo2) ? 1 : -1];
523 # Return 1 if thread local storage (TLS) is supported, 0 otherwise.
525 # This won't change for different subtargets so cache the result.
527 proc check_effective_target_tls {} {
528 return [check_no_compiler_messages tls assembly {
530 int f (void) { return i; }
531 void g (int j) { i = j; }
535 # Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
537 # This won't change for different subtargets so cache the result.
539 proc check_effective_target_tls_native {} {
540 # VxWorks uses emulated TLS machinery, but with non-standard helper
541 # functions, so we fail to automatically detect it.
542 global target_triplet
543 if { [regexp ".*-.*-vxworks.*" $target_triplet] } {
547 return [check_no_messages_and_pattern tls_native "!emutls" assembly {
549 int f (void) { return i; }
550 void g (int j) { i = j; }
554 # Return 1 if TLS executables can run correctly, 0 otherwise.
556 # This won't change for different subtargets so cache the result.
558 proc check_effective_target_tls_runtime {} {
559 return [check_runtime tls_runtime {
560 __thread int thr = 0;
561 int main (void) { return thr; }
565 # Return 1 if compilation with -fopenmp is error-free for trivial
568 proc check_effective_target_fopenmp {} {
569 return [check_no_compiler_messages fopenmp object {
574 # Return 1 if compilation with -pthread is error-free for trivial
577 proc check_effective_target_pthread {} {
578 return [check_no_compiler_messages pthread object {
583 # Return 1 if the target supports -fstack-protector
584 proc check_effective_target_fstack_protector {} {
585 return [check_runtime fstack_protector {
586 int main (void) { return 0; }
587 } "-fstack-protector"]
590 # Return 1 if compilation with -freorder-blocks-and-partition is error-free
591 # for trivial code, 0 otherwise.
593 proc check_effective_target_freorder {} {
594 return [check_no_compiler_messages freorder object {
596 } "-freorder-blocks-and-partition"]
599 # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
600 # emitted, 0 otherwise. Whether a shared library can actually be built is
601 # out of scope for this test.
603 proc check_effective_target_fpic { } {
604 # Note that M68K has a multilib that supports -fpic but not
605 # -fPIC, so we need to check both. We test with a program that
606 # requires GOT references.
607 foreach arg {fpic fPIC} {
608 if [check_no_compiler_messages $arg object {
609 extern int foo (void); extern int bar;
610 int baz (void) { return foo () + bar; }
618 # Return true if the target supports -mpaired-single (as used on MIPS).
620 proc check_effective_target_mpaired_single { } {
621 return [check_no_compiler_messages mpaired_single object {
626 # Return true if the target has access to FPU instructions.
628 proc check_effective_target_hard_float { } {
629 if { [istarget mips*-*-*] } {
630 return [check_no_compiler_messages hard_float assembly {
631 #if (defined __mips_soft_float || defined __mips16)
637 # The generic test equates hard_float with "no call for adding doubles".
638 return [check_no_messages_and_pattern hard_float "!\\(call" rtl-expand {
639 double a (double b, double c) { return b + c; }
643 # Return true if the target is a 64-bit MIPS target.
645 proc check_effective_target_mips64 { } {
646 return [check_no_compiler_messages mips64 assembly {
653 # Return true if the target is a MIPS target that does not produce
656 proc check_effective_target_nomips16 { } {
657 return [check_no_compiler_messages nomips16 object {
661 /* A cheap way of testing for -mflip-mips16. */
662 void foo (void) { asm ("addiu $20,$20,1"); }
663 void bar (void) { asm ("addiu $20,$20,1"); }
668 # Add the options needed for MIPS16 function attributes. At the moment,
669 # we don't support MIPS16 PIC.
671 proc add_options_for_mips16_attribute { flags } {
672 return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
675 # Return true if we can force a mode that allows MIPS16 code generation.
676 # We don't support MIPS16 PIC, and only support MIPS16 -mhard-float
679 proc check_effective_target_mips16_attribute { } {
680 return [check_no_compiler_messages mips16_attribute assembly {
684 #if defined __mips_hard_float \
685 && (!defined _ABIO32 || _MIPS_SIM != _ABIO32) \
686 && (!defined _ABIO64 || _MIPS_SIM != _ABIO64)
689 } [add_options_for_mips16_attribute ""]]
692 # Return 1 if the current multilib does not generate PIC by default.
694 proc check_effective_target_nonpic { } {
695 return [check_no_compiler_messages nonpic assembly {
702 # Return 1 if the target does not use a status wrapper.
704 proc check_effective_target_unwrapped { } {
705 if { [target_info needs_status_wrapper] != "" \
706 && [target_info needs_status_wrapper] != "0" } {
712 # Return true if iconv is supported on the target. In particular IBM1047.
714 proc check_iconv_available { test_what } {
717 # If the tool configuration file has not set libiconv, try "-liconv"
718 if { ![info exists libiconv] } {
719 set libiconv "-liconv"
721 set test_what [lindex $test_what 1]
722 return [check_runtime_nocache $test_what [subst {
728 cd = iconv_open ("$test_what", "UTF-8");
729 if (cd == (iconv_t) -1)
736 # Return true if named sections are supported on this target.
738 proc check_named_sections_available { } {
739 return [check_no_compiler_messages named_sections assembly {
740 int __attribute__ ((section("whatever"))) foo;
744 # Return 1 if the target supports Fortran real kinds larger than real(8),
747 # When the target name changes, replace the cached result.
749 proc check_effective_target_fortran_large_real { } {
750 return [check_no_compiler_messages fortran_large_real executable {
752 integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
759 # Return 1 if the target supports Fortran integer kinds larger than
760 # integer(8), 0 otherwise.
762 # When the target name changes, replace the cached result.
764 proc check_effective_target_fortran_large_int { } {
765 return [check_no_compiler_messages fortran_large_int executable {
767 integer,parameter :: k = selected_int_kind (range (0_8) + 1)
773 # Return 1 if the target supports Fortran integer(16), 0 otherwise.
775 # When the target name changes, replace the cached result.
777 proc check_effective_target_fortran_integer_16 { } {
778 return [check_no_compiler_messages fortran_integer_16 executable {
785 # Return 1 if we can statically link libgfortran, 0 otherwise.
787 # When the target name changes, replace the cached result.
789 proc check_effective_target_static_libgfortran { } {
790 return [check_no_compiler_messages static_libgfortran executable {
797 # Return 1 if the target supports executing 750CL paired-single instructions, 0
798 # otherwise. Cache the result.
800 proc check_750cl_hw_available { } {
801 return [check_cached_effective_target 750cl_hw_available {
802 # If this is not the right target then we can skip the test.
803 if { ![istarget powerpc-*paired*] } {
806 check_runtime_nocache 750cl_hw_available {
810 asm volatile ("ps_mul v0,v0,v0");
812 asm volatile ("ps_mul 0,0,0");
821 # Return 1 if the target supports executing SSE2 instructions, 0
822 # otherwise. Cache the result.
824 proc check_sse2_hw_available { } {
825 return [check_cached_effective_target sse2_hw_available {
826 # If this is not the right target then we can skip the test.
827 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
830 check_runtime_nocache sse2_hw_available {
834 unsigned int eax, ebx, ecx, edx = 0;
835 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
836 return !(edx & bit_SSE2);
844 # Return 1 if the target supports executing AltiVec instructions, 0
845 # otherwise. Cache the result.
847 proc check_vmx_hw_available { } {
848 return [check_cached_effective_target vmx_hw_available {
849 # Some simulators are known to not support VMX instructions.
850 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
853 # Most targets don't require special flags for this test case, but
855 if { [istarget *-*-darwin*]
856 || [istarget *-*-aix*] } {
857 set options "-maltivec"
861 check_runtime_nocache vmx_hw_available {
865 asm volatile ("vor v0,v0,v0");
867 asm volatile ("vor 0,0,0");
876 # GCC 3.4.0 for powerpc64-*-linux* included an ABI fix for passing
877 # complex float arguments. This affects gfortran tests that call cabsf
878 # in libm built by an earlier compiler. Return 1 if libm uses the same
879 # argument passing as the compiler under test, 0 otherwise.
881 # When the target name changes, replace the cached result.
883 proc check_effective_target_broken_cplxf_arg { } {
884 return [check_cached_effective_target broken_cplxf_arg {
885 # Skip the work for targets known not to be affected.
886 if { ![istarget powerpc64-*-linux*] } {
888 } elseif { ![is-effective-target lp64] } {
891 check_runtime_nocache broken_cplxf_arg {
893 extern void abort (void);
895 float cabsf (_Complex float);
902 if (fabsf (f - 5.0) > 0.0001)
911 proc check_alpha_max_hw_available { } {
912 return [check_runtime alpha_max_hw_available {
913 int main() { return __builtin_alpha_amask(1<<8) != 0; }
917 # Returns true iff the FUNCTION is available on the target system.
918 # (This is essentially a Tcl implementation of Autoconf's
921 proc check_function_available { function } {
922 return [check_no_compiler_messages ${function}_available \
928 int main () { $function (); }
932 # Returns true iff "fork" is available on the target system.
934 proc check_fork_available {} {
935 return [check_function_available "fork"]
938 # Returns true iff "mkfifo" is available on the target system.
940 proc check_mkfifo_available {} {
941 if {[istarget *-*-cygwin*]} {
942 # Cygwin has mkfifo, but support is incomplete.
946 return [check_function_available "mkfifo"]
949 # Returns true iff "__cxa_atexit" is used on the target system.
951 proc check_cxa_atexit_available { } {
952 return [check_cached_effective_target cxa_atexit_available {
953 if { [istarget "hppa*-*-hpux10*"] } {
954 # HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
957 check_runtime_nocache cxa_atexit_available {
960 static unsigned int count;
977 Y() { f(); count = 2; }
986 int main() { return 0; }
993 # Return 1 if we're generating 32-bit code using default options, 0
996 proc check_effective_target_ilp32 { } {
997 return [check_no_compiler_messages ilp32 object {
998 int dummy[sizeof (int) == 4
999 && sizeof (void *) == 4
1000 && sizeof (long) == 4 ? 1 : -1];
1004 # Return 1 if we're generating 32-bit or larger integers using default
1005 # options, 0 otherwise.
1007 proc check_effective_target_int32plus { } {
1008 return [check_no_compiler_messages int32plus object {
1009 int dummy[sizeof (int) >= 4 ? 1 : -1];
1013 # Return 1 if we're generating 32-bit or larger pointers using default
1014 # options, 0 otherwise.
1016 proc check_effective_target_ptr32plus { } {
1017 return [check_no_compiler_messages ptr32plus object {
1018 int dummy[sizeof (void *) >= 4 ? 1 : -1];
1022 # Return 1 if we support 32-bit or larger array and structure sizes
1023 # using default options, 0 otherwise.
1025 proc check_effective_target_size32plus { } {
1026 return [check_no_compiler_messages size32plus object {
1031 # Returns 1 if we're generating 16-bit or smaller integers with the
1032 # default options, 0 otherwise.
1034 proc check_effective_target_int16 { } {
1035 return [check_no_compiler_messages int16 object {
1036 int dummy[sizeof (int) < 4 ? 1 : -1];
1040 # Return 1 if we're generating 64-bit code using default options, 0
1043 proc check_effective_target_lp64 { } {
1044 return [check_no_compiler_messages lp64 object {
1045 int dummy[sizeof (int) == 4
1046 && sizeof (void *) == 8
1047 && sizeof (long) == 8 ? 1 : -1];
1051 # Return 1 if the target supports long double larger than double,
1054 proc check_effective_target_large_long_double { } {
1055 return [check_no_compiler_messages large_long_double object {
1056 int dummy[sizeof(long double) > sizeof(double) ? 1 : -1];
1060 # Return 1 if the target supports compiling fixed-point,
1063 proc check_effective_target_fixed_point { } {
1064 return [check_no_compiler_messages fixed_point object {
1065 _Sat _Fract x; _Sat _Accum y;
1069 # Return 1 if the target supports compiling decimal floating point,
1072 proc check_effective_target_dfp_nocache { } {
1073 verbose "check_effective_target_dfp_nocache: compiling source" 2
1074 set ret [check_no_compiler_messages_nocache dfp object {
1075 _Decimal32 x; _Decimal64 y; _Decimal128 z;
1077 verbose "check_effective_target_dfp_nocache: returning $ret" 2
1081 proc check_effective_target_dfprt_nocache { } {
1082 return [check_runtime_nocache dfprt {
1083 _Decimal32 x = 1.2df; _Decimal64 y = 2.3dd; _Decimal128 z;
1084 int main () { z = x + y; return 0; }
1088 # Return 1 if the target supports compiling Decimal Floating Point,
1091 # This won't change for different subtargets so cache the result.
1093 proc check_effective_target_dfp { } {
1094 return [check_cached_effective_target dfp {
1095 check_effective_target_dfp_nocache
1099 # Return 1 if the target supports linking and executing Decimal Floating
1100 # Point, # 0 otherwise.
1102 # This won't change for different subtargets so cache the result.
1104 proc check_effective_target_dfprt { } {
1105 return [check_cached_effective_target dfprt {
1106 check_effective_target_dfprt_nocache
1110 # Return 1 if the target needs a command line argument to enable a SIMD
1113 proc check_effective_target_vect_cmdline_needed { } {
1114 global et_vect_cmdline_needed_saved
1115 global et_vect_cmdline_needed_target_name
1117 if { ![info exists et_vect_cmdline_needed_target_name] } {
1118 set et_vect_cmdline_needed_target_name ""
1121 # If the target has changed since we set the cached value, clear it.
1122 set current_target [current_target_name]
1123 if { $current_target != $et_vect_cmdline_needed_target_name } {
1124 verbose "check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target'" 2
1125 set et_vect_cmdline_needed_target_name $current_target
1126 if { [info exists et_vect_cmdline_needed_saved] } {
1127 verbose "check_effective_target_vect_cmdline_needed: removing cached result" 2
1128 unset et_vect_cmdline_needed_saved
1132 if [info exists et_vect_cmdline_needed_saved] {
1133 verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
1135 set et_vect_cmdline_needed_saved 1
1136 if { [istarget ia64-*-*]
1137 || (([istarget x86_64-*-*] || [istarget i?86-*-*])
1138 && [check_effective_target_lp64])
1139 || ([istarget powerpc*-*-*]
1140 && ([check_effective_target_powerpc_spe]
1141 || [check_effective_target_powerpc_altivec]))
1142 || [istarget spu-*-*]
1143 || ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
1144 set et_vect_cmdline_needed_saved 0
1148 verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
1149 return $et_vect_cmdline_needed_saved
1152 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
1154 # This won't change for different subtargets so cache the result.
1156 proc check_effective_target_vect_int { } {
1157 global et_vect_int_saved
1159 if [info exists et_vect_int_saved] {
1160 verbose "check_effective_target_vect_int: using cached result" 2
1162 set et_vect_int_saved 0
1163 if { [istarget i?86-*-*]
1164 || ([istarget powerpc*-*-*]
1165 && ![istarget powerpc-*-linux*paired*])
1166 || [istarget spu-*-*]
1167 || [istarget x86_64-*-*]
1168 || [istarget sparc*-*-*]
1169 || [istarget alpha*-*-*]
1170 || [istarget ia64-*-*]
1171 || [check_effective_target_arm32] } {
1172 set et_vect_int_saved 1
1176 verbose "check_effective_target_vect_int: returning $et_vect_int_saved" 2
1177 return $et_vect_int_saved
1180 # Return 1 if the target supports int->float conversion
1183 proc check_effective_target_vect_intfloat_cvt { } {
1184 global et_vect_intfloat_cvt_saved
1186 if [info exists et_vect_intfloat_cvt_saved] {
1187 verbose "check_effective_target_vect_intfloat_cvt: using cached result" 2
1189 set et_vect_intfloat_cvt_saved 0
1190 if { [istarget i?86-*-*]
1191 || ([istarget powerpc*-*-*]
1192 && ![istarget powerpc-*-linux*paired*])
1193 || [istarget x86_64-*-*] } {
1194 set et_vect_intfloat_cvt_saved 1
1198 verbose "check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
1199 return $et_vect_intfloat_cvt_saved
1203 # Return 1 if the target supports float->int conversion
1206 proc check_effective_target_vect_floatint_cvt { } {
1207 global et_vect_floatint_cvt_saved
1209 if [info exists et_vect_floatint_cvt_saved] {
1210 verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
1212 set et_vect_floatint_cvt_saved 0
1213 if { [istarget i?86-*-*]
1214 || ([istarget powerpc*-*-*]
1215 && ![istarget powerpc-*-linux*paired*])
1216 || [istarget x86_64-*-*] } {
1217 set et_vect_floatint_cvt_saved 1
1221 verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
1222 return $et_vect_floatint_cvt_saved
1225 # Return 1 is this is an arm target using 32-bit instructions
1226 proc check_effective_target_arm32 { } {
1227 return [check_no_compiler_messages arm32 assembly {
1228 #if !defined(__arm__) || (defined(__thumb__) && !defined(__thumb2__))
1234 # Return 1 if this is an ARM target supporting -mfpu=vfp
1235 # -mfloat-abi=softfp. Some multilibs may be incompatible with these
1238 proc check_effective_target_arm_vfp_ok { } {
1239 if { [check_effective_target_arm32] } {
1240 return [check_no_compiler_messages arm_vfp_ok object {
1242 } "-mfpu=vfp -mfloat-abi=softfp"]
1248 # Return 1 if this is an ARM target supporting -mfpu=neon
1249 # -mfloat-abi=softfp. Some multilibs may be incompatible with these
1252 proc check_effective_target_arm_neon_ok { } {
1253 if { [check_effective_target_arm32] } {
1254 return [check_no_compiler_messages arm_neon_ok object {
1256 } "-mfpu=neon -mfloat-abi=softfp"]
1262 # Return 1 is this is an ARM target where -mthumb causes Thumb-1 to be
1265 proc check_effective_target_arm_thumb1_ok { } {
1266 return [check_no_compiler_messages arm_thumb1_ok assembly {
1267 #if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__)
1273 # Return 1 if the target supports executing NEON instructions, 0
1274 # otherwise. Cache the result.
1276 proc check_effective_target_arm_neon_hw { } {
1277 return [check_runtime arm_neon_hw_available {
1281 long long a = 0, b = 1;
1282 asm ("vorr %P0, %P1, %P2"
1284 : "0" (a), "w" (b));
1287 } "-mfpu=neon -mfloat-abi=softfp"]
1290 # Return 1 if this is a ARM target with NEON enabled.
1292 proc check_effective_target_arm_neon { } {
1293 if { [check_effective_target_arm32] } {
1294 return [check_no_compiler_messages arm_neon object {
1295 #ifndef __ARM_NEON__
1306 # Return 1 if this a Loongson-2E or -2F target using an ABI that supports
1307 # the Loongson vector modes.
1309 proc check_effective_target_mips_loongson { } {
1310 return [check_no_compiler_messages loongson assembly {
1311 #if !defined(__mips_loongson_vector_rev)
1317 # Return 1 if this is a PowerPC target with floating-point registers.
1319 proc check_effective_target_powerpc_fprs { } {
1320 if { [istarget powerpc*-*-*]
1321 || [istarget rs6000-*-*] } {
1322 return [check_no_compiler_messages powerpc_fprs object {
1334 # Return 1 if this is a PowerPC target with hardware double-precision
1337 proc check_effective_target_powerpc_hard_double { } {
1338 if { [istarget powerpc*-*-*]
1339 || [istarget rs6000-*-*] } {
1340 return [check_no_compiler_messages powerpc_hard_double object {
1352 # Return 1 if this is a PowerPC target supporting -maltivec.
1354 proc check_effective_target_powerpc_altivec_ok { } {
1355 if { ([istarget powerpc*-*-*]
1356 && ![istarget powerpc-*-linux*paired*])
1357 || [istarget rs6000-*-*] } {
1358 # AltiVec is not supported on AIX before 5.3.
1359 if { [istarget powerpc*-*-aix4*]
1360 || [istarget powerpc*-*-aix5.1*]
1361 || [istarget powerpc*-*-aix5.2*] } {
1364 return [check_no_compiler_messages powerpc_altivec_ok object {
1372 # Return 1 if this is a PowerPC target that supports SPU.
1374 proc check_effective_target_powerpc_spu { } {
1375 if [istarget powerpc*-*-linux*] {
1376 return [check_effective_target_powerpc_altivec_ok]
1382 # Return 1 if this is a PowerPC target with SPE enabled.
1384 proc check_effective_target_powerpc_spe { } {
1385 if { [istarget powerpc*-*-*] } {
1386 return [check_no_compiler_messages powerpc_spe object {
1398 # Return 1 if this is a PowerPC target with Altivec enabled.
1400 proc check_effective_target_powerpc_altivec { } {
1401 if { [istarget powerpc*-*-*] } {
1402 return [check_no_compiler_messages powerpc_altivec object {
1414 # Return 1 if this is a SPU target with a toolchain that
1415 # supports automatic overlay generation.
1417 proc check_effective_target_spu_auto_overlay { } {
1418 if { [istarget spu*-*-elf*] } {
1419 return [check_no_compiler_messages spu_auto_overlay executable {
1421 } "-Wl,--auto-overlay" ]
1427 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
1428 # chokes on EM_SPARC32PLUS or EM_SPARCV9 executables. Return 1 if the
1429 # test environment appears to run executables on such a simulator.
1431 proc check_effective_target_ultrasparc_hw { } {
1432 return [check_runtime ultrasparc_hw {
1433 int main() { return 0; }
1434 } "-mcpu=ultrasparc"]
1437 # Return 1 if the target supports hardware vector shift operation.
1439 proc check_effective_target_vect_shift { } {
1440 global et_vect_shift_saved
1442 if [info exists et_vect_shift_saved] {
1443 verbose "check_effective_target_vect_shift: using cached result" 2
1445 set et_vect_shift_saved 0
1446 if { ([istarget powerpc*-*-*]
1447 && ![istarget powerpc-*-linux*paired*])
1448 || [istarget ia64-*-*]
1449 || [istarget i?86-*-*]
1450 || [istarget x86_64-*-*]
1451 || [check_effective_target_arm32] } {
1452 set et_vect_shift_saved 1
1456 verbose "check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
1457 return $et_vect_shift_saved
1460 # Return 1 if the target supports hardware vectors of long, 0 otherwise.
1462 # This can change for different subtargets so do not cache the result.
1464 proc check_effective_target_vect_long { } {
1465 if { [istarget i?86-*-*]
1466 || (([istarget powerpc*-*-*]
1467 && ![istarget powerpc-*-linux*paired*])
1468 && [check_effective_target_ilp32])
1469 || [istarget x86_64-*-*]
1470 || [check_effective_target_arm32]
1471 || ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
1477 verbose "check_effective_target_vect_long: returning $answer" 2
1481 # Return 1 if the target supports hardware vectors of float, 0 otherwise.
1483 # This won't change for different subtargets so cache the result.
1485 proc check_effective_target_vect_float { } {
1486 global et_vect_float_saved
1488 if [info exists et_vect_float_saved] {
1489 verbose "check_effective_target_vect_float: using cached result" 2
1491 set et_vect_float_saved 0
1492 if { [istarget i?86-*-*]
1493 || [istarget powerpc*-*-*]
1494 || [istarget spu-*-*]
1495 || [istarget mipsisa64*-*-*]
1496 || [istarget x86_64-*-*]
1497 || [istarget ia64-*-*]
1498 || [check_effective_target_arm32] } {
1499 set et_vect_float_saved 1
1503 verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
1504 return $et_vect_float_saved
1507 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
1509 # This won't change for different subtargets so cache the result.
1511 proc check_effective_target_vect_double { } {
1512 global et_vect_double_saved
1514 if [info exists et_vect_double_saved] {
1515 verbose "check_effective_target_vect_double: using cached result" 2
1517 set et_vect_double_saved 0
1518 if { [istarget i?86-*-*]
1519 || [istarget x86_64-*-*]
1520 || [istarget spu-*-*] } {
1521 set et_vect_double_saved 1
1525 verbose "check_effective_target_vect_double: returning $et_vect_double_saved" 2
1526 return $et_vect_double_saved
1529 # Return 1 if the target supports hardware vectors of long long, 0 otherwise.
1531 # This won't change for different subtargets so cache the result.
1533 proc check_effective_target_vect_long_long { } {
1534 global et_vect_long_long_saved
1536 if [info exists et_vect_long_long_saved] {
1537 verbose "check_effective_target_vect_long_long: using cached result" 2
1539 set et_vect_long_long_saved 0
1540 if { [istarget i?86-*-*]
1541 || [istarget x86_64-*-*] } {
1542 set et_vect_long_long_saved 1
1546 verbose "check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
1547 return $et_vect_long_long_saved
1551 # Return 1 if the target plus current options does not support a vector
1552 # max instruction on "int", 0 otherwise.
1554 # This won't change for different subtargets so cache the result.
1556 proc check_effective_target_vect_no_int_max { } {
1557 global et_vect_no_int_max_saved
1559 if [info exists et_vect_no_int_max_saved] {
1560 verbose "check_effective_target_vect_no_int_max: using cached result" 2
1562 set et_vect_no_int_max_saved 0
1563 if { [istarget sparc*-*-*]
1564 || [istarget spu-*-*]
1565 || [istarget alpha*-*-*] } {
1566 set et_vect_no_int_max_saved 1
1569 verbose "check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
1570 return $et_vect_no_int_max_saved
1573 # Return 1 if the target plus current options does not support a vector
1574 # add instruction on "int", 0 otherwise.
1576 # This won't change for different subtargets so cache the result.
1578 proc check_effective_target_vect_no_int_add { } {
1579 global et_vect_no_int_add_saved
1581 if [info exists et_vect_no_int_add_saved] {
1582 verbose "check_effective_target_vect_no_int_add: using cached result" 2
1584 set et_vect_no_int_add_saved 0
1585 # Alpha only supports vector add on V8QI and V4HI.
1586 if { [istarget alpha*-*-*] } {
1587 set et_vect_no_int_add_saved 1
1590 verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
1591 return $et_vect_no_int_add_saved
1594 # Return 1 if the target plus current options does not support vector
1595 # bitwise instructions, 0 otherwise.
1597 # This won't change for different subtargets so cache the result.
1599 proc check_effective_target_vect_no_bitwise { } {
1600 global et_vect_no_bitwise_saved
1602 if [info exists et_vect_no_bitwise_saved] {
1603 verbose "check_effective_target_vect_no_bitwise: using cached result" 2
1605 set et_vect_no_bitwise_saved 0
1607 verbose "check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
1608 return $et_vect_no_bitwise_saved
1611 # Return 1 if the target plus current options supports a vector
1612 # widening summation of *short* args into *int* result, 0 otherwise.
1613 # A target can also support this widening summation if it can support
1614 # promotion (unpacking) from shorts to ints.
1616 # This won't change for different subtargets so cache the result.
1618 proc check_effective_target_vect_widen_sum_hi_to_si { } {
1619 global et_vect_widen_sum_hi_to_si
1621 if [info exists et_vect_widen_sum_hi_to_si_saved] {
1622 verbose "check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
1624 set et_vect_widen_sum_hi_to_si_saved [check_effective_target_vect_unpack]
1625 if { [istarget powerpc*-*-*]
1626 || [istarget ia64-*-*] } {
1627 set et_vect_widen_sum_hi_to_si_saved 1
1630 verbose "check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
1631 return $et_vect_widen_sum_hi_to_si_saved
1634 # Return 1 if the target plus current options supports a vector
1635 # widening summation of *char* args into *short* result, 0 otherwise.
1636 # A target can also support this widening summation if it can support
1637 # promotion (unpacking) from chars to shorts.
1639 # This won't change for different subtargets so cache the result.
1641 proc check_effective_target_vect_widen_sum_qi_to_hi { } {
1642 global et_vect_widen_sum_qi_to_hi
1644 if [info exists et_vect_widen_sum_qi_to_hi_saved] {
1645 verbose "check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
1647 set et_vect_widen_sum_qi_to_hi_saved 0
1648 if { [check_effective_target_vect_unpack]
1649 || [istarget ia64-*-*] } {
1650 set et_vect_widen_sum_qi_to_hi_saved 1
1653 verbose "check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
1654 return $et_vect_widen_sum_qi_to_hi_saved
1657 # Return 1 if the target plus current options supports a vector
1658 # widening summation of *char* args into *int* result, 0 otherwise.
1660 # This won't change for different subtargets so cache the result.
1662 proc check_effective_target_vect_widen_sum_qi_to_si { } {
1663 global et_vect_widen_sum_qi_to_si
1665 if [info exists et_vect_widen_sum_qi_to_si_saved] {
1666 verbose "check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
1668 set et_vect_widen_sum_qi_to_si_saved 0
1669 if { [istarget powerpc*-*-*] } {
1670 set et_vect_widen_sum_qi_to_si_saved 1
1673 verbose "check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
1674 return $et_vect_widen_sum_qi_to_si_saved
1677 # Return 1 if the target plus current options supports a vector
1678 # widening multiplication of *char* args into *short* result, 0 otherwise.
1679 # A target can also support this widening multplication if it can support
1680 # promotion (unpacking) from chars to shorts, and vect_short_mult (non-widening
1681 # multiplication of shorts).
1683 # This won't change for different subtargets so cache the result.
1686 proc check_effective_target_vect_widen_mult_qi_to_hi { } {
1687 global et_vect_widen_mult_qi_to_hi
1689 if [info exists et_vect_widen_mult_qi_to_hi_saved] {
1690 verbose "check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
1692 if { [check_effective_target_vect_unpack]
1693 && [check_effective_target_vect_short_mult] } {
1694 set et_vect_widen_mult_qi_to_hi_saved 1
1696 set et_vect_widen_mult_qi_to_hi_saved 0
1698 if { [istarget powerpc*-*-*] } {
1699 set et_vect_widen_mult_qi_to_hi_saved 1
1702 verbose "check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
1703 return $et_vect_widen_mult_qi_to_hi_saved
1706 # Return 1 if the target plus current options supports a vector
1707 # widening multiplication of *short* args into *int* result, 0 otherwise.
1708 # A target can also support this widening multplication if it can support
1709 # promotion (unpacking) from shorts to ints, and vect_int_mult (non-widening
1710 # multiplication of ints).
1712 # This won't change for different subtargets so cache the result.
1715 proc check_effective_target_vect_widen_mult_hi_to_si { } {
1716 global et_vect_widen_mult_hi_to_si
1718 if [info exists et_vect_widen_mult_hi_to_si_saved] {
1719 verbose "check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
1721 if { [check_effective_target_vect_unpack]
1722 && [check_effective_target_vect_int_mult] } {
1723 set et_vect_widen_mult_hi_to_si_saved 1
1725 set et_vect_widen_mult_hi_to_si_saved 0
1727 if { [istarget powerpc*-*-*]
1728 || [istarget spu-*-*]
1729 || [istarget i?86-*-*]
1730 || [istarget x86_64-*-*] } {
1731 set et_vect_widen_mult_hi_to_si_saved 1
1734 verbose "check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
1735 return $et_vect_widen_mult_hi_to_si_saved
1738 # Return 1 if the target plus current options supports a vector
1739 # dot-product of signed chars, 0 otherwise.
1741 # This won't change for different subtargets so cache the result.
1743 proc check_effective_target_vect_sdot_qi { } {
1744 global et_vect_sdot_qi
1746 if [info exists et_vect_sdot_qi_saved] {
1747 verbose "check_effective_target_vect_sdot_qi: using cached result" 2
1749 set et_vect_sdot_qi_saved 0
1751 verbose "check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
1752 return $et_vect_sdot_qi_saved
1755 # Return 1 if the target plus current options supports a vector
1756 # dot-product of unsigned chars, 0 otherwise.
1758 # This won't change for different subtargets so cache the result.
1760 proc check_effective_target_vect_udot_qi { } {
1761 global et_vect_udot_qi
1763 if [info exists et_vect_udot_qi_saved] {
1764 verbose "check_effective_target_vect_udot_qi: using cached result" 2
1766 set et_vect_udot_qi_saved 0
1767 if { [istarget powerpc*-*-*] } {
1768 set et_vect_udot_qi_saved 1
1771 verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
1772 return $et_vect_udot_qi_saved
1775 # Return 1 if the target plus current options supports a vector
1776 # dot-product of signed shorts, 0 otherwise.
1778 # This won't change for different subtargets so cache the result.
1780 proc check_effective_target_vect_sdot_hi { } {
1781 global et_vect_sdot_hi
1783 if [info exists et_vect_sdot_hi_saved] {
1784 verbose "check_effective_target_vect_sdot_hi: using cached result" 2
1786 set et_vect_sdot_hi_saved 0
1787 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
1788 || [istarget i?86-*-*]
1789 || [istarget x86_64-*-*] } {
1790 set et_vect_sdot_hi_saved 1
1793 verbose "check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
1794 return $et_vect_sdot_hi_saved
1797 # Return 1 if the target plus current options supports a vector
1798 # dot-product of unsigned shorts, 0 otherwise.
1800 # This won't change for different subtargets so cache the result.
1802 proc check_effective_target_vect_udot_hi { } {
1803 global et_vect_udot_hi
1805 if [info exists et_vect_udot_hi_saved] {
1806 verbose "check_effective_target_vect_udot_hi: using cached result" 2
1808 set et_vect_udot_hi_saved 0
1809 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) } {
1810 set et_vect_udot_hi_saved 1
1813 verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
1814 return $et_vect_udot_hi_saved
1818 # Return 1 if the target plus current options supports a vector
1819 # demotion (packing) of shorts (to chars) and ints (to shorts)
1820 # using modulo arithmetic, 0 otherwise.
1822 # This won't change for different subtargets so cache the result.
1824 proc check_effective_target_vect_pack_trunc { } {
1825 global et_vect_pack_trunc
1827 if [info exists et_vect_pack_trunc_saved] {
1828 verbose "check_effective_target_vect_pack_trunc: using cached result" 2
1830 set et_vect_pack_trunc_saved 0
1831 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
1832 || [istarget i?86-*-*]
1833 || [istarget x86_64-*-*] } {
1834 set et_vect_pack_trunc_saved 1
1837 verbose "check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
1838 return $et_vect_pack_trunc_saved
1841 # Return 1 if the target plus current options supports a vector
1842 # promotion (unpacking) of chars (to shorts) and shorts (to ints), 0 otherwise.
1844 # This won't change for different subtargets so cache the result.
1846 proc check_effective_target_vect_unpack { } {
1847 global et_vect_unpack
1849 if [info exists et_vect_unpack_saved] {
1850 verbose "check_effective_target_vect_unpack: using cached result" 2
1852 set et_vect_unpack_saved 0
1853 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*paired*])
1854 || [istarget i?86-*-*]
1855 || [istarget x86_64-*-*]
1856 || [istarget spu-*-*] } {
1857 set et_vect_unpack_saved 1
1860 verbose "check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
1861 return $et_vect_unpack_saved
1864 # Return 1 if the target plus current options does not guarantee
1865 # that its STACK_BOUNDARY is >= the reguired vector alignment.
1867 # This won't change for different subtargets so cache the result.
1869 proc check_effective_target_unaligned_stack { } {
1870 global et_unaligned_stack_saved
1872 if [info exists et_unaligned_stack_saved] {
1873 verbose "check_effective_target_unaligned_stack: using cached result" 2
1875 set et_unaligned_stack_saved 0
1877 verbose "check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
1878 return $et_unaligned_stack_saved
1881 # Return 1 if the target plus current options does not support a vector
1882 # alignment mechanism, 0 otherwise.
1884 # This won't change for different subtargets so cache the result.
1886 proc check_effective_target_vect_no_align { } {
1887 global et_vect_no_align_saved
1889 if [info exists et_vect_no_align_saved] {
1890 verbose "check_effective_target_vect_no_align: using cached result" 2
1892 set et_vect_no_align_saved 0
1893 if { [istarget mipsisa64*-*-*]
1894 || [istarget sparc*-*-*]
1895 || [istarget ia64-*-*]
1896 || [check_effective_target_arm32] } {
1897 set et_vect_no_align_saved 1
1900 verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
1901 return $et_vect_no_align_saved
1904 # Return 1 if arrays are aligned to the vector alignment
1905 # boundary, 0 otherwise.
1907 # This won't change for different subtargets so cache the result.
1909 proc check_effective_target_vect_aligned_arrays { } {
1910 global et_vect_aligned_arrays
1912 if [info exists et_vect_aligned_arrays_saved] {
1913 verbose "check_effective_target_vect_aligned_arrays: using cached result" 2
1915 set et_vect_aligned_arrays_saved 0
1916 if { (([istarget x86_64-*-*]
1917 || [istarget i?86-*-*]) && [is-effective-target lp64])
1918 || [istarget spu-*-*] } {
1919 set et_vect_aligned_arrays_saved 1
1922 verbose "check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
1923 return $et_vect_aligned_arrays_saved
1926 # Return 1 if types of size 32 bit or less are naturally aligned
1927 # (aligned to their type-size), 0 otherwise.
1929 # This won't change for different subtargets so cache the result.
1931 proc check_effective_target_natural_alignment_32 { } {
1932 global et_natural_alignment_32
1934 if [info exists et_natural_alignment_32_saved] {
1935 verbose "check_effective_target_natural_alignment_32: using cached result" 2
1937 # FIXME: 32bit powerpc: guaranteed only if MASK_ALIGN_NATURAL/POWER.
1938 set et_natural_alignment_32_saved 1
1939 if { ([istarget *-*-darwin*] && [is-effective-target lp64]) } {
1940 set et_natural_alignment_32_saved 0
1943 verbose "check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
1944 return $et_natural_alignment_32_saved
1947 # Return 1 if types of size 64 bit or less are naturally aligned (aligned to their
1948 # type-size), 0 otherwise.
1950 # This won't change for different subtargets so cache the result.
1952 proc check_effective_target_natural_alignment_64 { } {
1953 global et_natural_alignment_64
1955 if [info exists et_natural_alignment_64_saved] {
1956 verbose "check_effective_target_natural_alignment_64: using cached result" 2
1958 set et_natural_alignment_64_saved 0
1959 if { ([is-effective-target lp64] && ![istarget *-*-darwin*])
1960 || [istarget spu-*-*] } {
1961 set et_natural_alignment_64_saved 1
1964 verbose "check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
1965 return $et_natural_alignment_64_saved
1968 # Return 1 if vector alignment (for types of size 32 bit or less) is reachable, 0 otherwise.
1970 # This won't change for different subtargets so cache the result.
1972 proc check_effective_target_vector_alignment_reachable { } {
1973 global et_vector_alignment_reachable
1975 if [info exists et_vector_alignment_reachable_saved] {
1976 verbose "check_effective_target_vector_alignment_reachable: using cached result" 2
1978 if { [check_effective_target_vect_aligned_arrays]
1979 || [check_effective_target_natural_alignment_32] } {
1980 set et_vector_alignment_reachable_saved 1
1982 set et_vector_alignment_reachable_saved 0
1985 verbose "check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
1986 return $et_vector_alignment_reachable_saved
1989 # Return 1 if vector alignment for 64 bit is reachable, 0 otherwise.
1991 # This won't change for different subtargets so cache the result.
1993 proc check_effective_target_vector_alignment_reachable_for_64bit { } {
1994 global et_vector_alignment_reachable_for_64bit
1996 if [info exists et_vector_alignment_reachable_for_64bit_saved] {
1997 verbose "check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
1999 if { [check_effective_target_vect_aligned_arrays]
2000 || [check_effective_target_natural_alignment_64] } {
2001 set et_vector_alignment_reachable_for_64bit_saved 1
2003 set et_vector_alignment_reachable_for_64bit_saved 0
2006 verbose "check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
2007 return $et_vector_alignment_reachable_for_64bit_saved
2010 # Return 1 if the target supports vector conditional operations, 0 otherwise.
2012 proc check_effective_target_vect_condition { } {
2013 global et_vect_cond_saved
2015 if [info exists et_vect_cond_saved] {
2016 verbose "check_effective_target_vect_cond: using cached result" 2
2018 set et_vect_cond_saved 0
2019 if { [istarget powerpc*-*-*]
2020 || [istarget ia64-*-*]
2021 || [istarget i?86-*-*]
2022 || [istarget spu-*-*]
2023 || [istarget x86_64-*-*] } {
2024 set et_vect_cond_saved 1
2028 verbose "check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
2029 return $et_vect_cond_saved
2032 # Return 1 if the target supports vector char multiplication, 0 otherwise.
2034 proc check_effective_target_vect_char_mult { } {
2035 global et_vect_char_mult_saved
2037 if [info exists et_vect_char_mult_saved] {
2038 verbose "check_effective_target_vect_char_mult: using cached result" 2
2040 set et_vect_char_mult_saved 0
2041 if { [istarget ia64-*-*]
2042 || [istarget i?86-*-*]
2043 || [istarget x86_64-*-*] } {
2044 set et_vect_char_mult_saved 1
2048 verbose "check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
2049 return $et_vect_char_mult_saved
2052 # Return 1 if the target supports vector short multiplication, 0 otherwise.
2054 proc check_effective_target_vect_short_mult { } {
2055 global et_vect_short_mult_saved
2057 if [info exists et_vect_short_mult_saved] {
2058 verbose "check_effective_target_vect_short_mult: using cached result" 2
2060 set et_vect_short_mult_saved 0
2061 if { [istarget ia64-*-*]
2062 || [istarget spu-*-*]
2063 || [istarget i?86-*-*]
2064 || [istarget x86_64-*-*] } {
2065 set et_vect_short_mult_saved 1
2069 verbose "check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
2070 return $et_vect_short_mult_saved
2073 # Return 1 if the target supports vector int multiplication, 0 otherwise.
2075 proc check_effective_target_vect_int_mult { } {
2076 global et_vect_int_mult_saved
2078 if [info exists et_vect_int_mult_saved] {
2079 verbose "check_effective_target_vect_int_mult: using cached result" 2
2081 set et_vect_int_mult_saved 0
2082 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
2083 || [istarget spu-*-*]
2084 || [istarget i?86-*-*]
2085 || [istarget x86_64-*-*]
2086 || [check_effective_target_arm32] } {
2087 set et_vect_int_mult_saved 1
2091 verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
2092 return $et_vect_int_mult_saved
2095 # Return 1 if the target supports vector even/odd elements extraction, 0 otherwise.
2097 proc check_effective_target_vect_extract_even_odd { } {
2098 global et_vect_extract_even_odd_saved
2100 if [info exists et_vect_extract_even_odd_saved] {
2101 verbose "check_effective_target_vect_extract_even_odd: using cached result" 2
2103 set et_vect_extract_even_odd_saved 0
2104 if { [istarget powerpc*-*-*] } {
2105 set et_vect_extract_even_odd_saved 1
2109 verbose "check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
2110 return $et_vect_extract_even_odd_saved
2113 # Return 1 if the target supports vector even/odd elements extraction of
2114 # vectors with SImode elements or larger, 0 otherwise.
2116 proc check_effective_target_vect_extract_even_odd_wide { } {
2117 global et_vect_extract_even_odd_wide_saved
2119 if [info exists et_vect_extract_even_odd_wide_saved] {
2120 verbose "check_effective_target_vect_extract_even_odd_wide: using cached result" 2
2122 set et_vect_extract_even_odd_wide_saved 0
2123 if { [istarget powerpc*-*-*]
2124 || [istarget i?86-*-*]
2125 || [istarget x86_64-*-*] } {
2126 set et_vect_extract_even_odd_wide_saved 1
2130 verbose "check_effective_target_vect_extract_even_wide_odd: returning $et_vect_extract_even_odd_wide_saved" 2
2131 return $et_vect_extract_even_odd_wide_saved
2134 # Return 1 if the target supports vector interleaving, 0 otherwise.
2136 proc check_effective_target_vect_interleave { } {
2137 global et_vect_interleave_saved
2139 if [info exists et_vect_interleave_saved] {
2140 verbose "check_effective_target_vect_interleave: using cached result" 2
2142 set et_vect_interleave_saved 0
2143 if { [istarget powerpc*-*-*]
2144 || [istarget i?86-*-*]
2145 || [istarget x86_64-*-*] } {
2146 set et_vect_interleave_saved 1
2150 verbose "check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
2151 return $et_vect_interleave_saved
2154 # Return 1 if the target supports vector interleaving and extract even/odd, 0 otherwise.
2155 proc check_effective_target_vect_strided { } {
2156 global et_vect_strided_saved
2158 if [info exists et_vect_strided_saved] {
2159 verbose "check_effective_target_vect_strided: using cached result" 2
2161 set et_vect_strided_saved 0
2162 if { [check_effective_target_vect_interleave]
2163 && [check_effective_target_vect_extract_even_odd] } {
2164 set et_vect_strided_saved 1
2168 verbose "check_effective_target_vect_strided: returning $et_vect_strided_saved" 2
2169 return $et_vect_strided_saved
2172 # Return 1 if the target supports vector interleaving and extract even/odd
2173 # for wide element types, 0 otherwise.
2174 proc check_effective_target_vect_strided_wide { } {
2175 global et_vect_strided_wide_saved
2177 if [info exists et_vect_strided_wide_saved] {
2178 verbose "check_effective_target_vect_strided_wide: using cached result" 2
2180 set et_vect_strided_wide_saved 0
2181 if { [check_effective_target_vect_interleave]
2182 && [check_effective_target_vect_extract_even_odd_wide] } {
2183 set et_vect_strided_wide_saved 1
2187 verbose "check_effective_target_vect_strided_wide: returning $et_vect_strided_wide_saved" 2
2188 return $et_vect_strided_wide_saved
2191 # Return 1 if the target supports section-anchors
2193 proc check_effective_target_section_anchors { } {
2194 global et_section_anchors_saved
2196 if [info exists et_section_anchors_saved] {
2197 verbose "check_effective_target_section_anchors: using cached result" 2
2199 set et_section_anchors_saved 0
2200 if { [istarget powerpc*-*-*] } {
2201 set et_section_anchors_saved 1
2205 verbose "check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
2206 return $et_section_anchors_saved
2209 # Return 1 if the target supports atomic operations on "int" and "long".
2211 proc check_effective_target_sync_int_long { } {
2212 global et_sync_int_long_saved
2214 if [info exists et_sync_int_long_saved] {
2215 verbose "check_effective_target_sync_int_long: using cached result" 2
2217 set et_sync_int_long_saved 0
2218 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
2219 # load-reserved/store-conditional instructions.
2220 if { [istarget ia64-*-*]
2221 || [istarget i?86-*-*]
2222 || [istarget x86_64-*-*]
2223 || [istarget alpha*-*-*]
2224 || [istarget s390*-*-*]
2225 || [istarget powerpc*-*-*]
2226 || [istarget sparc64-*-*]
2227 || [istarget sparcv9-*-*]
2228 || [istarget mips*-*-*] } {
2229 set et_sync_int_long_saved 1
2233 verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
2234 return $et_sync_int_long_saved
2237 # Return 1 if the target supports atomic operations on "char" and "short".
2239 proc check_effective_target_sync_char_short { } {
2240 global et_sync_char_short_saved
2242 if [info exists et_sync_char_short_saved] {
2243 verbose "check_effective_target_sync_char_short: using cached result" 2
2245 set et_sync_char_short_saved 0
2246 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
2247 # load-reserved/store-conditional instructions.
2248 if { [istarget ia64-*-*]
2249 || [istarget i?86-*-*]
2250 || [istarget x86_64-*-*]
2251 || [istarget alpha*-*-*]
2252 || [istarget s390*-*-*]
2253 || [istarget powerpc*-*-*]
2254 || [istarget sparc64-*-*]
2255 || [istarget sparcv9-*-*]
2256 || [istarget mips*-*-*] } {
2257 set et_sync_char_short_saved 1
2261 verbose "check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
2262 return $et_sync_char_short_saved
2265 # Return 1 if the target uses a ColdFire FPU.
2267 proc check_effective_target_coldfire_fpu { } {
2268 return [check_no_compiler_messages coldfire_fpu assembly {
2275 # Return true if this is a uClibc target.
2277 proc check_effective_target_uclibc {} {
2278 return [check_no_compiler_messages uclibc object {
2279 #include <features.h>
2280 #if !defined (__UCLIBC__)
2286 # Return true if this is a uclibc target and if the uclibc feature
2287 # described by __$feature__ is not present.
2289 proc check_missing_uclibc_feature {feature} {
2290 return [check_no_compiler_messages $feature object "
2291 #include <features.h>
2292 #if !defined (__UCLIBC) || defined (__${feature}__)
2298 # Return true if this is a Newlib target.
2300 proc check_effective_target_newlib {} {
2301 return [check_no_compiler_messages newlib object {
2307 # (a) an error of a few ULP is expected in string to floating-point
2308 # conversion functions; and
2309 # (b) overflow is not always detected correctly by those functions.
2311 proc check_effective_target_lax_strtofp {} {
2312 # By default, assume that all uClibc targets suffer from this.
2313 return [check_effective_target_uclibc]
2316 # Return 1 if this is a target for which wcsftime is a dummy
2317 # function that always returns 0.
2319 proc check_effective_target_dummy_wcsftime {} {
2320 # By default, assume that all uClibc targets suffer from this.
2321 return [check_effective_target_uclibc]
2324 # Return 1 if constructors with initialization priority arguments are
2325 # supposed on this target.
2327 proc check_effective_target_init_priority {} {
2328 return [check_no_compiler_messages init_priority assembly "
2329 void f() __attribute__((constructor (1000)));
2334 # Return 1 if the target matches the effective target 'arg', 0 otherwise.
2335 # This can be used with any check_* proc that takes no argument and
2336 # returns only 1 or 0. It could be used with check_* procs that take
2337 # arguments with keywords that pass particular arguments.
2339 proc is-effective-target { arg } {
2341 if { [info procs check_effective_target_${arg}] != [list] } {
2342 set selected [check_effective_target_${arg}]
2345 "vmx_hw" { set selected [check_vmx_hw_available] }
2346 "named_sections" { set selected [check_named_sections_available] }
2347 "gc_sections" { set selected [check_gc_sections_available] }
2348 "cxa_atexit" { set selected [check_cxa_atexit_available] }
2349 default { error "unknown effective target keyword `$arg'" }
2352 verbose "is-effective-target: $arg $selected" 2
2356 # Return 1 if the argument is an effective-target keyword, 0 otherwise.
2358 proc is-effective-target-keyword { arg } {
2359 if { [info procs check_effective_target_${arg}] != [list] } {
2362 # These have different names for their check_* procs.
2364 "vmx_hw" { return 1 }
2365 "named_sections" { return 1 }
2366 "gc_sections" { return 1 }
2367 "cxa_atexit" { return 1 }
2368 default { return 0 }
2373 # Return 1 if target default to short enums
2375 proc check_effective_target_short_enums { } {
2376 return [check_no_compiler_messages short_enums assembly {
2378 int s[sizeof (enum foo) == 1 ? 1 : -1];
2382 # Return 1 if target supports merging string constants at link time.
2384 proc check_effective_target_string_merging { } {
2385 return [check_no_messages_and_pattern string_merging \
2386 "rodata\\.str" assembly {
2387 const char *var = "String";
2391 # Return 1 if target has the basic signed and unsigned types in
2392 # <stdint.h>, 0 otherwise.
2394 proc check_effective_target_stdint_types { } {
2395 return [check_no_compiler_messages stdint_types assembly {
2397 int8_t a; int16_t b; int32_t c; int64_t d;
2398 uint8_t e; uint16_t f; uint32_t g; uint64_t h;
2402 # Return 1 if programs are intended to be run on a simulator
2403 # (i.e. slowly) rather than hardware (i.e. fast).
2405 proc check_effective_target_simulator { } {
2407 # All "src/sim" simulators set this one.
2408 if [board_info target exists is_simulator] {
2409 return [board_info target is_simulator]
2412 # The "sid" simulators don't set that one, but at least they set
2414 if [board_info target exists slow_simulator] {
2415 return [board_info target slow_simulator]
2421 # Return 1 if the target is a VxWorks kernel.
2423 proc check_effective_target_vxworks_kernel { } {
2424 return [check_no_compiler_messages vxworks_kernel assembly {
2425 #if !defined __vxworks || defined __RTP__
2431 # Return 1 if the target is a VxWorks RTP.
2433 proc check_effective_target_vxworks_rtp { } {
2434 return [check_no_compiler_messages vxworks_rtp assembly {
2435 #if !defined __vxworks || !defined __RTP__
2441 # Return 1 if the target is expected to provide wide character support.
2443 proc check_effective_target_wchar { } {
2444 if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR]} {
2447 return [check_no_compiler_messages wchar assembly {
2452 # Return 1 if the target has <pthread.h>.
2454 proc check_effective_target_pthread_h { } {
2455 return [check_no_compiler_messages pthread_h assembly {
2456 #include <pthread.h>
2460 # Return 1 if the target can truncate a file from a file-descriptor,
2461 # as used by libgfortran/io/unix.c:fd_truncate; i.e. ftruncate or
2462 # chsize. We test for a trivially functional truncation; no stubs.
2463 # As libgfortran uses _FILE_OFFSET_BITS 64, we do too; it'll cause a
2464 # different function to be used.
2466 proc check_effective_target_fd_truncate { } {
2468 #define _FILE_OFFSET_BITS 64
2474 FILE *f = fopen ("tst.tmp", "wb");
2476 const char t[] = "test writing more than ten characters";
2479 write (fd, t, sizeof (t) - 1);
2481 if (ftruncate (fd, 10) != 0)
2484 f = fopen ("tst.tmp", "rb");
2485 if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0)
2491 if { [check_runtime ftruncate $prog] } {
2495 regsub "ftruncate" $prog "chsize" prog
2496 return [check_runtime chsize $prog]
2499 # Add to FLAGS all the target-specific flags needed to access the c99 runtime.
2501 proc add_options_for_c99_runtime { flags } {
2502 if { [istarget *-*-solaris2*] } {
2503 return "$flags -std=c99"
2505 if { [istarget powerpc-*-darwin*] } {
2506 return "$flags -mmacosx-version-min=10.3"
2511 # Return 1 if the target provides a full C99 runtime.
2513 proc check_effective_target_c99_runtime { } {
2514 return [check_cached_effective_target c99_runtime {
2517 set file [open "$srcdir/gcc.dg/builtins-config.h"]
2518 set contents [read $file]
2521 #ifndef HAVE_C99_RUNTIME
2525 check_no_compiler_messages_nocache c99_runtime assembly \
2526 $contents [add_options_for_c99_runtime ""]
2530 # Return 1 if target wchar_t is at least 4 bytes.
2532 proc check_effective_target_4byte_wchar_t { } {
2533 return [check_no_compiler_messages 4byte_wchar_t object {
2534 int dummy[sizeof (__WCHAR_TYPE__) >= 4 ? 1 : -1];
2538 # Return 1 if the target supports automatic stack alignment.
2540 proc check_effective_target_automatic_stack_alignment { } {
2541 if { [istarget i?86*-*-*]
2542 || [istarget x86_64-*-*] } then {