mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
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 ef7a634dc0)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user