]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Re: gas: Move gas_sframe_check to binutils-common.exp
authorAlan Modra <amodra@gmail.com>
Sun, 13 Jul 2025 23:23:07 +0000 (08:53 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 14 Jul 2025 00:34:05 +0000 (10:04 +0930)
PR ld/33146

Correct TCL errors trying to access error output file in commit
ef7a634dc01d.  In fact, get rid of the output file test entirely since
gas exit status is sufficient.

Also there is no need to firstly check for ELF support.

Set check_as_sframe_result, and remove ld-lib.exp check_as_sframe.

binutils/testsuite/lib/binutils-common.exp
ld/testsuite/lib/ld-lib.exp

index d024bc55150a31001e197e03cbbeb2a9f200c8d3..2da7138e2114ec3206570d8981b3a1d3f05d3a0f 100644 (file)
@@ -482,10 +482,6 @@ proc supports_dt_relr {} {
 
 # 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
@@ -502,23 +498,16 @@ proc gas_sframe_check {} {
     remote_download host $as_file
     verbose -log "Checking SFrame support in AS:"
 
-    set old_ASFLAGS "$ASFLAGS"
-    set ASFLAGS "$ASFLAGS --gsframe"
-
-    global comp_output
+    set status [remote_exec host "$AS $ASFLAGS --gsframe $as_file"]
 
-    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 {
+    if { [lindex $status 0] != 0 } then {
        verbose -log "SFrame not supported in AS"
-       return 0
+       set check_as_sframe_result 0
     } else {
        verbose -log "SFrame supported in AS"
-       return 1
+       set check_as_sframe_result 1
     }
+    return $check_as_sframe_result
 }
 
 # get_relative_path FROM TO
index 119410bc5236dbbaef7901f67331cfba3d662064..22d2f987b8717f45d54c763ffa11e6218e62d6e8 100644 (file)
@@ -1668,36 +1668,6 @@ proc skip_ctf_tests { } {
     return 1
 }
 
-# Check if the assembler supports SFrame.
-
-proc check_as_sframe { } {
-    global check_as_sframe_result
-    global as
-    if [info exists check_as_sframe_result] {
-       return $check_as_sframe_result
-    }
-
-    # SFrame generation needs CFI support
-    if { ![check_as_cfi] } {
-       set check_as_sframe_result 0;
-       return 0
-    }
-
-    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_sections \".sframe\""
-    puts $as_fh "\t.cfi_startproc"
-    puts $as_fh "\t.cfi_endproc"
-    close $as_fh
-    remote_download host $as_file
-    verbose -log "Checking SFrame:"
-    set success [ld_assemble $as $as_file "/dev/null"]
-    #remote_file host delete $as_file
-    set check_as_sframe_result $success
-    return $success
-}
-
 proc skip_sframe_tests { } {
 # FIXME TODO
 #    global enable_libsframe
@@ -1706,7 +1676,7 @@ proc skip_sframe_tests { } {
 #      return 1
 #    }
 
-    if [check_as_sframe] {
+    if [gas_sframe_check] {
        return 0
     }