-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2015 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
}
if { [istarget avr-*-*]
|| [istarget msp430-*-*]
+ || [istarget nvptx-*-*]
|| [istarget hppa2.0w-hp-hpux11.23]
|| [istarget hppa64-hp-hpux11.23] } {
return 0;
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 aarch64*-*-elf]
+ if {[istarget aarch64*-*-elf]
|| [istarget am3*-*-linux*]
|| [istarget arm*-*-eabi*]
|| [istarget arm*-*-elf]
|| [istarget msp430-*-*]
|| [istarget nds32*-*-elf]
|| [istarget nios2-*-elf]
- || [istarget picochip-*-*]
+ || [istarget nvptx-*-*]
|| [istarget powerpc-*-eabi*]
|| [istarget powerpc-*-elf]
|| [istarget rx-*-*]
# in Section 4 of C99 standard. Effectively, it is a target which supports no
# extra headers or libraries other than what is considered essential.
proc check_effective_target_freestanding { } {
- if { [istarget picochip-*-*] } then {
- return 1
- } else {
- return 0
- }
+ return 0
}
# Return 1 if target has packed layout of structure members by
# libthread, so always pass -pthread for native TLS. Same for AIX.
# Need to duplicate native TLS check from
# check_effective_target_tls_native to avoid recursion.
- if { ([istarget *-*-solaris2.9*] || [istarget powerpc-ibm-aix*]) &&
+ if { ([istarget powerpc-ibm-aix*]) &&
[check_no_messages_and_pattern tls_native "!emutls" assembly {
__thread int i;
int f (void) { return i; }
void g (int j) { i = j; }
}] } {
- return "$flags -pthread"
+ return "-pthread [g++_link_flags [get_multilibs "-pthread"] ] $flags "
}
return $flags
}
+# Return 1 if indirect jumps are supported, 0 otherwise.
+
+proc check_effective_target_indirect_jumps {} {
+ if { [istarget nvptx-*-*] } {
+ return 0
+ }
+ return 1
+}
+
+# Return 1 if nonlocal goto is supported, 0 otherwise.
+
+proc check_effective_target_nonlocal_goto {} {
+ if { [istarget nvptx-*-*] } {
+ return 0
+ }
+ return 1
+}
+
+# Return 1 if taking label values is supported, 0 otherwise.
+
+proc check_effective_target_label_values {} {
+ if { [istarget nvptx-*-*] } {
+ return 0
+ }
+ return [check_no_compiler_messages label_values assembly {
+ #ifdef NO_LABEL_VALUES
+ #error NO
+ #endif
+ }]
+}
+
+# Return 1 if builtin_return_address and builtin_frame_address are
+# supported, 0 otherwise.
+
+proc check_effective_target_return_address {} {
+ if { [istarget nvptx-*-*] } {
+ return 0
+ }
+ return 1
+}
+
+# Return 1 if the assembler does not verify function types against
+# calls, 0 otherwise. Such verification will typically show up problems
+# with K&R C function declarations.
+
+proc check_effective_target_untyped_assembly {} {
+ if { [istarget nvptx-*-*] } {
+ return 0
+ }
+ return 1
+}
+
+# Return 1 if alloca is supported, 0 otherwise.
+
+proc check_effective_target_alloca {} {
+ if { [istarget nvptx-*-*] } {
+ return 0
+ }
+ return 1
+}
+
# Return 1 if thread local storage (TLS) is supported, 0 otherwise.
proc check_effective_target_tls {} {
# Return 1 if trapping arithmetic is available, 0 otherwise.
proc check_effective_target_trapping {} {
- return [check_no_compiler_messages scheduling object {
- add (int a, int b) { return a + b; }
+ return [check_no_compiler_messages trapping object {
+ int add (int a, int b) { return a + b; }
} "-ftrapv"]
}
# Return 1 if the target supports dlopen, 0 otherwise.
proc check_effective_target_dlopen {} {
- return [check_function_available "dlopen"]
+ return [check_no_compiler_messages dlopen executable {
+ #include <dlfcn.h>
+ int main(void) { dlopen ("dummy.so", RTLD_NOW); }
+ } [add_options_for_dlopen ""]]
+}
+
+proc add_options_for_dlopen { flags } {
+ return "$flags -ldl"
}
# Return 1 if the target supports clone, 0 otherwise.
return 0
}
+# Return 1 if -shared is supported, as in no warnings or errors
+# emitted, 0 otherwise.
+
+proc check_effective_target_shared { } {
+ # 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.
+ return [check_no_compiler_messages shared executable {
+ extern int foo (void); extern int bar;
+ int baz (void) { return foo () + bar; }
+ } "-shared -fpic"]
+}
+
# Return 1 if -pie, -fpie and -fPIE are supported, 0 otherwise.
proc check_effective_target_pie { } {
if { [istarget mips*-*-*] } {
return [check_no_compiler_messages hard_float assembly {
#if (defined __mips_soft_float || defined __mips16)
- #error FOO
+ #error __mips_soft_float || __mips16
#endif
}]
}
return 0
# return [check_no_compiler_messages hard_float assembly {
#if defined __RX_64_BIT_DOUBLES__
- #error FOO
+ #error __RX_64_BIT_DOUBLES__
#endif
# }]
}
proc check_effective_target_mips64 { } {
return [check_no_compiler_messages mips64 assembly {
#ifndef __mips64
- #error FOO
+ #error !__mips64
#endif
}]
}
proc check_effective_target_nomips16 { } {
return [check_no_compiler_messages nomips16 object {
#ifndef __mips
- #error FOO
+ #error !__mips
#else
/* A cheap way of testing for -mflip-mips16. */
void foo (void) { asm ("addiu $20,$20,1"); }
proc check_effective_target_mips16_attribute { } {
return [check_no_compiler_messages mips16_attribute assembly {
#ifdef PIC
- #error FOO
+ #error PIC
#endif
#if defined __mips_hard_float \
&& (!defined _ABIO32 || _MIPS_SIM != _ABIO32) \
&& (!defined _ABIO64 || _MIPS_SIM != _ABIO64)
- #error FOO
+ #error __mips_hard_float && (!_ABIO32 || !_ABIO64)
#endif
} [add_options_for_mips16_attribute ""]]
}
# Otherwise assume LL/SC support for everything but MIPS I.
return [check_no_compiler_messages mips_llsc assembly {
#if __mips == 1
- #error FOO
+ #error __mips == 1
#endif
}]
}
return [check_no_compiler_messages mips_rel object {
#if (defined _ABIN32 && _MIPS_SIM == _ABIN32) \
|| (defined _ABI64 && _MIPS_SIM == _ABI64)
- #error FOO
+ #error _ABIN32 && (_ABIN32 || _ABI64)
#endif
}]
}
}
return [check_no_compiler_messages mips_eabi object {
#ifndef __mips_eabi
- #error FOO
+ #error !__mips_eabi
#endif
}]
}
proc check_effective_target_nonpic { } {
return [check_no_compiler_messages nonpic assembly {
#if __PIC__
- #error FOO
+ #error __PIC__
#endif
}]
}
# Return true if Cilk Library is supported on the target.
proc check_libcilkrts_available { } {
return [ check_no_compiler_messages_nocache libcilkrts_available executable {
+ #ifdef __cplusplus
+ extern "C"
+ #endif
+ int __cilkrts_set_param (const char *, const char *);
int main (void) {
- __cilkrts_set_param ("nworkers", "0");
- return 0;
+ int x = __cilkrts_set_param ("nworkers", "0");
+ return x;
}
} "-fcilkplus -lcilkrts" ]
}
}
+# Return 1 if the target supports Fortran's IEEE modules,
+# 0 otherwise.
+#
+# When the target name changes, replace the cached result.
+
+proc check_effective_target_fortran_ieee { flags } {
+ return [check_no_compiler_messages fortran_ieee executable {
+ ! Fortran
+ use, intrinsic :: ieee_features
+ end
+ } $flags ]
+}
+
+
# Return 1 if the target supports SQRT for the largest floating-point
# type. (Some targets lack the libm support for this FP type.)
# On most targets, this check effectively checks either whether sqrtl is
proc check_effective_target_ti_c67x { } {
return [check_no_compiler_messages ti_c67x assembly {
#if !defined(_TMS320C6700)
- #error FOO
+ #error !_TMS320C6700
#endif
}]
}
proc check_effective_target_ti_c64xp { } {
return [check_no_compiler_messages ti_c64xp assembly {
#if !defined(_TMS320C6400_PLUS)
- #error FOO
+ #error !_TMS320C6400_PLUS
#endif
}]
}
#ifdef __OBJC2__
int dummy[1];
#else
- #error
- #endif
+ #error !__OBJC2__
+ #endif
}]
}
#ifdef __NEXT_RUNTIME__
int dummy[1];
#else
- #error
- #endif
+ #error !__NEXT_RUNTIME__
+ #endif
}]
}
}
# Return 1 if we support 32-bit or larger array and structure sizes
-# using default options, 0 otherwise.
+# using default options, 0 otherwise. Avoid false positive on
+# targets with 20 or 24 bit address spaces.
proc check_effective_target_size32plus { } {
return [check_no_compiler_messages size32plus object {
- char dummy[65537];
+ char dummy[16777217L];
}]
}
}]
}
+# Return 1 if the target supports long double of 128 bits,
+# 0 otherwise.
+
+proc check_effective_target_longdouble128 { } {
+ return [check_no_compiler_messages longdouble128 object {
+ int dummy[sizeof(long double) == 16 ? 1 : -1];
+ }]
+}
+
# Return 1 if the target supports double of 64 bits,
# 0 otherwise.
}]
}
+# Return 1 if the target supports executing DFP hardware instructions,
+# 0 otherwise. Cache the result.
+
+proc check_dfp_hw_available { } {
+ return [check_cached_effective_target dfp_hw_available {
+ # For now, disable on Darwin
+ if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
+ expr 0
+ } else {
+ check_runtime_nocache dfp_hw_available {
+ volatile _Decimal64 r;
+ volatile _Decimal64 a = 4.0DD;
+ volatile _Decimal64 b = 2.0DD;
+ int main()
+ {
+ asm volatile ("dadd %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
+ asm volatile ("dsub %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
+ asm volatile ("dmul %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
+ asm volatile ("ddiv %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
+ return 0;
+ }
+ } "-mcpu=power6 -mhard-float"
+ }
+ }]
+}
+
# Return 1 if the target supports compiling and assembling UCN, 0 otherwise.
proc check_effective_target_ucn_nocache { } {
# -std=c99 is only valid for C
if [check_effective_target_c] {
set ucnopts "-std=c99"
+ } else {
+ set ucnopts ""
}
- append ucnopts " -fextended-identifiers"
verbose "check_effective_target_ucn_nocache: compiling source" 2
set ret [check_no_compiler_messages_nocache ucn object {
int \u00C0;
verbose "check_effective_target_vect_int: using cached result" 2
} else {
set et_vect_int_saved 0
- if { [istarget i?86-*-*]
+ if { [istarget i?86-*-*] || [istarget x86_64-*-*]
|| ([istarget powerpc*-*-*]
&& ![istarget powerpc-*-linux*paired*])
|| [istarget spu-*-*]
- || [istarget x86_64-*-*]
|| [istarget sparc*-*-*]
|| [istarget alpha*-*-*]
|| [istarget ia64-*-*]
verbose "check_effective_target_vect_intfloat_cvt: using cached result" 2
} else {
set et_vect_intfloat_cvt_saved 0
- if { [istarget i?86-*-*]
+ if { [istarget i?86-*-*] || [istarget x86_64-*-*]
|| ([istarget powerpc*-*-*]
&& ![istarget powerpc-*-linux*paired*])
- || [istarget x86_64-*-*]
|| ([istarget arm*-*-*]
&& [check_effective_target_arm_neon_ok])} {
set et_vect_intfloat_cvt_saved 1
verbose "check_effective_target_vect_uintfloat_cvt: using cached result" 2
} else {
set et_vect_uintfloat_cvt_saved 0
- if { [istarget i?86-*-*]
+ if { [istarget i?86-*-*] || [istarget x86_64-*-*]
|| ([istarget powerpc*-*-*]
&& ![istarget powerpc-*-linux*paired*])
- || [istarget x86_64-*-*]
|| [istarget aarch64*-*-*]
|| ([istarget arm*-*-*]
&& [check_effective_target_arm_neon_ok])} {
verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
} else {
set et_vect_floatint_cvt_saved 0
- if { [istarget i?86-*-*]
+ if { [istarget i?86-*-*] || [istarget x86_64-*-*]
|| ([istarget powerpc*-*-*]
&& ![istarget powerpc-*-linux*paired*])
- || [istarget x86_64-*-*]
|| ([istarget arm*-*-*]
&& [check_effective_target_arm_neon_ok])} {
set et_vect_floatint_cvt_saved 1
proc check_effective_target_aarch64_big_endian { } {
return [check_no_compiler_messages aarch64_big_endian assembly {
#if !defined(__aarch64__) || !defined(__AARCH64EB__)
- #error FOO
+ #error !__aarch64__ || !__AARCH64EB__
#endif
}]
}
}]
}
-# Return 1 is this is an arm target using 32-bit instructions
+# Return 1 if this is an arm target using 32-bit instructions
proc check_effective_target_arm32 { } {
return [check_no_compiler_messages arm32 assembly {
#if !defined(__arm__) || (defined(__thumb__) && !defined(__thumb2__))
- #error FOO
+ #error !__arm || __thumb__ && !__thumb2__
#endif
}]
}
-# Return 1 is this is an arm target not using Thumb
+# Return 1 if this is an arm target not using Thumb
proc check_effective_target_arm_nothumb { } {
return [check_no_compiler_messages arm_nothumb assembly {
- #if (defined(__thumb__) || defined(__thumb2__))
- #error FOO
+ #if !defined(__arm__) || (defined(__thumb__) || defined(__thumb2__))
+ #error !__arm__ || __thumb || __thumb2__
#endif
}]
}
proc check_effective_target_arm_little_endian { } {
return [check_no_compiler_messages arm_little_endian assembly {
#if !defined(__arm__) || !defined(__ARMEL__)
- #error FOO
+ #error !__arm__ || !__ARMEL__
#endif
}]
}
proc check_effective_target_arm_vect_no_misalign { } {
return [check_no_compiler_messages arm_vect_no_misalign assembly {
#if !defined(__arm__) \
- || (defined(__ARMEL__) \
- && (!defined(__thumb__) || defined(__thumb2__)))
- #error FOO
+ || (defined(__ARM_FEATURE_UNALIGNED) \
+ && defined(__ARMEL__))
+ #error !__arm__ || (__ARMEL__ && __ARM_FEATURE_UNALIGNED)
#endif
}]
}
}
}
+# Return 1 if this is an ARM target supporting -mfpu=vfp3
+# -mfloat-abi=softfp.
+
+proc check_effective_target_arm_vfp3_ok { } {
+ if { [check_effective_target_arm32] } {
+ return [check_no_compiler_messages arm_vfp3_ok object {
+ int dummy;
+ } "-mfpu=vfp3 -mfloat-abi=softfp"]
+ } else {
+ return 0
+ }
+}
+
# Return 1 if this is an ARM target supporting -mfpu=fp-armv8
# -mfloat-abi=softfp.
proc check_effective_target_arm_v8_vfp_ok {} {
}
# Return 1 if this is an ARM target supporting -mfpu=crypto-neon-fp-armv8
-# -mfloat-abi=softfp.
-proc check_effective_target_arm_crypto_ok {} {
+# -mfloat-abi=softfp or equivalent options. Some multilibs may be
+# incompatible with these options. Also set et_arm_crypto_flags to the
+# best options to add.
+
+proc check_effective_target_arm_crypto_ok_nocache { } {
+ global et_arm_crypto_flags
+ set et_arm_crypto_flags ""
if { [check_effective_target_arm32] } {
- return [check_no_compiler_messages arm_crypto_ok object {
- int foo (void)
- {
- __asm__ volatile ("aese.8 q0, q0");
- return 0;
- }
- } "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"]
- } else {
- return 0
+ foreach flags {"" "-mfloat-abi=softfp" "-mfpu=crypto-neon-fp-armv8" "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"} {
+ if { [check_no_compiler_messages_nocache arm_crypto_ok object {
+ #include "arm_neon.h"
+ uint8x16_t
+ foo (uint8x16_t a, uint8x16_t b)
+ {
+ return vaeseq_u8 (a, b);
+ }
+ } "$flags"] } {
+ set et_arm_crypto_flags $flags
+ return 1
+ }
+ }
}
+
+ return 0
+}
+
+# Return 1 if this is an ARM target supporting -mfpu=crypto-neon-fp-armv8
+
+proc check_effective_target_arm_crypto_ok { } {
+ return [check_cached_effective_target arm_crypto_ok \
+ check_effective_target_arm_crypto_ok_nocache]
}
# Add options for crypto extensions.
if { ! [check_effective_target_arm_crypto_ok] } {
return "$flags"
}
- return "$flags -mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"
+ global et_arm_crypto_flags
+ return "$flags $et_arm_crypto_flags"
}
# Add the options needed for NEON. We need either -mfloat-abi=softfp
return "$flags $et_arm_neonv2_flags"
}
+# Add the options needed for vfp3.
+proc add_options_for_arm_vfp3 { flags } {
+ if { ! [check_effective_target_arm_vfp3_ok] } {
+ return "$flags"
+ }
+ return "$flags -mfpu=vfp3 -mfloat-abi=softfp"
+}
+
# Return 1 if this is an ARM target supporting -mfpu=neon
# -mfloat-abi=softfp or equivalent options. Some multilibs may be
# incompatible with these options. Also set et_arm_neon_flags to the
if { [check_effective_target_arm32] } {
foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
if { [check_no_compiler_messages_nocache arm_v8_neon_ok object {
+ #if __ARM_ARCH < 8
+ #error not armv8 or later
+ #endif
#include "arm_neon.h"
void
foo ()
{
__asm__ volatile ("vrintn.f32 q0, q0");
}
- } "$flags"] } {
+ } "$flags -march=armv8-a"] } {
set et_arm_v8_neon_flags $flags
return 1
}
v6z "-march=armv6z" __ARM_ARCH_6Z__
v6m "-march=armv6-m -mthumb" __ARM_ARCH_6M__
v7a "-march=armv7-a" __ARM_ARCH_7A__
+ v7ve "-march=armv7ve" __ARM_ARCH_7A__
v7r "-march=armv7-r" __ARM_ARCH_7R__
v7m "-march=armv7-m -mthumb" __ARM_ARCH_7M__
v7em "-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
}
return [check_no_compiler_messages arm_arch_FUNC_ok assembly {
#if !defined (DEF)
- #error FOO
+ #error !DEF
#endif
} "FLAG" ]
}
proc check_effective_target_arm_arm_ok { } {
return [check_no_compiler_messages arm_arm_ok assembly {
#if !defined (__arm__) || defined (__thumb__) || defined (__thumb2__)
- #error FOO
+ #error !__arm__ || __thumb__ || __thumb2__
#endif
} "-marm"]
}
proc check_effective_target_arm_thumb1_ok { } {
return [check_no_compiler_messages arm_thumb1_ok assembly {
#if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__)
- #error FOO
+ #error !__arm__ || !__thumb__ || __thumb2__
#endif
+ int foo (int i) { return i; }
} "-mthumb"]
}
proc check_effective_target_arm_thumb2_ok { } {
return [check_no_compiler_messages arm_thumb2_ok assembly {
#if !defined(__thumb2__)
- #error FOO
+ #error !__thumb2__
#endif
+ int foo (int i) { return i; }
} "-mthumb"]
}
proc check_effective_target_arm_thumb1 { } {
return [check_no_compiler_messages arm_thumb1 assembly {
#if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__)
- #error not thumb1
+ #error !__arm__ || !__thumb__ || __thumb2__
#endif
int i;
} ""]
proc check_effective_target_arm_thumb2 { } {
return [check_no_compiler_messages arm_thumb2 assembly {
#if !defined(__thumb2__)
- #error FOO
+ #error !__thumb2__
#endif
int i;
} ""]
# Return 1 if this is an ARM cortex-M profile cpu
proc check_effective_target_arm_cortex_m { } {
+ if { ![istarget arm*-*-*] } {
+ return 0
+ }
return [check_no_compiler_messages arm_cortex_m assembly {
#if !defined(__ARM_ARCH_7M__) \
&& !defined (__ARM_ARCH_7EM__) \
&& !defined (__ARM_ARCH_6M__)
- #error FOO
+ #error !__ARM_ARCH_7M__ && !__ARM_ARCH_7EM__ && !__ARM_ARCH_6M__
#endif
int i;
} "-mthumb"]
proc check_effective_target_mips_loongson { } {
return [check_no_compiler_messages loongson assembly {
#if !defined(__mips_loongson_vector_rev)
- #error FOO
+ #error !__mips_loongson_vector_rev
#endif
}]
}
if { ([istarget powerpc*-*-*]
&& ![istarget powerpc-*-linux*paired*])
|| [istarget ia64-*-*]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget aarch64*-*-*]
|| [check_effective_target_arm32]
|| ([istarget mips*-*-*]
return $et_vect_shift_saved
}
+proc check_effective_target_whole_vector_shift { } {
+ if { [istarget i?86-*-*] || [istarget x86_64-*-*]
+ || [istarget ia64-*-*]
+ || [istarget aarch64*-*-*]
+ || ([check_effective_target_arm32]
+ && [check_effective_target_arm_little_endian])
+ || ([istarget mips*-*-*]
+ && [check_effective_target_mips_loongson]) } {
+ set answer 1
+ } else {
+ set answer 0
+ }
+
+ verbose "check_effective_target_vect_long: returning $answer" 2
+ return $answer
+}
+
+# Return 1 if the target supports vector bswap operations.
+
+proc check_effective_target_vect_bswap { } {
+ global et_vect_bswap_saved
+
+ if [info exists et_vect_bswap_saved] {
+ verbose "check_effective_target_vect_bswap: using cached result" 2
+ } else {
+ set et_vect_bswap_saved 0
+ if { [istarget aarch64*-*-*]
+ || ([istarget arm*-*-*]
+ && [check_effective_target_arm_neon])
+ } {
+ set et_vect_bswap_saved 1
+ }
+ }
+
+ verbose "check_effective_target_vect_bswap: returning $et_vect_bswap_saved" 2
+ return $et_vect_bswap_saved
+}
+
# Return 1 if the target supports hardware vector shift operation for char.
proc check_effective_target_vect_shift_char { } {
# This can change for different subtargets so do not cache the result.
proc check_effective_target_vect_long { } {
- if { [istarget i?86-*-*]
+ if { [istarget i?86-*-*] || [istarget x86_64-*-*]
|| (([istarget powerpc*-*-*]
&& ![istarget powerpc-*-linux*paired*])
&& [check_effective_target_ilp32])
- || [istarget x86_64-*-*]
|| [check_effective_target_arm32]
|| ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
set answer 1
verbose "check_effective_target_vect_float: using cached result" 2
} else {
set et_vect_float_saved 0
- if { [istarget i?86-*-*]
+ if { [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget powerpc*-*-*]
|| [istarget spu-*-*]
|| [istarget mips-sde-elf]
|| [istarget mipsisa64*-*-*]
- || [istarget x86_64-*-*]
|| [istarget ia64-*-*]
|| [istarget aarch64*-*-*]
|| [check_effective_target_arm32] } {
verbose "check_effective_target_vect_double: using cached result" 2
} else {
set et_vect_double_saved 0
- if { [istarget i?86-*-*]
- || [istarget aarch64*-*-*]
- || [istarget x86_64-*-*] } {
+ if { [istarget i?86-*-*] || [istarget x86_64-*-*]
+ || [istarget aarch64*-*-*] } {
if { [check_no_compiler_messages vect_double assembly {
#ifdef __tune_atom__
# error No double vectorizer support.
verbose "check_effective_target_vect_long_long: using cached result" 2
} else {
set et_vect_long_long_saved 0
- if { [istarget i?86-*-*]
- || [istarget x86_64-*-*] } {
+ if { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
set et_vect_long_long_saved 1
}
}
|| [istarget aarch64*-*-*]
|| [istarget powerpc*-*-*]
|| [istarget spu-*-*]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| ([istarget mips*-*-*]
&& [check_effective_target_mpaired_single]) } {
set et_vect_perm_saved 1
set et_vect_perm_byte_saved 0
if { ([is-effective-target arm_neon_ok]
&& [is-effective-target arm_little_endian])
- || [istarget aarch64*-*-*]
+ || ([istarget aarch64*-*-*]
+ && [is-effective-target aarch64_little_endian])
|| [istarget powerpc*-*-*]
|| [istarget spu-*-*] } {
set et_vect_perm_byte_saved 1
set et_vect_perm_short_saved 0
if { ([is-effective-target arm_neon_ok]
&& [is-effective-target arm_little_endian])
- || [istarget aarch64*-*-*]
+ || ([istarget aarch64*-*-*]
+ && [is-effective-target aarch64_little_endian])
|| [istarget powerpc*-*-*]
|| [istarget spu-*-*] } {
set et_vect_perm_short_saved 1
|| [istarget spu-*-*]
|| [istarget ia64-*-*]
|| [istarget aarch64*-*-*]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
set et_vect_widen_mult_hi_to_si_saved 1
}
if { [istarget powerpc*-*-*]
|| [istarget spu-*-*]
|| [istarget ia64-*-*]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| ([istarget arm*-*-*]
&& [check_effective_target_arm_neon_ok]
&& [check_effective_target_arm_little_endian]) } {
return $et_vect_widen_mult_hi_to_si_pattern_saved
}
+# Return 1 if the target plus current options supports a vector
+# widening multiplication of *int* args into *long* result, 0 otherwise.
+#
+# This won't change for different subtargets so cache the result.
+
+proc check_effective_target_vect_widen_mult_si_to_di_pattern { } {
+ global et_vect_widen_mult_si_to_di_pattern
+
+ if [info exists et_vect_widen_mult_si_to_di_pattern_saved] {
+ verbose "check_effective_target_vect_widen_mult_si_to_di_pattern: using cached result" 2
+ } else {
+ set et_vect_widen_mult_si_to_di_pattern_saved 0
+ if {[istarget ia64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*] } {
+ set et_vect_widen_mult_si_to_di_pattern_saved 1
+ }
+ }
+ verbose "check_effective_target_vect_widen_mult_si_to_di_pattern: returning $et_vect_widen_mult_si_to_di_pattern_saved" 2
+ return $et_vect_widen_mult_si_to_di_pattern_saved
+}
+
# Return 1 if the target plus current options supports a vector
# widening shift, 0 otherwise.
#
set et_vect_sdot_hi_saved 0
if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
|| [istarget ia64-*-*]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*] } {
+ || [istarget i?86-*-*] || [istarget x86_64-*-*] } {
set et_vect_sdot_hi_saved 1
}
}
return $et_vect_udot_hi_saved
}
+# Return 1 if the target plus current options supports a vector
+# sad operation of unsigned chars, 0 otherwise.
+#
+# This won't change for different subtargets so cache the result.
+
+proc check_effective_target_vect_usad_char { } {
+ global et_vect_usad_char
+
+ if [info exists et_vect_usad_char_saved] {
+ verbose "check_effective_target_vect_usad_char: using cached result" 2
+ } else {
+ set et_vect_usad_char_saved 0
+ if { ([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
+ set et_vect_usad_char_saved 1
+ }
+ }
+ verbose "check_effective_target_vect_usad_char: returning $et_vect_usad_char_saved" 2
+ return $et_vect_usad_char_saved
+}
# Return 1 if the target plus current options supports a vector
# demotion (packing) of shorts (to chars) and ints (to shorts)
} else {
set et_vect_pack_trunc_saved 0
if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget aarch64*-*-*]
|| [istarget spu-*-*]
|| ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
} else {
set et_vect_unpack_saved 0
if { ([istarget powerpc*-*-*] && ![istarget powerpc-*paired*])
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget spu-*-*]
|| [istarget ia64-*-*]
|| [istarget aarch64*-*-*]
verbose "check_effective_target_vect_hw_misalign: using cached result" 2
} else {
set et_vect_hw_misalign_saved 0
- if { ([istarget x86_64-*-*]
- || [istarget aarch64*-*-*]
- || [istarget i?86-*-*]) } {
+ if { [istarget i?86-*-*] || [istarget x86_64-*-*]
+ || [istarget aarch64*-*-*] } {
set et_vect_hw_misalign_saved 1
}
}
verbose "check_effective_target_vect_natural_alignment: using cached result" 2
} else {
set et_vect_natural_alignment_saved 1
- if { [check_effective_target_arm_eabi] } {
+ if { [check_effective_target_arm_eabi]
+ || [istarget nvptx-*-*] } {
set et_vect_natural_alignment_saved 0
}
}
if { [istarget aarch64*-*-*]
|| [istarget powerpc*-*-*]
|| [istarget ia64-*-*]
- || [istarget i?86-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget spu-*-*]
- || [istarget x86_64-*-*]
|| ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
set et_vect_cond_saved 1
}
verbose "check_effective_target_vect_cond_mixed: using cached result" 2
} else {
set et_vect_cond_mixed_saved 0
- if { [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ if { [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget powerpc*-*-*] } {
set et_vect_cond_mixed_saved 1
}
set et_vect_char_mult_saved 0
if { [istarget aarch64*-*-*]
|| [istarget ia64-*-*]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [check_effective_target_arm32] } {
set et_vect_char_mult_saved 1
}
set et_vect_short_mult_saved 0
if { [istarget ia64-*-*]
|| [istarget spu-*-*]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget powerpc*-*-*]
|| [istarget aarch64*-*-*]
|| [check_effective_target_arm32]
set et_vect_int_mult_saved 0
if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
|| [istarget spu-*-*]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget ia64-*-*]
|| [istarget aarch64*-*-*]
|| [check_effective_target_arm32] } {
if { [istarget aarch64*-*-*]
|| [istarget powerpc*-*-*]
|| [is-effective-target arm_neon_ok]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget ia64-*-*]
|| [istarget spu-*-*]
|| ([istarget mips*-*-*]
if { [istarget aarch64*-*-*]
|| [istarget powerpc*-*-*]
|| [is-effective-target arm_neon_ok]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget ia64-*-*]
|| [istarget spu-*-*]
|| ([istarget mips*-*-*]
verbose "check_effective_target_vect_call_copysignf: using cached result" 2
} else {
set et_vect_call_copysignf_saved 0
- if { [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ if { [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget powerpc*-*-*] } {
set et_vect_call_copysignf_saved 1
}
} else {
set et_vect_call_sqrtf_saved 0
if { [istarget aarch64*-*-*]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| ([istarget powerpc*-*-*] && [check_vsx_hw_available]) } {
set et_vect_call_sqrtf_saved 1
}
proc check_effective_target_vect_call_lrint { } {
set et_vect_call_lrint 0
- if { ([istarget i?86-*-*] || [istarget x86_64-*-*]) && [check_effective_target_ilp32] } {
+ if { ([istarget i?86-*-*] || [istarget x86_64-*-*])
+ && [check_effective_target_ilp32] } {
set et_vect_call_lrint 1
}
# Note: 32bit x86 targets require -march=pentium in dg-options.
proc check_effective_target_sync_long_long { } {
- if { [istarget x86_64-*-*]
- || [istarget i?86-*-*])
+ if { [istarget x86_64-*-*] || [istarget i?86-*-*])
|| [istarget aarch64*-*-*]
|| [istarget arm*-*-*]
|| [istarget alpha*-*-*]
# Note: 32bit x86 targets require -march=pentium in dg-options.
proc check_effective_target_sync_long_long_runtime { } {
- if { [istarget x86_64-*-*]
- || [istarget i?86-*-*] } {
+ if { [istarget x86_64-*-*] || [istarget i?86-*-*] } {
return [check_cached_effective_target sync_long_long_available {
check_runtime_nocache sync_long_long_available {
#include "cpuid.h"
}
}
+# Return 1 if the target supports byte swap instructions.
+
+proc check_effective_target_bswap { } {
+ global et_bswap_saved
+
+ if [info exists et_bswap_saved] {
+ verbose "check_effective_target_bswap: using cached result" 2
+ } else {
+ set et_bswap_saved 0
+ if { [istarget aarch64*-*-*]
+ || [istarget alpha*-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
+ || [istarget m68k-*-*]
+ || [istarget powerpc*-*-*]
+ || [istarget rs6000-*-*]
+ || [istarget s390*-*-*] } {
+ set et_bswap_saved 1
+ } else {
+ if { [istarget arm*-*-*]
+ && [check_no_compiler_messages_nocache arm_v6_or_later object {
+ #if __ARM_ARCH < 6
+ #error not armv6 or later
+ #endif
+ int i;
+ } ""] } {
+ set et_bswap_saved 1
+ }
+ }
+ }
+
+ verbose "check_effective_target_bswap: returning $et_bswap_saved" 2
+ return $et_bswap_saved
+}
+
+# Return 1 if the target supports 16-bit byte swap instructions.
+
+proc check_effective_target_bswap16 { } {
+ global et_bswap16_saved
+
+ if [info exists et_bswap16_saved] {
+ verbose "check_effective_target_bswap16: using cached result" 2
+ } else {
+ set et_bswap16_saved 0
+ if { [is-effective-target bswap]
+ && ![istarget alpha*-*-*]
+ && !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
+ set et_bswap16_saved 1
+ }
+ }
+
+ verbose "check_effective_target_bswap16: returning $et_bswap16_saved" 2
+ return $et_bswap16_saved
+}
+
+# Return 1 if the target supports 32-bit byte swap instructions.
+
+proc check_effective_target_bswap32 { } {
+ global et_bswap32_saved
+
+ if [info exists et_bswap32_saved] {
+ verbose "check_effective_target_bswap32: using cached result" 2
+ } else {
+ set et_bswap32_saved 0
+ if { [is-effective-target bswap] } {
+ set et_bswap32_saved 1
+ }
+ }
+
+ verbose "check_effective_target_bswap32: returning $et_bswap32_saved" 2
+ return $et_bswap32_saved
+}
+
+# Return 1 if the target supports 64-bit byte swap instructions.
+
+proc check_effective_target_bswap64 { } {
+ global et_bswap64_saved
+
+ if [info exists et_bswap64_saved] {
+ verbose "check_effective_target_bswap64: using cached result" 2
+ } else {
+ set et_bswap64_saved 0
+ if { [is-effective-target bswap]
+ && [is-effective-target lp64] } {
+ set et_bswap64_saved 1
+ }
+ }
+
+ verbose "check_effective_target_bswap64: returning $et_bswap64_saved" 2
+ return $et_bswap64_saved
+}
+
# Return 1 if the target supports atomic operations on "int" and "long".
proc check_effective_target_sync_int_long { } {
# This is intentionally powerpc but not rs6000, rs6000 doesn't have the
# load-reserved/store-conditional instructions.
if { [istarget ia64-*-*]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget aarch64*-*-*]
|| [istarget alpha*-*-*]
|| [istarget arm*-*-linux-*]
# load-reserved/store-conditional instructions.
if { [istarget aarch64*-*-*]
|| [istarget ia64-*-*]
- || [istarget i?86-*-*]
- || [istarget x86_64-*-*]
+ || [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget alpha*-*-*]
|| [istarget arm*-*-linux-*]
|| [istarget hppa*-*linux*]
proc check_effective_target_coldfire_fpu { } {
return [check_no_compiler_messages coldfire_fpu assembly {
#ifndef __mcffpu__
- #error FOO
+ #error !__mcffpu__
#endif
}]
}
return [check_no_compiler_messages uclibc object {
#include <features.h>
#if !defined (__UCLIBC__)
- #error FOO
+ #error !__UCLIBC__
#endif
}]
}
}]
}
+# Return true if this target has error.h header.
+
+proc check_effective_target_error_h {} {
+ return [check_no_compiler_messages error_h object {
+ #include <error.h>
+ }]
+}
+
+# Return true if this target has tgmath.h header.
+
+proc check_effective_target_tgmath_h {} {
+ return [check_no_compiler_messages tgmath_h object {
+ #include <tgmath.h>
+ }]
+}
+
+# Return true if target's libc supports complex functions.
+
+proc check_effective_target_libc_has_complex_functions {} {
+ return [check_no_compiler_messages libc_has_complex_functions object {
+ #include <complex.h>
+ }]
+}
+
# Return 1 if
# (a) an error of a few ULP is expected in string to floating-point
# conversion functions; and
"vsx_hw" { set selected [check_vsx_hw_available] }
"p8vector_hw" { set selected [check_p8vector_hw_available] }
"ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
+ "dfp_hw" { set selected [check_dfp_hw_available] }
"named_sections" { set selected [check_named_sections_available] }
"gc_sections" { set selected [check_gc_sections_available] }
"cxa_atexit" { set selected [check_cxa_atexit_available] }
"vsx_hw" { return 1 }
"p8vector_hw" { return 1 }
"ppc_recip_hw" { return 1 }
+ "dfp_hw" { return 1 }
"named_sections" { return 1 }
"gc_sections" { return 1 }
"cxa_atexit" { return 1 }
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
+ #include <string.h>
int main ()
{
FILE *f = fopen ("tst.tmp", "wb");
return $flags
}
+if {![info exists flags_to_postpone]} {
+ set flags_to_postpone ""
+}
+
# Add to FLAGS the flags needed to enable functions to bind locally
# when using pic/PIC passes in the testsuite.
-
proc add_options_for_bind_pic_locally { flags } {
+ global flags_to_postpone
+
+ # Instead of returning 'flags' with the -fPIE or -fpie appended, we save it
+ # in 'flags_to_postpone' and append it later in gcc_target_compile procedure in
+ # order to make sure that the multilib_flags doesn't override this.
+
if {[check_no_compiler_messages using_pic2 assembly {
#if __PIC__ != 2
- #error FOO
+ #error __PIC__ != 2
#endif
}]} {
- return "$flags -fPIE"
+ set flags_to_postpone "-fPIE"
+ return $flags
}
if {[check_no_compiler_messages using_pic1 assembly {
#if __PIC__ != 1
- #error FOO
+ #error __PIC__ != 1
#endif
}]} {
- return "$flags -fpie"
+ set flags_to_postpone "-fpie"
+ return $flags
}
-
return $flags
}
close $file
append contents {
#ifndef HAVE_C99_RUNTIME
- #error FOO
+ #error !HAVE_C99_RUNTIME
#endif
}
check_no_compiler_messages_nocache c99_runtime assembly \
# Return true if 32- and 16-bytes vectors are available.
proc check_effective_target_vect_sizes_32B_16B { } {
- return [check_avx_available];
+ if { [check_avx_available] && ![check_prefer_avx128] } {
+ return 1;
+ } else {
+ return 0;
+ }
}
# Return true if 128-bits vectors are preferred even if 256-bits vectors
# Return 1 if avx instructions can be compiled.
proc check_effective_target_avx { } {
+ if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
+ return 0
+ }
return [check_no_compiler_messages avx object {
void _mm256_zeroall (void)
{
proc check_effective_target_lto { } {
global ENABLE_LTO
+ if { [istarget nvptx-*-*] } {
+ return 0;
+ }
return [info exists ENABLE_LTO]
}
return 0
}
-# Check which language standard is active by checking for the presence of
-# one of the C++11 -std flags. This assumes that the default for the
-# compiler is C++98, and that there will never be multiple -std= arguments
-# on the command line.
-proc check_effective_target_c++11 { } {
+# Check whether the current active language standard supports the features
+# of C++11/C++14 by checking for the presence of one of the -std
+# flags. This assumes that the default for the compiler is C++98, and that
+# there will never be multiple -std= arguments on the command line.
+proc check_effective_target_c++11_only { } {
if ![check_effective_target_c++] {
return 0
}
return [check-flags { { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }]
}
+proc check_effective_target_c++11 { } {
+ if [check_effective_target_c++11_only] {
+ return 1
+ }
+ return [check_effective_target_c++14]
+}
+proc check_effective_target_c++11_down { } {
+ if ![check_effective_target_c++] {
+ return 0
+ }
+ return ![check_effective_target_c++14]
+}
-proc check_effective_target_c++1y { } {
+proc check_effective_target_c++14_only { } {
if ![check_effective_target_c++] {
return 0
}
- return [check-flags { { } { } { -std=c++1y -std=gnu++1y } }]
+ return [check-flags { { } { } { -std=c++14 -std=gnu++14 -std=c++14 -std=gnu++14 } }]
}
-proc check_effective_target_c++98 { } {
+proc check_effective_target_c++14 { } {
+ if [check_effective_target_c++14_only] {
+ return 1
+ }
+ return [check_effective_target_c++1z]
+}
+proc check_effective_target_c++14_down { } {
if ![check_effective_target_c++] {
return 0
}
- return [check-flags { { } { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 -std=c++1y -std=gnu++1y } }]
+ return ![check_effective_target_c++1z]
+}
+
+proc check_effective_target_c++98_only { } {
+ if ![check_effective_target_c++] {
+ return 0
+ }
+ return ![check_effective_target_c++11]
+}
+
+proc check_effective_target_c++1z_only { } {
+ if ![check_effective_target_c++] {
+ return 0
+ }
+ return [check-flags { { } { } { -std=c++1z -std=gnu++1z } }]
+}
+proc check_effective_target_c++1z { } {
+ return [check_effective_target_c++1z_only]
}
# Return 1 if expensive testcases should be run.
return [check_function_available "mempcpy"]
}
+# Returns 1 if "stpcpy" is available on the target system.
+
+proc check_effective_target_stpcpy {} {
+ return [check_function_available "stpcpy"]
+}
+
# Check whether the vectorizer tests are supported by the target and
# append additional target-dependent compile flags to DEFAULT_VECTCFLAGS.
# Set dg-do-what-default to either compile or run, depending on target
return 1
}
+# Return 1 if the target does *not* require strict alignment.
+
proc check_effective_target_non_strict_align {} {
return [check_no_compiler_messages non_strict_align assembly {
char *y;
else
abort ();
}
- } "-std=gnu99"]
+ } [add_options_for_ieee "-std=gnu99"]]
+}
+
+proc check_effective_target_tiny {} {
+ global et_target_tiny_saved
+
+ if [info exists et_target_tine_saved] {
+ verbose "check_effective_target_tiny: using cached result" 2
+ } else {
+ set et_target_tiny_saved 0
+ if { [istarget aarch64*-*-*]
+ && [check_effective_target_aarch64_tiny] } {
+ set et_target_tiny_saved 1
+ }
+ }
+
+ return $et_target_tiny_saved
+}
+
+# Return 1 if LOGICAL_OP_NON_SHORT_CIRCUIT is set to 0 for the current target.
+
+proc check_effective_target_logical_op_short_circuit {} {
+ if { [istarget mips*-*-*]
+ || [istarget arc*-*-*]
+ || [istarget avr*-*-*]
+ || [istarget crisv32-*-*] || [istarget cris-*-*]
+ || [istarget mmix-*-*]
+ || [istarget s390*-*-*]
+ || [istarget powerpc*-*-*]
+ || [istarget nios2*-*-*]
+ || [check_effective_target_arm_cortex_m] } {
+ return 1
+ }
+ return 0
+}
+
+# Record that dg-final test TEST requires convential compilation.
+
+proc force_conventional_output_for { test } {
+ if { [info proc $test] == "" } {
+ perror "$test does not exist"
+ exit 1
+ }
+ proc ${test}_required_options {} {
+ global gcc_force_conventional_output
+ return $gcc_force_conventional_output
+ }
+}
+
+# Return 1 if the x86-64 target supports PIE with copy reloc, 0
+# otherwise. Cache the result.
+
+proc check_effective_target_pie_copyreloc { } {
+ global pie_copyreloc_available_saved
+ global tool
+ global GCC_UNDER_TEST
+
+ if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
+ return 0
+ }
+
+ # Need auto-host.h to check linker support.
+ if { ![file exists ../../auto-host.h ] } {
+ return 0
+ }
+
+ if [info exists pie_copyreloc_available_saved] {
+ verbose "check_effective_target_pie_copyreloc returning saved $pie_copyreloc_available_saved" 2
+ } else {
+ # Set up and compile to see if linker supports PIE with copy
+ # reloc. Include the current process ID in the file names to
+ # prevent conflicts with invocations for multiple testsuites.
+
+ set src pie[pid].c
+ set obj pie[pid].o
+
+ set f [open $src "w"]
+ puts $f "#include \"../../auto-host.h\""
+ puts $f "#if HAVE_LD_PIE_COPYRELOC == 0"
+ puts $f "# error Linker does not support PIE with copy reloc."
+ puts $f "#endif"
+ close $f
+
+ verbose "check_effective_target_pie_copyreloc compiling testfile $src" 2
+ set lines [${tool}_target_compile $src $obj object ""]
+
+ file delete $src
+ file delete $obj
+
+ if [string match "" $lines] then {
+ verbose "check_effective_target_pie_copyreloc testfile compilation passed" 2
+ set pie_copyreloc_available_saved 1
+ } else {
+ verbose "check_effective_target_pie_copyreloc testfile compilation failed" 2
+ set pie_copyreloc_available_saved 0
+ }
+ }
+
+ return $pie_copyreloc_available_saved
}