[gcc r17-2652] testsuite: Don't use auto-host.h in target-supports.exp
Rainer Orth via Gcc-cvs <[email protected]>
| Newsgroups | gmane.comp.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://gcc.gnu.org/g:88e7db76cb1653fcc9a9fabe0925e7e04627fec9 commit r17-2652-g88e7db76cb1653fcc9a9fabe0925e7e04627fec9 Author: Rainer Orth <[email protected]> Date: Thu Jul 23 10:08:21 2026 +0200 testsuite: Don't use auto-host.h in target-supports.exp Several effective targets use a complicated dance to determine their values from auto-host.h. This prompted the et-static framework, which is now used to replace their implementations. Bootstrapped without regressions on i386-pc-solaris2.11 and x86_64-pc-linux-gnu. 2026-05-21 Rainer Orth <[email protected]> gcc/testsuite: * lib/et-static.def (code_6_gottpoff_reloc): New effective target. (fentry): Likewise. (got32x_reloc): Likewise. (pie_copyreloc): Likewise. (powerpc_as_p10_htm): Likewise. (tls_get_addr_via_got): Likewise. * lib/target-supports.exp (check_effective_target_pie_copyreloc): Remove. (check_effective_target_code_6_gottpoff_reloc): Likewise. (check_effective_target_got32x_reloc): Likwise. (check_effective_target_tls_get_addr_via_got): Likewise. (check_effective_target_powerpc_as_p10_htm): Likewise. (check_effective_target_fentry): Likewise. * gcc.target/i386/pr120881-2a.c: Restrict to 64-bit x86. Diff: --- gcc/testsuite/gcc.target/i386/pr120881-2a.c | 2 +- gcc/testsuite/lib/et-static.def | 24 +++ gcc/testsuite/lib/target-supports.exp | 277 ---------------------------- 3 files changed, 25 insertions(+), 278 deletions(-) diff --git a/gcc/testsuite/gcc.target/i386/pr120881-2a.c b/gcc/testsuite/gcc.target/i386/pr120881-2a.c index 760c39f8b801..56fe9992a1f3 100644 --- a/gcc/testsuite/gcc.target/i386/pr120881-2a.c +++ b/gcc/testsuite/gcc.target/i386/pr120881-2a.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target fentry } } */ +/* { dg-do compile { target { fentry && { x86 && lp64 } } } } */ /* { dg-options "-O2 -pg -fno-pie" } */ /* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ /* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ diff --git a/gcc/testsuite/lib/et-static.def b/gcc/testsuite/lib/et-static.def index 5f52670c0161..895e548bc87b 100644 --- a/gcc/testsuite/lib/et-static.def +++ b/gcc/testsuite/lib/et-static.def @@ -24,10 +24,30 @@ # Keep this sorted alphabetically by effective-target name. */ +code_6_gottpoff_reloc +HAVE_AS_R_X86_64_CODE_6_GOTTPOFF +assembler and linker support R_X86_64_CODE_6_GOTTPOFF + +fentry +ENABLE_X86_64_MFENTRY +-mfentry is enabled by default + +got32x_reloc +HAVE_AS_IX86_GOT32X +your assembler and linker support @GOT + ld_at_file HAVE_LD_AT_FILE your linker supports GNU style response files +pie_copyreloc +HAVE_LD_PIE_COPYRELOC +your linker supports -pie option with copy reloc + +powerpc_as_p10_htm +HAVE_AS_POWER10_HTM +your assembler supports htm insns on power10 + solaris_as HAVE_SOLARIS_AS using the Solaris assembler @@ -35,3 +55,7 @@ using the Solaris assembler solaris_ld HAVE_SOLARIS_LD using the Solaris linker + +tls_get_addr_via_got +HAVE_AS_IX86_TLS_GET_ADDR_GOT +your assembler and linker support calling ___tls_get_addr via GOT diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 726a8444f3a3..38107ee7b185 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -13348,195 +13348,6 @@ proc scan-ltrans-tree-dump-dem-not_required_options {} { return "-flto-partition=one" } -# Return 1 if the x86-64 target supports PIE with copy reloc, 0 -# otherwise. Cache the result. - -proc check_effective_target_pie_copyreloc { } { - global tool - global GCC_UNDER_TEST - - if { ![check_effective_target_x86] } { - return 0 - } - - # Need auto-host.h to check linker support. - if { ![file exists ../../auto-host.h ] } { - return 0 - } - - return [check_cached_effective_target pie_copyreloc { - # 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 - return 1 - } else { - verbose "check_effective_target_pie_copyreloc testfile compilation failed" 2 - return 0 - } - }] -} - -# Return 1 if the x86-64 target supports R_X86_64_CODE_6_GOTTPOFF -# relocation, 0 otherwise. Cache the result. - -proc check_effective_target_code_6_gottpoff_reloc { } { - global tool - global GCC_UNDER_TEST - - if { ![check_effective_target_x86] } { - return 0 - } - - # Need auto-host.h to check linker support. - if { ![file exists ../../auto-host.h ] } { - return 0 - } - - return [check_cached_effective_target code_6_gottpoff_reloc { - # Include the current process ID in the file names to prevent - # conflicts with invocations for multiple testsuites. - - set src code_6_gottpoff[pid].c - set obj code_6_gottpoff[pid].o - - set f [open $src "w"] - puts $f "#include \"../../auto-host.h\"" - puts $f "#if HAVE_AS_R_X86_64_CODE_6_GOTTPOFF == 0" - puts $f "# error Assembler does not support R_X86_64_CODE_6_GOTTPOFF." - puts $f "#endif" - close $f - - verbose "check_effective_target_code_6_gottpoff_reloc 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_code_6_gottpoff_reloc testfile compilation passed" 2 - return 1 - } else { - verbose "check_effective_target_code_6_gottpoff_reloc testfile compilation failed" 2 - return 0 - } - }] - - return $code_6_gottpoff_reloc_available_saved -} - -# Return 1 if the x86 target supports R_386_GOT32X relocation, 0 -# otherwise. Cache the result. - -proc check_effective_target_got32x_reloc { } { - global tool - global GCC_UNDER_TEST - - if { ![check_effective_target_x86] } { - return 0 - } - - # Need auto-host.h to check linker support. - if { ![file exists ../../auto-host.h ] } { - return 0 - } - - return [check_cached_effective_target got32x_reloc { - # Include the current process ID in the file names to prevent - # conflicts with invocations for multiple testsuites. - - set src got32x[pid].c - set obj got32x[pid].o - - set f [open $src "w"] - puts $f "#include \"../../auto-host.h\"" - puts $f "#if HAVE_AS_IX86_GOT32X == 0" - puts $f "# error Assembler does not support R_386_GOT32X." - puts $f "#endif" - close $f - - verbose "check_effective_target_got32x_reloc 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_got32x_reloc testfile compilation passed" 2 - return 1 - } else { - verbose "check_effective_target_got32x_reloc testfile compilation failed" 2 - return 0 - } - }] - - return $got32x_reloc_available_saved -} - -# Return 1 if the x86 target supports calling ___tls_get_addr via GOT, -# 0 otherwise. Cache the result. - -proc check_effective_target_tls_get_addr_via_got { } { - global tool - global GCC_UNDER_TEST - - if { ![check_effective_target_x86] } { - return 0 - } - - # Need auto-host.h to check linker support. - if { ![file exists ../../auto-host.h ] } { - return 0 - } - - return [check_cached_effective_target tls_get_addr_via_got { - # Include the current process ID in the file names to prevent - # conflicts with invocations for multiple testsuites. - - set src tls_get_addr_via_got[pid].c - set obj tls_get_addr_via_got[pid].o - - set f [open $src "w"] - puts $f "#include \"../../auto-host.h\"" - puts $f "#if HAVE_AS_IX86_TLS_GET_ADDR_GOT == 0" - puts $f "# error Assembler/linker do not support calling ___tls_get_addr via GOT." - puts $f "#endif" - close $f - - verbose "check_effective_target_tls_get_addr_via_got 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_tls_get_addr_via_got testfile compilation passed" 2 - return 1 - } else { - verbose "check_effective_target_tls_get_addr_via_got testfile compilation failed" 2 - return 0 - } - }] -} - # Return 1 if the target uses comdat groups. proc check_effective_target_comdat_group {} { @@ -14468,46 +14279,6 @@ proc check_effective_target_o_flag_in_section { } { }] } -# Return 1 if the given assembler supports hardware transactional memory -# instructions with machine type Power10, 0 otherwise. Cache the result. - -proc check_effective_target_powerpc_as_p10_htm { } { - global tool - global GCC_UNDER_TEST - - # Need auto-host.h to check linker support. - if { ![file exists ../../auto-host.h ] } { - return 0 - } - - return [check_cached_effective_target powerpc_as_p10_htm { - - 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_AS_POWER10_HTM == 0" - puts $f "# error Assembler does not support htm insns with power10." - puts $f "#endif" - close $f - - verbose "check_effective_target_powerpc_as_p10_htm 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_powerpc_as_p10_htm testfile compilation passed" 2 - return 1 - } else { - verbose "check_effective_target_powerpc_as_p10_htm testfile compilation failed" 2 - return 0 - } - }] -} - # Return 1 if LRA is supported. This must not be called (results in ERROR) for # targets that don't do register allocation, and therefore neither use nor # don't use LRA. @@ -15084,54 +14855,6 @@ proc check_effective_target_foldable_pi_based_trigonometry { } { } }] } -# -# Return 1 if the x86-64 target enables -mfentry by default, 0 -# otherwise. Cache the result. - -proc check_effective_target_fentry { } { - global tool - global GCC_UNDER_TEST - - if { ![check_effective_target_x86] } { - return 0 - } - - # Need auto-host.h to check linker support. - if { ![file exists ../../auto-host.h ] } { - return 0 - } - - return [check_cached_effective_target fentry { - # Set up and compile to see if ENABLE_X86_64_MFENTRY is - # non-zero. 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 ENABLE_X86_64_MFENTRY == 0 || !defined __x86_64__" - puts $f "# error -mfentry is not enabled by default." - puts $f "#endif" - close $f - - verbose "check_effective_target_fentry 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_fentry testfile compilation passed" 2 - return 1 - } else { - verbose "check_effective_target_fentry testfile compilation failed" 2 - return 0 - } - }] -} # Check if valgrind executable exists in PATH on host proc check_effective_target_valgrind { } {