Skip to content

Commit

Permalink
Clang puts callx register into imm not src_reg (#200)
Browse files Browse the repository at this point in the history
Fix bug pointed out by Will.
Still waiting to confirm what gcc does.

Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
  • Loading branch information
dthaler committed Feb 11, 2024
1 parent eb2636e commit f66ef12
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/bpf_assembler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,12 @@ typedef class _bpf_assembler
if (mode == "helper") {
if (target.starts_with('%')) {
inst.opcode |= EBPF_SRC_REG;
inst.imm = 0;
inst.src = _decode_register(target);
inst.imm = _decode_register(target);
} else {
inst.opcode |= EBPF_SRC_IMM;
inst.imm = _decode_imm32(target);
inst.src = 0;
}
inst.src = 0;
} else if (mode == "local") {
inst.imm = _decode_jump_target(target);
inst.src = 1;
Expand Down

0 comments on commit f66ef12

Please sign in to comment.