📄 target-supports.exp
字号:
# Now examine the cache variable. if {![info exists profiling_available_saved]} { # Some targets don't have any implementation of __bb_init_func or are # missing other needed machinery. if { [istarget mmix-*-*] || [istarget arm*-*-eabi*] || [istarget arm*-*-elf] || [istarget arm*-*-symbianelf*] || [istarget bfin-*-*] || [istarget powerpc-*-eabi*] || [istarget strongarm*-*-elf] || [istarget xscale*-*-elf] || [istarget cris-*-*] || [istarget crisv32-*-*] || [istarget fido-*-elf] || [istarget h8300-*-*] || [istarget m32c-*-elf] || [istarget m68k-*-elf] || [istarget m68k-*-uclinux*] || [istarget mips*-*-elf*] || [istarget xstormy16-*] || [istarget xtensa-*-elf] || [istarget *-*-vxworks*] || [istarget *-*-windiss] } { set profiling_available_saved 0 } else { set profiling_available_saved 1 } } return $profiling_available_saved}# Return 1 if target has packed layout of structure members by# default, 0 otherwise. Note that this is slightly different than# whether the target has "natural alignment": both attributes may be# false.proc check_effective_target_default_packed { } { return [check_no_compiler_messages default_packed assembly { struct x { char a; long b; } c; int s[sizeof (c) == sizeof (char) + sizeof (long) ? 1 : -1]; }]}# Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See# documentation, where the test also comes from.proc check_effective_target_pcc_bitfield_type_matters { } { # PCC_BITFIELD_TYPE_MATTERS isn't just about unnamed or empty # bitfields, but let's stick to the example code from the docs. return [check_no_compiler_messages pcc_bitfield_type_matters assembly { struct foo1 { char x; char :0; char y; }; struct foo2 { char x; int :0; char y; }; int s[sizeof (struct foo1) != sizeof (struct foo2) ? 1 : -1]; }]}# Return 1 if thread local storage (TLS) is supported, 0 otherwise.## This won't change for different subtargets so cache the result.proc check_effective_target_tls {} { return [check_no_compiler_messages tls assembly { __thread int i; int f (void) { return i; } void g (int j) { i = j; } }]}# Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.## This won't change for different subtargets so cache the result.proc check_effective_target_tls_native {} { return [check_no_messages_and_pattern tls_native "!emutls" assembly { __thread int i; int f (void) { return i; } void g (int j) { i = j; } }]}# Return 1 if TLS executables can run correctly, 0 otherwise.## This won't change for different subtargets so cache the result.proc check_effective_target_tls_runtime {} { return [check_runtime tls_runtime { __thread int thr = 0; int main (void) { return thr; } }]}# Return 1 if compilation with -fopenmp is error-free for trivial# code, 0 otherwise.proc check_effective_target_fopenmp {} { return [check_no_compiler_messages fopenmp object { void foo (void) { } } "-fopenmp"]}# Return 1 if compilation with -pthread is error-free for trivial# code, 0 otherwise.proc check_effective_target_pthread {} { return [check_no_compiler_messages pthread object { void foo (void) { } } "-pthread"]}# Return 1 if the target supports -fstack-protectorproc check_effective_target_fstack_protector {} { return [check_runtime fstack_protector { int main (void) { return 0; } } "-fstack-protector"]}# Return 1 if compilation with -freorder-blocks-and-partition is error-free# for trivial code, 0 otherwise.proc check_effective_target_freorder {} { return [check_no_compiler_messages freorder object { void foo (void) { } } "-freorder-blocks-and-partition"]}# Return 1 if -fpic and -fPIC are supported, as in no warnings or errors# emitted, 0 otherwise. Whether a shared library can actually be built is# out of scope for this test.proc check_effective_target_fpic { } { # Note that M68K has a multilib that supports -fpic but not # -fPIC, so we need to check both. We test with a program that # requires GOT references. foreach arg {fpic fPIC} { if [check_no_compiler_messages $arg object { extern int foo (void); extern int bar; int baz (void) { return foo () + bar; } } "-$arg"] { return 1 } } return 0}# Return true if the target supports -mpaired-single (as used on MIPS).proc check_effective_target_mpaired_single { } { return [check_no_compiler_messages mpaired_single object { void foo (void) { } } "-mpaired-single"]}# Return true if the target has access to FPU instructions.proc check_effective_target_hard_float { } { if { [istarget mips*-*-*] } { return [check_no_compiler_messages hard_float assembly { #if (defined __mips_soft_float || defined __mips16) #error FOO #endif }] } # The generic test equates hard_float with "no call for adding doubles". return [check_no_messages_and_pattern hard_float "!\\(call" rtl-expand { double a (double b, double c) { return b + c; } }]}# Return true if the target is a 64-bit MIPS target.proc check_effective_target_mips64 { } { return [check_no_compiler_messages mips64 assembly { #ifndef __mips64 #error FOO #endif }]}# Return true if the target is a MIPS target that does not produce# MIPS16 code.proc check_effective_target_nomips16 { } { return [check_no_compiler_messages nomips16 object { #ifndef __mips #error FOO #else /* A cheap way of testing for -mflip-mips16. */ void foo (void) { asm ("addiu $20,$20,1"); } void bar (void) { asm ("addiu $20,$20,1"); } #endif }]}# Add the options needed for MIPS16 function attributes. At the moment,# we don't support MIPS16 PIC.proc add_options_for_mips16_attribute { flags } { return "$flags -mno-abicalls -fno-pic"}# Return true if we can force a mode that allows MIPS16 code generation.# We don't support MIPS16 PIC, and only support MIPS16 -mhard-float# for o32 and o64.proc check_effective_target_mips16_attribute { } { return [check_no_compiler_messages mips16_attribute assembly { #ifdef PIC #error FOO #endif #if defined __mips_hard_float \ && (!defined _ABIO32 || _MIPS_SIM != _ABIO32) \ && (!defined _ABIO64 || _MIPS_SIM != _ABIO64) #error FOO #endif } [add_options_for_mips16_attribute ""]]}# Return 1 if the current multilib does not generate PIC by default.proc check_effective_target_nonpic { } { return [check_no_compiler_messages nonpic assembly { #if __PIC__ #error FOO #endif }]}# Return 1 if the target does not use a status wrapper.proc check_effective_target_unwrapped { } { if { [target_info needs_status_wrapper] != "" \ && [target_info needs_status_wrapper] != "0" } { return 0 } return 1}# Return true if iconv is supported on the target. In particular IBM1047.proc check_iconv_available { test_what } { global libiconv # If the tool configuration file has not set libiconv, try "-liconv" if { ![info exists libiconv] } { set libiconv "-liconv" } set test_what [lindex $test_what 1] return [check_runtime_nocache $test_what [subst { #include <iconv.h> int main (void) { iconv_t cd; cd = iconv_open ("$test_what", "UTF-8"); if (cd == (iconv_t) -1) return 1; return 0; } }] $libiconv]}# Return true if named sections are supported on this target.proc check_named_sections_available { } { return [check_no_compiler_messages named_sections assembly { int __attribute__ ((section("whatever"))) foo; }]}# Return 1 if the target supports Fortran real kinds larger than real(8),# 0 otherwise.## When the target name changes, replace the cached result.proc check_effective_target_fortran_large_real { } { return [check_no_compiler_messages fortran_large_real executable { ! Fortran integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1) real(kind=k) :: x x = cos (x) end }]}# Return 1 if the target supports Fortran integer kinds larger than# integer(8), 0 otherwise.## When the target name changes, replace the cached result.proc check_effective_target_fortran_large_int { } { return [check_no_compiler_messages fortran_large_int executable { ! Fortran integer,parameter :: k = selected_int_kind (range (0_8) + 1) integer(kind=k) :: i end }]}# Return 1 if we can statically link libgfortran, 0 otherwise.## When the target name changes, replace the cached result.proc check_effective_target_static_libgfortran { } { return [check_no_compiler_messages static_libgfortran executable { ! Fortran print *, 'test' end } "-static"]}# Return 1 if the target supports executing 750CL paired-single instructions, 0# otherwise. Cache the result.proc check_750cl_hw_available { } { return [check_cached_effective_target 750cl_hw_available { # If this is not the right target then we can skip the test. if { ![istarget powerpc-*paired*] } { expr 0 } else { check_runtime_nocache 750cl_hw_available { int main() { #ifdef __MACH__ asm volatile ("ps_mul v0,v0,v0"); #else asm volatile ("ps_mul 0,0,0"); #endif return 0; } } "-mpaired" } }]}# Return 1 if the target supports executing SSE2 instructions, 0# otherwise. Cache the result.proc check_sse2_hw_available { } { return [check_cached_effective_target sse2_hw_available { # If this is not the right target then we can skip the test. if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } { expr 0 } else { check_runtime_nocache sse2_hw_available { #include "cpuid.h" int main () { unsigned int eax, ebx, ecx, edx = 0; if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)) return !(edx & bit_SSE2); return 1; } } "" } }]}# Return 1 if the target supports executing AltiVec instructions, 0# otherwise. Cache the result.proc check_vmx_hw_available { } { return [check_cached_effective_target vmx_hw_available { # Some simulators are known to not support VMX instructions. if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } { expr 0 } else { # Most targets don't require special flags for this test case, but # Darwin does. if { [istarget *-*-darwin*] || [istarget *-*-aix*] } { set options "-maltivec" } else { set options "" } check_runtime_nocache vmx_hw_available { int main() { #ifdef __MACH__ asm volatile ("vor v0,v0,v0"); #else asm volatile ("vor 0,0,0"); #endif return 0; } } $options } }]}# GCC 3.4.0 for powerpc64-*-linux* included an ABI fix for passing# complex float arguments. This affects gfortran tests that call cabsf# in libm built by an earlier compiler. Return 1 if libm uses the same# argument passing as the compiler under test, 0 otherwise.## When the target name changes, replace the cached result.proc check_effective_target_broken_cplxf_arg { } { return [check_cached_effective_target broken_cplxf_arg { # Skip the work for targets known not to be affected. if { ![istarget powerpc64-*-linux*] } { expr 0 } elseif { ![is-effective-target lp64] } { expr 0 } else { check_runtime_nocache broken_cplxf_arg { #include <complex.h> extern void abort (void); float fabsf (float); float cabsf (_Complex float); int main () { _Complex float cf; float f; cf = 3 + 4.0fi; f = cabsf (cf); if (fabsf (f - 5.0) > 0.0001) abort (); return 0; } } "-lm" } }]}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -