From: H.J. Lu Date: Sun, 13 Jul 2025 20:45:43 +0000 (+0800) Subject: gas: Move gas_sframe_check to binutils-common.exp X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ef7a634dc01d;p=thirdparty%2Fbinutils-gdb.git gas: Move gas_sframe_check to binutils-common.exp Move gas_sframe_check to binutils-common.exp so that it can be used in linker tests to check if a target assembler supports --gsframe. binutils/ PR ld/33146 * testsuite/lib/binutils-common.exp (gas_sframe_check): Moved from cfi-sframe.exp. Replace gas_host_run with remote_exec. gas/ PR ld/33146 * testsuite/gas/cfi-sframe/cfi-sframe.exp (gas_sframe_check): Moved to binutils-common.exp. Signed-off-by: H.J. Lu --- diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp index 41d94d256ec..d024bc55150 100644 --- a/binutils/testsuite/lib/binutils-common.exp +++ b/binutils/testsuite/lib/binutils-common.exp @@ -480,6 +480,47 @@ proc supports_dt_relr {} { return 0 } +# Whether a target assembler supports --gsframe. +proc gas_sframe_check {} { + if { ![is_elf_format] } then { + return 0; + } + + global check_as_sframe_result + global AS + global ASFLAGS + if [info exists check_as_sframe_result] { + return $check_as_sframe_result + } + + set as_file "tmpdir/check_as_sframe.s" + set as_fh [open $as_file w 0666] + puts $as_fh "# Generated file. DO NOT EDIT" + puts $as_fh "\t.cfi_startproc" + puts $as_fh "\t.cfi_endproc" + close $as_fh + remote_download host $as_file + verbose -log "Checking SFrame support in AS:" + + set old_ASFLAGS "$ASFLAGS" + set ASFLAGS "$ASFLAGS --gsframe" + + global comp_output + + set output_file "tmpdir/check_as_sframe.out" + set status [remote_exec host "$AS $ASFLAGS $as_file" "2> $output_file"] + set comp_output [file_contents "$output_file"] + set ASFLAGS "$old_ASFLAGS" + + if { ![string match "" $comp_output] } then { + verbose -log "SFrame not supported in AS" + return 0 + } else { + verbose -log "SFrame supported in AS" + return 1 + } +} + # get_relative_path FROM TO # # Return a relative path to TO starting from FROM, which is usually diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp index 8a424198a88..00a3ecc067c 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp @@ -18,43 +18,6 @@ if { ![is_elf_format] } then { return } -proc gas_sframe_check { } { - global check_as_sframe_result - global AS - global ASFLAGS - if [info exists check_as_sframe_result] { - return $check_as_sframe_result - } - - set as_file "tmpdir/check_as_sframe.s" - set as_fh [open $as_file w 0666] - puts $as_fh "# Generated file. DO NOT EDIT" - puts $as_fh "\t.cfi_startproc" - puts $as_fh "\t.cfi_endproc" - close $as_fh - remote_download host $as_file - verbose -log "Checking SFrame support in AS:" - - set old_ASFLAGS "$ASFLAGS" - set ASFLAGS "$ASFLAGS --gsframe" - - global comp_output - - set output_file "tmpdir/check_as_sframe.out" - set status [gas_host_run "$AS $ASFLAGS $as_file" "2>$output_file"] - set comp_output [file_contents "$output_file"] - set ASFLAGS "$old_ASFLAGS" - - if { ![string match "" $comp_output] - || [string match "*sframe not supported for target*" $comp_output] } then { - verbose -log "SFrame not supported in AS" - return 0 - } else { - verbose -log "SFrame supported in AS" - return 1 - } -} - proc gas_x86_64_check { } { global NM global NMFLAGS