public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Indu Bhagat <indu.bhagat@oracle.com>
To: binutils@sourceware.org
Cc: nickc@redhat.com, weimin.pan@oracle.com,
	Indu Bhagat <indu.bhagat@oracle.com>
Subject: [PATCH,V1 04/14] gas: testsuite: add new tests for SFrame unwind info
Date: Thu, 29 Sep 2022 17:04:30 -0700	[thread overview]
Message-ID: <20220930000440.1672106-5-indu.bhagat@oracle.com> (raw)
In-Reply-To: <20220930000440.1672106-1-indu.bhagat@oracle.com>

Earlier these tests were in the same commit as previous which adds the
support in GNU assembler to generate .sframe section from CFI
directives.  Splitting this out here for ease of applying and testing.

ChangeLog:

	* gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.d: New file.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe.exp: Likewise.
	* gas/testsuite/gas/cfi-sframe/common-empty-1.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/common-empty-1.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/common-empty-2.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/common-empty-2.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/common-empty-3.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/common-empty-3.s: Likewise.
	* gas/testsuite/gas/cfi-sframe/common-empty-4.d: Likewise.
	* gas/testsuite/gas/cfi-sframe/common-empty-4.s: Likewise.
---
 .../gas/cfi-sframe/cfi-sframe-aarch64-1.d     | 20 ++++++
 .../gas/cfi-sframe/cfi-sframe-aarch64-1.s     | 61 +++++++++++++++++++
 .../gas/cfi-sframe/cfi-sframe-common-1.d      | 17 ++++++
 .../gas/cfi-sframe/cfi-sframe-common-1.s      |  3 +
 .../gas/cfi-sframe/cfi-sframe-common-2.d      | 17 ++++++
 .../gas/cfi-sframe/cfi-sframe-common-2.s      |  2 +
 .../gas/cfi-sframe/cfi-sframe-common-3.d      | 17 ++++++
 .../gas/cfi-sframe/cfi-sframe-common-3.s      |  4 ++
 .../gas/cfi-sframe/cfi-sframe-common-4.d      | 21 +++++++
 .../gas/cfi-sframe/cfi-sframe-common-4.s      |  8 +++
 .../gas/cfi-sframe/cfi-sframe-common-5.d      | 21 +++++++
 .../gas/cfi-sframe/cfi-sframe-common-5.s      |  7 +++
 .../gas/cfi-sframe/cfi-sframe-common-6.d      | 21 +++++++
 .../gas/cfi-sframe/cfi-sframe-common-6.s      |  7 +++
 .../gas/cfi-sframe/cfi-sframe-common-7.d      | 21 +++++++
 .../gas/cfi-sframe/cfi-sframe-common-7.s      |  7 +++
 .../gas/cfi-sframe/cfi-sframe-common-8.d      | 20 ++++++
 .../gas/cfi-sframe/cfi-sframe-common-8.s      | 12 ++++
 .../gas/cfi-sframe/cfi-sframe-x86_64-1.d      | 22 +++++++
 .../gas/cfi-sframe/cfi-sframe-x86_64-1.s      | 30 +++++++++
 gas/testsuite/gas/cfi-sframe/cfi-sframe.exp   | 58 ++++++++++++++++++
 gas/testsuite/gas/cfi-sframe/common-empty-1.d | 14 +++++
 gas/testsuite/gas/cfi-sframe/common-empty-1.s |  5 ++
 gas/testsuite/gas/cfi-sframe/common-empty-2.d | 14 +++++
 gas/testsuite/gas/cfi-sframe/common-empty-2.s |  8 +++
 gas/testsuite/gas/cfi-sframe/common-empty-3.d | 14 +++++
 gas/testsuite/gas/cfi-sframe/common-empty-3.s |  9 +++
 gas/testsuite/gas/cfi-sframe/common-empty-4.d | 14 +++++
 gas/testsuite/gas/cfi-sframe/common-empty-4.s | 17 ++++++
 29 files changed, 491 insertions(+)
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
 create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-1.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-1.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-2.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-2.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-3.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-3.s
 create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-4.d
 create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-4.s

diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.d
new file mode 100644
index 00000000000..aeefbc9cdef
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.d
@@ -0,0 +1,20 @@
+#as:
+#objdump: --sframe=.sframe
+#name: SFrame generation on aarch64
+#...
+Contents of the SFrame section .sframe:
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 1
+    Num FREs: 3
+
+  Function Index :
+
+    func idx \[0\]: pc = 0x0, size = 80 bytes
+    STARTPC +CFA +FP +RA +
+    0+0000 +sp\+0 +u +u +
+    0+0004 +sp\+144 +u +u +
+    0+004c +sp\+0 +u +u +
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.s
new file mode 100644
index 00000000000..082c8a32046
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.s
@@ -0,0 +1,61 @@
+        .cfi_sections .sframe
+	.cfi_startproc
+	stp	x19, x20, [sp, -144]!
+	.cfi_def_cfa_offset 144
+	.cfi_offset 19, -144
+	.cfi_offset 20, -136
+	stp	x21, x22, [sp, 16]
+	stp	x23, x24, [sp, 32]
+	stp	x25, x26, [sp, 48]
+	stp	x27, x28, [sp, 64]
+	stp	d8, d9, [sp, 80]
+	stp	d10, d11, [sp, 96]
+	stp	d12, d13, [sp, 112]
+	stp	d14, d15, [sp, 128]
+	.cfi_offset 21, -128
+	.cfi_offset 22, -120
+	.cfi_offset 23, -112
+	.cfi_offset 24, -104
+	.cfi_offset 25, -96
+	.cfi_offset 26, -88
+	.cfi_offset 27, -80
+	.cfi_offset 28, -72
+	.cfi_offset 72, -64
+	.cfi_offset 73, -56
+	.cfi_offset 74, -48
+	.cfi_offset 75, -40
+	.cfi_offset 76, -32
+	.cfi_offset 77, -24
+	.cfi_offset 78, -16
+	.cfi_offset 79, -8
+	nop
+	ldp	x21, x22, [sp, 16]
+	ldp	x23, x24, [sp, 32]
+	ldp	x25, x26, [sp, 48]
+	ldp	x27, x28, [sp, 64]
+	ldp	d8, d9, [sp, 80]
+	ldp	d10, d11, [sp, 96]
+	ldp	d12, d13, [sp, 112]
+	ldp	d14, d15, [sp, 128]
+	ldp	x19, x20, [sp], 144
+	.cfi_restore 20
+	.cfi_restore 19
+	.cfi_restore 78
+	.cfi_restore 79
+	.cfi_restore 76
+	.cfi_restore 77
+	.cfi_restore 74
+	.cfi_restore 75
+	.cfi_restore 72
+	.cfi_restore 73
+	.cfi_restore 27
+	.cfi_restore 28
+	.cfi_restore 25
+	.cfi_restore 26
+	.cfi_restore 23
+	.cfi_restore 24
+	.cfi_restore 21
+	.cfi_restore 22
+	.cfi_def_cfa_offset 0
+	ret
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d
new file mode 100644
index 00000000000..7d97383bb90
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d
@@ -0,0 +1,17 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: SFrame generation using CFI directive .cfi_sections
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 1
+    Num FREs: 1
+
+  Function Index :
+    func idx \[0\]: pc = 0x0, size = 0 bytes
+    STARTPC + CFA + FP + RA +
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.s
new file mode 100644
index 00000000000..ac9c6ca2cf3
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.s
@@ -0,0 +1,3 @@
+	.cfi_sections .sframe
+	.cfi_startproc
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d
new file mode 100644
index 00000000000..fc7d5c440db
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d
@@ -0,0 +1,17 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: Command line option for generating SFrame
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 1
+    Num FREs: 1
+
+  Function Index :
+    func idx \[0\]: pc = 0x0, size = 0 bytes
+    STARTPC + CFA + FP + RA +
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.s
new file mode 100644
index 00000000000..659b3b9d99b
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.s
@@ -0,0 +1,2 @@
+	.cfi_startproc
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d
new file mode 100644
index 00000000000..95954508e3d
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d
@@ -0,0 +1,17 @@
+#as:
+#objdump: --sframe=.sframe
+#name: SFrame can co-exist with EH Frame
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 1
+    Num FREs: 1
+
+  Function Index :
+    func idx \[0\]: pc = 0x0, size = 0 bytes
+    STARTPC + CFA + FP + RA +
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.s
new file mode 100644
index 00000000000..36d31fe5348
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.s
@@ -0,0 +1,4 @@
+	.cfi_sections .eh_frame
+	.cfi_sections .sframe
+	.cfi_startproc
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d
new file mode 100644
index 00000000000..8eb97fac4d9
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d
@@ -0,0 +1,21 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: SFrame - cfi_def_cfa_offset test
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 1
+    Num FREs: 3
+
+  Function Index :
+    func idx \[0\]: pc = 0x0, size = 12 bytes
+    STARTPC + CFA + FP + RA +
+#...
+    0+0004 +sp\+16 +u +u +
+    0+0008 +sp\+32 +u +u +
+
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.s
new file mode 100644
index 00000000000..0d026bba71a
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.s
@@ -0,0 +1,8 @@
+## Testcase for cfi_def_cfa_offset
+	.cfi_startproc
+	.long 0
+	.cfi_def_cfa_offset 16
+	.long 0
+	.cfi_def_cfa_offset 32
+	.long 0
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d
new file mode 100644
index 00000000000..d2bef7507c2
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d
@@ -0,0 +1,21 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: SFrame cfi_adjust_cfa_offset test
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 1
+    Num FREs: 3
+
+  Function Index :
+    func idx \[0\]: pc = 0x0, size = 12 bytes
+    STARTPC + CFA + FP + RA +
+#...
+    0+0004 +sp\+16 +u +u +
+    0+0008 +sp\+24 +u +u +
+
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.s
new file mode 100644
index 00000000000..c985c39af9d
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.s
@@ -0,0 +1,7 @@
+	.cfi_startproc
+	.long 0
+	.cfi_def_cfa_offset 16
+	.long 0
+	.cfi_adjust_cfa_offset 8
+	.long 0
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d
new file mode 100644
index 00000000000..f915ac5f234
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d
@@ -0,0 +1,21 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: SFrame cfi_offset test
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 1
+    Num FREs: 3
+
+  Function Index :
+    func idx \[0\]: pc = 0x0, size = 12 bytes
+    STARTPC + CFA + FP + RA +
+#...
+    0+0004 +sp\+8 +u +u +
+    0+0008 +sp\+8 +u +u +
+
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.s
new file mode 100644
index 00000000000..389f324dc5f
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.s
@@ -0,0 +1,7 @@
+	.cfi_startproc
+	.long 0
+	.cfi_def_cfa_offset 8
+	.long 0
+	.cfi_offset 0, 8
+	.long 0
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d
new file mode 100644
index 00000000000..cab19d5bc25
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d
@@ -0,0 +1,21 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: SFrame cfi_rel_offset test
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 1
+    Num FREs: 3
+
+  Function Index :
+    func idx \[0\]: pc = 0x0, size = 12 bytes
+    STARTPC + CFA + FP + RA +
+#...
+    0+0004 +sp\+8 +u +u +
+    0+0008 +sp\+8 +u +u +
+
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.s
new file mode 100644
index 00000000000..21fa031fb30
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.s
@@ -0,0 +1,7 @@
+	.cfi_startproc
+	.long 0
+	.cfi_def_cfa_offset 8
+	.long 0
+	.cfi_rel_offset 1, 8
+	.long 0
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d
new file mode 100644
index 00000000000..c0a4a8de250
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d
@@ -0,0 +1,20 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: SFrame cfi_val_offset test
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 1
+    Num FREs: 2
+
+  Function Index :
+    func idx \[0\]: pc = 0x0, size = 8 bytes
+    STARTPC + CFA + FP + RA +
+#...
+    0+0004 +sp\+16 +u +u +
+
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.s
new file mode 100644
index 00000000000..f2083e6a106
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.s
@@ -0,0 +1,12 @@
+## cfi_val_offset when used with "not interesting" registers (from the
+## perspective of SFrame section, non FP/RA registers are not
+## interesting) does not affect the asynchronicity of the SFrame
+## unwind information.  Such CFI directives can be skipped for SFrame
+## unwind info generation.
+	.cfi_startproc
+	.long 0
+	.cfi_def_cfa_offset 16
+	.cfi_val_offset 1, 8
+	.cfi_val_offset 2, -32
+	.long 0
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d
new file mode 100644
index 00000000000..bba3b5920f1
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d
@@ -0,0 +1,22 @@
+#as: -O0
+#objdump: --sframe=.sframe
+#name: SFrame generation on x86_64
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 1
+    Num FREs: 4
+
+  Function Index :
+
+    func idx \[0\]: pc = 0x0, size = 25 bytes
+    STARTPC +CFA +FP +RA +
+    0+0000 +sp\+8 +u +u +
+    0+0001 +sp\+16 +c\-16 +u +
+    0+0004 +fp\+16 +c\-16 +u +
+    0+0018 +sp\+8 +c\-16 +u +
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.s
new file mode 100644
index 00000000000..77f3578f0d8
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.s
@@ -0,0 +1,30 @@
+        .cfi_sections .sframe
+	.cfi_startproc
+        pushq   %rbp
+        .cfi_def_cfa_offset 16
+        .cfi_offset 6, -16
+        movq    %rsp, %rbp
+        .cfi_def_cfa_register 6
+        pushq   %r15
+        pushq   %r14
+        pushq   %r13
+        pushq   %r12
+        pushq   %rbx
+  ## These CFI opcodes are not interesting
+  ## for SFrame generation and will be
+  ## skipped.
+        .cfi_offset 15, -24
+        .cfi_offset 14, -32
+        .cfi_offset 13, -40
+        .cfi_offset 12, -48
+        .cfi_offset 3, -56
+        nop
+        popq    %rbx
+        popq    %r12
+        popq    %r13
+        popq    %r14
+        popq    %r15
+        popq    %rbp
+        .cfi_def_cfa 7, 8
+        ret
+        .cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
new file mode 100644
index 00000000000..ca344c9e252
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
@@ -0,0 +1,58 @@
+# Copyright (C) 2022 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+
+if { ![is_elf_format] } then {
+    return
+}
+
+proc gas_x86_64_check { } {
+    global NM
+    global NMFLAGS
+
+    set status [gas_host_run "$NM $NMFLAGS --help" ""]
+    return [regexp "targets:.*x86-64" [lindex $status 1]];
+}
+
+if  { [istarget "x86_64-*-*"] || [istarget "aarch64-*-*"] } then {
+
+    global ASFLAGS
+    set old_ASFLAGS "$ASFLAGS"
+
+    run_dump_test "cfi-sframe-common-1"
+    run_dump_test "cfi-sframe-common-2"
+    run_dump_test "cfi-sframe-common-3"
+    run_dump_test "cfi-sframe-common-4"
+    run_dump_test "cfi-sframe-common-5"
+    run_dump_test "cfi-sframe-common-6"
+    run_dump_test "cfi-sframe-common-7"
+    run_dump_test "cfi-sframe-common-8"
+
+    run_dump_test "common-empty-1"
+    run_dump_test "common-empty-2"
+    run_dump_test "common-empty-3"
+    run_dump_test "common-empty-4"
+
+    if { [gas_x86_64_check] } then {
+	set ASFLAGS "$ASFLAGS --64"
+	run_dump_test "cfi-sframe-x86_64-1"
+	set ASFLAGS "$old_ASFLAGS"
+    }
+}
+
+# aarch64 specific tests
+if { [istarget "aarch64-*-*"] } then {
+    run_dump_test "cfi-sframe-aarch64-1"
+}
diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-1.d b/gas/testsuite/gas/cfi-sframe/common-empty-1.d
new file mode 100644
index 00000000000..0b09799826c
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/common-empty-1.d
@@ -0,0 +1,14 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: Uninteresting cfi directives generate an empty SFrame section
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 0
+    Num FREs: 0
+
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-1.s b/gas/testsuite/gas/cfi-sframe/common-empty-1.s
new file mode 100644
index 00000000000..e26e998189f
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/common-empty-1.s
@@ -0,0 +1,5 @@
+      .cfi_sections .sframe
+      .cfi_startproc
+      .cfi_remember_state
+      .cfi_restore_state
+      .cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-2.d b/gas/testsuite/gas/cfi-sframe/common-empty-2.d
new file mode 100644
index 00000000000..e566c078249
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/common-empty-2.d
@@ -0,0 +1,14 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: SFrame supports only FP/SP based CFA
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 0
+    Num FREs: 0
+
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-2.s b/gas/testsuite/gas/cfi-sframe/common-empty-2.s
new file mode 100644
index 00000000000..146c53de785
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/common-empty-2.s
@@ -0,0 +1,8 @@
+## CFA register is not defined to be SP/FP.
+## No SFrame unwind info for this function will be generated.
+	.cfi_startproc simple
+	.long 0
+	.long 0
+	.cfi_adjust_cfa_offset 16
+	.long 0
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-3.d b/gas/testsuite/gas/cfi-sframe/common-empty-3.d
new file mode 100644
index 00000000000..f7a6062d392
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/common-empty-3.d
@@ -0,0 +1,14 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: SFrame supports only default return column
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 0
+    Num FREs: 0
+
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-3.s b/gas/testsuite/gas/cfi-sframe/common-empty-3.s
new file mode 100644
index 00000000000..982fe0c851d
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/common-empty-3.s
@@ -0,0 +1,9 @@
+## The return column is not the default value.
+## No SFrame unwind info for this function will be generated.
+	.cfi_startproc
+	.cfi_return_column 0
+	.long 0
+	.long 0
+	.cfi_adjust_cfa_offset 16
+	.long 0
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-4.d b/gas/testsuite/gas/cfi-sframe/common-empty-4.d
new file mode 100644
index 00000000000..f7a6062d392
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/common-empty-4.d
@@ -0,0 +1,14 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: SFrame supports only default return column
+#...
+Contents of the SFrame section .sframe:
+
+  Header :
+
+    Version: SFRAME_VERSION_1
+    Flags: NONE
+    Num FDEs: 0
+    Num FREs: 0
+
+#pass
diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-4.s b/gas/testsuite/gas/cfi-sframe/common-empty-4.s
new file mode 100644
index 00000000000..f97ca2f7ff9
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/common-empty-4.s
@@ -0,0 +1,17 @@
+## ARMv8.3 addded support a new security feature named Pointer Authentication. The
+## main idea behind this is to use the unused bits in the pointer values.
+## Each pointer is patched with a PAC before writing to memory, and is verified
+## before using it.
+## When the pointers are mangled, the unwinder needs to know so it can mask off
+## the PAC from the pointer value to recover the return address, and
+## conversely, skip doing so if the pointers are not mangled.
+##
+## .cfi_negate_ra_state CFI directive is used to convey this information.
+##
+## SFrame does not have any means to represent this information at this time.
+	.cfi_startproc
+	.long 0
+	.cfi_def_cfa_offset 16
+	.cfi_negate_ra_state
+	.long 0
+	.cfi_endproc
-- 
2.37.2


  parent reply	other threads:[~2022-09-30  0:07 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02  8:04 [PATCH,V6 00/10] Definition and Implementation of CTF Frame format Indu Bhagat
2022-08-02  8:04 ` [PATCH,V6 01/10] ctf-frame.h: Add CTF Frame format definition Indu Bhagat
2022-08-15 12:04   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 02/10] gas: add new command line option --gctf-frame Indu Bhagat
2022-08-15 12:07   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 03/10] gas: generate .ctf_frame Indu Bhagat
2022-08-15 12:22   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 04/10] libctfframe: add the CTF Frame library Indu Bhagat
2022-08-15 12:46   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 05/10] libctfframe: add GNU poke pickles for CTF Frame Indu Bhagat
2022-08-15 12:50   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 06/10] bfd: linker: merge .ctf_frame sections Indu Bhagat
2022-08-15 13:02   ` Nick Clifton
2022-08-18  2:11     ` Indu Bhagat
2022-08-02  8:04 ` [PATCH,V6 07/10] readelf/objdump: support for CTF Frame section Indu Bhagat
2022-08-15 13:11   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 08/10] unwinder: generate backtrace using CTF Frame format Indu Bhagat
2022-08-15 13:16   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 09/10] unwinder: Add CTF Frame unwinder tests Indu Bhagat
2022-08-15 13:27   ` Nick Clifton
2022-08-02  8:04 ` [PATCH, V6 10/10] gdb: sim: buildsystem changes to accommodate libctfframe Indu Bhagat
2022-08-05 14:43   ` Tom Tromey
2022-08-15 12:18 ` [PATCH,V6 00/10] Definition and Implementation of CTF Frame format Nick Clifton
2022-08-18  1:38   ` Indu Bhagat
2022-08-15 14:25 ` Nick Clifton
2022-09-30  0:04   ` [PATCH,V1 00/14] Definition and support for SFrame unwind format Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 01/14] sframe.h: Add SFrame format definition Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 02/14] gas: add new command line option --gsframe Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 03/14] gas: generate .sframe from CFI directives Indu Bhagat
2022-09-30  0:04     ` Indu Bhagat [this message]
2022-09-30  0:04     ` [PATCH,V1 05/14] libsframe: add the SFrame library Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 06/14] bfd: linker: merge .sframe sections Indu Bhagat
2022-09-30 10:51       ` Nick Clifton
2022-09-30  0:04     ` [PATCH,V1 07/14] readelf/objdump: support for SFrame section Indu Bhagat
2022-09-30 11:08       ` Nick Clifton
2022-09-30  0:04     ` [PATCH,V1 08/14] unwinder: generate backtrace using SFrame format Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 09/14] unwinder: Add SFrame unwinder tests Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 10/14] gdb: sim: buildsystem changes to accommodate libsframe Indu Bhagat
2022-10-11 16:08       ` [PATCH, V1 " Tom Tromey
2022-09-30  0:04     ` [PATCH,V1 11/14] libctf: add libsframe to LDFLAGS and LIBS Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 12/14] src-release.sh: Add libsframe Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 13/14] binutils/NEWS: add text for SFrame support Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 14/14] gas/NEWS: add text about new command line option and " Indu Bhagat
2022-09-30  8:09     ` [PATCH,V1 00/14] Definition and support for SFrame unwind format Jan Beulich
2022-10-04  5:16       ` Indu Bhagat
2022-10-04  6:53         ` Jan Beulich
2022-09-30  8:24     ` Fangrui Song
2022-10-01  0:15       ` Indu Bhagat
2022-09-30  9:12     ` Nick Clifton
2022-10-01  0:29       ` Indu Bhagat
2022-10-01  9:51       ` Jose E. Marchesi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220930000440.1672106-5-indu.bhagat@oracle.com \
    --to=indu.bhagat@oracle.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    --cc=weimin.pan@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).