Skip to content

Commit

Permalink
Fix bpf_trace_printk() for big-endian targets
Browse files Browse the repository at this point in the history
The format string for bpf_trace_printk() gets garbled during the
conversion of the LLVM IR code to the corresponding BPF object.
This happens because bcc explicitly sets the data layout of the
module to 'e-m:e-p:64:64-i64:64-n32:64-S128' which is valid for
little-endian targets only. If the arch is set to 'bpf', LLVM
selects the correct data layout automatically and there is no
need to set this explicitly.

Signed-off-by: Sandipan Das <[email protected]>
Reported-by: Chandan Rajendra <[email protected]>
Fixes: iovisor#1723
  • Loading branch information
sandip4n committed May 3, 2018
1 parent bd8f086 commit 2af81df
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/cc/bpf_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ int BPFModule::finalize() {
std::map<std::string, std::tuple<uint8_t *, uintptr_t>> tmp_sections,
*sections_p;

mod->setDataLayout("e-m:e-p:64:64-i64:64-n32:64-S128");
mod->setTargetTriple("bpf-pc-linux");
sections_p = rw_engine_enabled_ ? &sections_ : &tmp_sections;

Expand Down

0 comments on commit 2af81df

Please sign in to comment.