[binutils-gdb] x86: testsuite: scfi: adjust COFI testcase

Indu Bhagat ibhagat@sourceware.org
Fri Jan 26 19:34:59 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=16cbeae1b2757dd661ef936a505c6b3818a52853

commit 16cbeae1b2757dd661ef936a505c6b3818a52853
Author: Indu Bhagat <indu.bhagat@oracle.com>
Date:   Fri Jan 26 10:29:38 2024 -0800

    x86: testsuite: scfi: adjust COFI testcase
    
    The testcase for change of flow instructions in its current shape is not
    doing much: it checks that SCFI issues an appropriate warning.  The same
    warning is covered by another testcase (scfi-unsupported-cfg-1); It is
    better to test the ginsn translation instead, for these 'change of flow
    instructions'.
    
    gas/testsuite/
            * gas/scfi/x86_64/scfi-cofi-1.s: Moved to...
            * gas/scfi/x86_64/ginsn-cofi-1.s: ...here.
            * gas/scfi/x86_64/scfi-x86-64.exp: Adjust tests.
            * gas/scfi/x86_64/scfi-cofi-1.d: Removed.
            * gas/scfi/x86_64/scfi-cofi-1.l: Removed.
            * gas/scfi/x86_64/ginsn-cofi-1.l: New test.

Diff:
---
 gas/testsuite/gas/scfi/x86_64/ginsn-cofi-1.l       | 36 ++++++++++++++++++++++
 .../scfi/x86_64/{scfi-cofi-1.s => ginsn-cofi-1.s}  |  4 ---
 gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d        |  5 ---
 gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l        |  3 --
 gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp      |  3 +-
 5 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/gas/testsuite/gas/scfi/x86_64/ginsn-cofi-1.l b/gas/testsuite/gas/scfi/x86_64/ginsn-cofi-1.l
new file mode 100644
index 00000000000..fee76f9cc9b
--- /dev/null
+++ b/gas/testsuite/gas/scfi/x86_64/ginsn-cofi-1.l
@@ -0,0 +1,36 @@
+GAS LISTING .*
+
+
+   1              	# Testcase with a variety of "change of flow instructions"
+   2              	#
+   3              	# This test does not have much going on wrt synthesis of CFI;
+   4              	# it just aims to ensure x8_64 -> ginsn decoding behaves
+   5              	# gracefully for these "change of flow instructions"
+   6              		.text
+   7              		.globl  foo
+   8              		.type   foo, @function
+   8              	ginsn: SYM FUNC_BEGIN
+   9              	foo:
+   9              	ginsn: SYM foo
+  10 0000 4801D0   		addq    %rdx, %rax
+  10              	ginsn: ADD %r1, %r0, %r0
+  11 0003 E200     		loop    foo
+  11              	ginsn: JCC 
+  12 0005 3EFFE0   		notrack jmp     \*%rax
+  12              	ginsn: JMP %r0, 
+  13 0008 41FFD0   		call    \*%r8
+  13              	ginsn: CALL
+  14 000b 67E305   		jecxz   .L179
+  14              	ginsn: JCC 
+  15 000e FF6730   		jmp     \*48\(%rdi\)
+  15              	ginsn: JMP %r5, 
+  16 0011 7000     		jo      .L179
+  16              	ginsn: JCC 
+  17              	.L179:
+  17              	ginsn: SYM .L179
+  18 0013 C3       		ret
+  18              	ginsn: RET
+  19              	.LFE0:
+  19              	ginsn: SYM .LFE0
+  20              		.size   foo, .-foo
+  20              	ginsn: SYM FUNC_END
diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s b/gas/testsuite/gas/scfi/x86_64/ginsn-cofi-1.s
similarity index 84%
rename from gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s
rename to gas/testsuite/gas/scfi/x86_64/ginsn-cofi-1.s
index 0ea32d4bbe6..0a63910e046 100644
--- a/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s
+++ b/gas/testsuite/gas/scfi/x86_64/ginsn-cofi-1.s
@@ -1,7 +1,5 @@
 # Testcase with a variety of "change of flow instructions"
 #
-# Must be run with -W so it remains warning free.
-#
 # This test does not have much going on wrt synthesis of CFI;
 # it just aims to ensure x8_64 -> ginsn decoding behaves
 # gracefully for these "change of flow instructions"
@@ -9,7 +7,6 @@
 	.globl  foo
 	.type   foo, @function
 foo:
-	.cfi_startproc
 	addq    %rdx, %rax
 	loop    foo
 	notrack jmp     *%rax
@@ -19,6 +16,5 @@ foo:
 	jo      .L179
 .L179:
 	ret
-	.cfi_endproc
 .LFE0:
 	.size   foo, .-foo
diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d
deleted file mode 100644
index 53cc124d860..00000000000
--- a/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d
+++ /dev/null
@@ -1,5 +0,0 @@
-#as: --scfi=experimental -W
-#objdump: -Wf
-#name: Synthesize CFI for add insn
-
-#pass
diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l
deleted file mode 100644
index 61c29da2d9a..00000000000
--- a/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l
+++ /dev/null
@@ -1,3 +0,0 @@
-.*Assembler messages:
-.*12: Warning: SCFI ignores most user-specified CFI directives
-.*24: Warning: Untraceable control flow for func 'foo'; Skipping SCFI
diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp b/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp
index 2b291800b65..9005c47d789 100644
--- a/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp
+++ b/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp
@@ -28,6 +28,7 @@ if  { ([istarget "x86_64-*-*"] && ![istarget "x86_64-*-linux*-gnux32"]) } then {
     run_list_test "ginsn-add-1" "--scfi=experimental -ali"
     run_list_test "ginsn-pop-1" "--scfi=experimental -ali"
     run_list_test "ginsn-push-1" "--scfi=experimental -ali"
+    run_list_test "ginsn-cofi-1" "--scfi=experimental -ali -W"
 
     run_dump_test "scfi-cfi-label-1"
     run_list_test "scfi-cfi-label-1" "--scfi=experimental --warn"
@@ -67,8 +68,6 @@ if  { ([istarget "x86_64-*-*"] && ![istarget "x86_64-*-linux*-gnux32"]) } then {
     run_dump_test "scfi-pushsection-2"
     run_list_test "scfi-pushsection-2" "--scfi=experimental --warn"
 
-    run_dump_test "scfi-cofi-1"
-    run_list_test "scfi-cofi-1" "--scfi=experimental --warn"
     run_dump_test "scfi-sub-1"
     run_list_test "scfi-sub-1" "--scfi=experimental --warn"
     run_dump_test "scfi-sub-2"


More information about the Binutils-cvs mailing list