[binutils-gdb] objdump, as: add callx support for BPF CPU v1

Jose E. Marchesi jemarch@sourceware.org
Thu Feb 15 14:14:38 GMT 2024


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

commit 7921285b6c2ba0bee9bb21d8e23fdea4c790c181
Author: Will Hawkins <hawkinsw@obs.cr>
Date:   Thu Feb 15 15:11:44 2024 +0100

    objdump, as: add callx support for BPF CPU v1
    
    Albeit not being a currently valid BPF instruction, callx is generated
    by both clang and GCC when BPF programs are compiled unoptimized.
    Until now, GCC would emit it only whe using the experimental
    compiler-testing cpu version xbpf, whereas clang would emit it from
    v1.  This patch makes GAS to accept callx also starting with cpu v1.
    
    opcodes/ChangeLog
    
            * bpf-opc.c: Move callx into the v1 BPF CPU variant.
    
    gas/ChangeLog
    
            * testsuite/gas/bpf/indcall-1-pseudoc.d: Do not select xbpf cpu
            version.
            * testsuite/gas/bpf/indcall-1.d: Likewise.

Diff:
---
 gas/ChangeLog                             | 6 ++++++
 gas/testsuite/gas/bpf/indcall-1-pseudoc.d | 4 ++--
 gas/testsuite/gas/bpf/indcall-1.d         | 4 ++--
 opcodes/ChangeLog                         | 4 ++++
 opcodes/bpf-opc.c                         | 2 +-
 5 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index b277f47b05d..8be29915d8d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2024-02-15 Will Hawkins  <hawkinsw@obs.cr>
+
+	* testsuite/gas/bpf/indcall-1-pseudoc.d: Do not select xbpf cpu
+	version.
+	* testsuite/gas/bpf/indcall-1.d: Likewise.
+
 2024-02-14  Yuriy Kolerov  <ykolerov@synopsys.com>
 
 	* config/tc-arc.c (is_br_jmp_insn_p): Add check against "DBNZ".
diff --git a/gas/testsuite/gas/bpf/indcall-1-pseudoc.d b/gas/testsuite/gas/bpf/indcall-1-pseudoc.d
index 7a95bad8e65..ae49cd1c446 100644
--- a/gas/testsuite/gas/bpf/indcall-1-pseudoc.d
+++ b/gas/testsuite/gas/bpf/indcall-1-pseudoc.d
@@ -1,5 +1,5 @@
-#as: -EL -mdialect=pseudoc -misa-spec=xbpf
-#objdump: -M xbpf,pseudoc,dec -dr
+#as: -EL -mdialect=pseudoc
+#objdump: -M pseudoc,dec -dr
 #source: indcall-1-pseudoc.s
 #name: BPF indirect call 1, pseudoc syntax
 
diff --git a/gas/testsuite/gas/bpf/indcall-1.d b/gas/testsuite/gas/bpf/indcall-1.d
index 51103bba2a1..48e351fdaae 100644
--- a/gas/testsuite/gas/bpf/indcall-1.d
+++ b/gas/testsuite/gas/bpf/indcall-1.d
@@ -1,5 +1,5 @@
-#as: -EL -misa-spec=xbpf
-#objdump: -dr -M xbpf,dec
+#as: -EL
+#objdump: -dr -M dec
 #source: indcall-1.s
 #name: BPF indirect call 1, normal syntax
 
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 4fb2d0de207..bce3bfb61b5 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2024-02-15 Will Hawkins  <hawkinsw@obs.cr>
+
+	* bpf-opc.c: Move callx into the v1 BPF CPU variant.
+
 2024-02-14  Yuriy Kolerov  <ykolerov@synopsys.com>
 
 	* arc-tbl.h (dbnz): Use "DBNZ" class.
diff --git a/opcodes/bpf-opc.c b/opcodes/bpf-opc.c
index 19e096501a2..0524f4c7e1c 100644
--- a/opcodes/bpf-opc.c
+++ b/opcodes/bpf-opc.c
@@ -273,7 +273,7 @@ const struct bpf_opcode bpf_opcodes[] =
   {BPF_INSN_JNER, "jne%W%dr , %sr , %d16", "if%w%dr != %sr%wgoto%w%d16",
    BPF_V1, BPF_CODE, BPF_CLASS_JMP|BPF_CODE_JNE|BPF_SRC_X},
   {BPF_INSN_CALLR, "call%W%dr", "callx%w%dr",
-   BPF_XBPF, BPF_CODE, BPF_CLASS_JMP|BPF_CODE_CALL|BPF_SRC_X},
+   BPF_V1, BPF_CODE, BPF_CLASS_JMP|BPF_CODE_CALL|BPF_SRC_X},
   {BPF_INSN_CALL, "call%W%d32", "call%w%d32",
    BPF_V1, BPF_CODE, BPF_CLASS_JMP|BPF_CODE_CALL|BPF_SRC_K},
   {BPF_INSN_EXIT, "exit", "exit",


More information about the Binutils-cvs mailing list