[binutils-gdb] Change the /nop directive for the BPF port of the assembler to use the encoding expected by the kern

Nick Clifton nickc@sourceware.org
Tue Sep 15 09:34:24 GMT 2020


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

commit 6db9990640cdf7bc0880149f2707904506518fb8
Author: David Faust <david.faust@oracle.com>
Date:   Tue Sep 15 10:33:49 2020 +0100

    Change the /nop directive for the BPF port of the assembler to use the encoding expected by the kernel.
    
            * config/tc-bpf.h (md_single_noop_insn): Use 'ja 0' for no-op.

Diff:
---
 gas/ChangeLog       | 4 ++++
 gas/config/tc-bpf.h | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index d66be0a46a1..633967d3068 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2020-09-15  David Faust  <david.faust@oracle.com>
+
+	* config/tc-bpf.h (md_single_noop_insn): Use 'ja 0' for no-op.
+
 2020-09-14  Nick Clifton  <nickc@redhat.com>
 
 	* read.c (s_nop): New function.  Handles the .nop directive.
diff --git a/gas/config/tc-bpf.h b/gas/config/tc-bpf.h
index cb02d6c1338..e7e505cfaa5 100644
--- a/gas/config/tc-bpf.h
+++ b/gas/config/tc-bpf.h
@@ -48,4 +48,6 @@
 /* Values passed to md_apply_fix don't include the symbol value.  */
 #define MD_APPLY_SYM_VALUE(FIX) 0
 
-#define md_single_noop_insn "mov %r1,%r1"
+/* The Linux kernel verifier expects NOPs to be encoded in this way;
+   a jump to offset 0 means jump to the next instruction.  */
+#define md_single_noop_insn "ja 0"


More information about the Binutils-cvs mailing list