This tiny patch makes the BPF disassembler to emit, e.g.
ldxdw %r1, [%r0+0]
instead of
ldxdw %r1, [%r00]
when the offset is 0, to avoid confusion.
opcodes/
* bpf-dis.c (print_insn_bpf): Print offsets with value 0 as "+0".
gas/
* testsuite/gas/bpf/mem.s: Add tests with offset 0.
* testsuite/gas/bpf/mem-pseudoc.s: Likewise.
* testsuite/gas/bpf/mem.d: Update accordingly.
* testsuite/gas/bpf/mem-be.d: Likewise.
* testsuite/gas/bpf/mem-pseudoc.d: Likewise.
* testsuite/gas/bpf/mem-be-pseudoc.d: Likewise.
a8: 89 21 7e ef 00 00 00 00 r2=\*\(i16\*\)\(r1\+0x7eef\)
b0: 91 21 7e ef 00 00 00 00 r2=\*\(i8\*\)\(r1\+0x7eef\)
b8: 99 21 7e ef 00 00 00 00 r2=\*\(i64\*\)\(r1\+0x7eef\)
+ c0: 58 05 00 00 00 00 00 00 r0=\*\(u64\*\)skb\[r5\+0x0\]
+ c8: 61 21 00 00 00 00 00 00 r2=\*\(u32\*\)\(r1\+0x0\)
a0: 81 21 7e ef 00 00 00 00 ldxsw %r2,\[%r1\+0x7eef\]
a8: 89 21 7e ef 00 00 00 00 ldxsh %r2,\[%r1\+0x7eef\]
b0: 91 21 7e ef 00 00 00 00 ldxsb %r2,\[%r1\+0x7eef\]
- b8: 99 21 7e ef 00 00 00 00 ldxsdw %r2,\[%r1\+0x7eef\]
\ No newline at end of file
+ b8: 99 21 7e ef 00 00 00 00 ldxsdw %r2,\[%r1\+0x7eef\]
+ c0: 79 21 00 00 00 00 00 00 ldxdw %r2,\[%r1\+0x0\]
+ c8: 40 03 00 00 00 00 00 00 ldindw %r3,0x0
a8: 89 12 ef 7e 00 00 00 00 r2=\*\(i16\*\)\(r1\+0x7eef\)
b0: 91 12 ef 7e 00 00 00 00 r2=\*\(i8\*\)\(r1\+0x7eef\)
b8: 99 12 ef 7e 00 00 00 00 r2=\*\(i64\*\)\(r1\+0x7eef\)
+ c0: 58 50 00 00 00 00 00 00 r0=\*\(u64\*\)skb\[r5\+0x0\]
+ c8: 61 12 00 00 00 00 00 00 r2=\*\(u32\*\)\(r1\+0x0\)
r2 = *(i16*)(r1+0x7eef)
r2 = *(i8*)(r1+0x7eef)
r2 = *(i64*)(r1+0x7eef)
+ r0 = *(u64 *)skb[r5 + 0]
+ r2 = *(u32 *)(r1 + 0)
a0: 81 12 ef 7e 00 00 00 00 ldxsw %r2,\[%r1\+0x7eef\]
a8: 89 12 ef 7e 00 00 00 00 ldxsh %r2,\[%r1\+0x7eef\]
b0: 91 12 ef 7e 00 00 00 00 ldxsb %r2,\[%r1\+0x7eef\]
- b8: 99 12 ef 7e 00 00 00 00 ldxsdw %r2,\[%r1\+0x7eef\]
\ No newline at end of file
+ b8: 99 12 ef 7e 00 00 00 00 ldxsdw %r2,\[%r1\+0x7eef\]
+ c0: 79 12 00 00 00 00 00 00 ldxdw %r2,\[%r1\+0x0\]
+ c8: 40 30 00 00 00 00 00 00 ldindw %r3,0x0
ldxsh %r2, [%r1+0x7eef]
ldxsb %r2, [%r1+0x7eef]
ldxsdw %r2, [%r1+0x7eef]
+ ldxdw %r2, [%r1+0]
+ ldindw %r3, 0
if (p[1] == 'I')
(*info->fprintf_styled_func) (info->stream, dis_style_immediate,
"%s",
- asm_obase != 10 || imm32 > 0 ? "+" : "");
+ asm_obase != 10 || imm32 >= 0 ? "+" : "");
(*info->fprintf_styled_func) (info->stream, dis_style_immediate,
asm_obase == 10 ? "%" PRIi32
: asm_obase == 8 ? "%" PRIo32
if (p[1] == 'o')
(*info->fprintf_styled_func) (info->stream, dis_style_immediate,
"%s",
- asm_obase != 10 || offset16 > 0 ? "+" : "");
+ asm_obase != 10 || offset16 >= 0 ? "+" : "");
if (asm_obase == 16 || asm_obase == 8)
(*info->fprintf_styled_func) (info->stream, dis_style_immediate,
asm_obase == 8 ? "0%" PRIo16 : "0x%" PRIx16,