Skip to content

Commit

Permalink
adjust layout string in JIT with llvm11 128bit spec support
Browse files Browse the repository at this point in the history
To fix the issue (iovisor#2827)
which exposed a problem with aarch64 frontend and bpf backend
regarding __int128 type, the following llvm patch
   https://reviews.llvm.org/D76587
landed to explicitly support i128 type in bpf layout spec.

Adjust the layout string in bpf_module JIT compilation
accordingly.

Signed-off-by: Yonghong Song <[email protected]>
  • Loading branch information
yonghong-song committed Apr 6, 2020
1 parent 533391e commit f35dae0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/cc/bpf_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,18 @@ int BPFModule::finalize() {
*sections_p;

mod->setTargetTriple("bpf-pc-linux");
#if LLVM_MAJOR_VERSION >= 11
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
mod->setDataLayout("e-m:e-p:64:64-i64:64-i128:128-n32:64-S128");
#else
mod->setDataLayout("E-m:e-p:64:64-i64:64-i128:128-n32:64-S128");
#endif
#else
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
mod->setDataLayout("e-m:e-p:64:64-i64:64-n32:64-S128");
#else
mod->setDataLayout("E-m:e-p:64:64-i64:64-n32:64-S128");
#endif
#endif
sections_p = rw_engine_enabled_ ? &sections_ : &tmp_sections;

Expand Down

0 comments on commit f35dae0

Please sign in to comment.