[binutils-gdb/binutils-2_45-branch] gas: Move gas_sframe_check to binutils-common.exp
H.J. Lu
hjl@sourceware.org
Wed Jul 16 15:09:45 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=91b0c7e3110c6019e5ef52b27b9ac709aaa1ff51
commit 91b0c7e3110c6019e5ef52b27b9ac709aaa1ff51
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Jul 14 04:45:43 2025 +0800
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 <hjl.tools@gmail.com>
(cherry picked from commit ef7a634dc01df3d78f208c93316b52937d3fe8f4)
Diff:
---
binutils/testsuite/lib/binutils-common.exp | 41 +++++++++++++++++++++++++++++
gas/testsuite/gas/cfi-sframe/cfi-sframe.exp | 37 --------------------------
2 files changed, 41 insertions(+), 37 deletions(-)
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
More information about the Binutils-cvs
mailing list