[PATCH v4 10/11] s390: sframe: Test handling of .cfi_def_cfa_register

Jens Remus jremus@linux.ibm.com
Mon Jul 7 16:21:51 GMT 2025


Port x86-64 test for handling of .cfi_def_cfa_register from commit
3602da6fa285 ("gas: sframe: fix handling of .cfi_def_cfa_register")
to s390x.

gas/testsuite/
	PR gas/32879
	* gas/cfi-sframe/cfi-sframe.exp: Add new test for handling of
	.cfi_def_cfa_register on s390x.
	* gas/cfi-sframe/cfi-sframe-s390x-3.d: Likewise.
	* gas/cfi-sframe/cfi-sframe-s390x-3.s: Likewise.

Bug: https://sourceware.org/PR32879
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---

Notes (jremus):
    Changes in V4:
    - Adapt for recent fix of relocatable SFrame links and expect
      SFRAME_F_FDE_FUNC_START_PCREL in test.
    
    Changes in V2:
    - New patch.

 .../gas/cfi-sframe/cfi-sframe-s390x-3.d       | 19 +++++++++++++++++++
 .../gas/cfi-sframe/cfi-sframe-s390x-3.s       |  4 ++++
 gas/testsuite/gas/cfi-sframe/cfi-sframe.exp   |  1 +
 3 files changed, 24 insertions(+)
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-3.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-3.s

diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-3.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-3.d
new file mode 100644
index 000000000000..f775fe54ed7f
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-3.d
@@ -0,0 +1,19 @@
+#name: SFrame generation on s390x - .cfi_def_cfa_register with no previous offset
+#as: --gsframe
+#objdump: --sframe=.sframe
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_2
+    Flags: SFRAME_F_FDE_FUNC_START_PCREL
+    Num FDEs: 1
+    Num FREs: 1
+
+  Function Index :
+
+    func idx \[0\]: pc = 0x0, size = 0 bytes
+    STARTPC +CFA +FP +RA +
+    0+0000 +fp\+160 +u +u +
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-3.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-3.s
new file mode 100644
index 000000000000..ea8c9e1ff130
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-3.s
@@ -0,0 +1,4 @@
+# Although not a useful construct by itself, ensure graceful handling.
+	.cfi_startproc
+	.cfi_def_cfa_register 11
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
index b26ce60c6e59..9c5a16f255b4 100644
--- a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
@@ -115,6 +115,7 @@ if { [istarget "aarch64*-*-*"] && [gas_sframe_check] } then {
 if { [istarget "s390x*-*-*"] && [gas_sframe_check] } then {
     run_dump_test "cfi-sframe-s390x-1"
     run_dump_test "cfi-sframe-s390x-2"
+    run_dump_test "cfi-sframe-s390x-3"
     run_dump_test "cfi-sframe-s390x-err-1"
     run_dump_test "cfi-sframe-s390x-err-2"
     run_dump_test "cfi-sframe-s390x-err-3"
-- 
2.48.1



More information about the Binutils mailing list