Try switching target arch earlier in compilation (LLVM12+)
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
Paraphrasing a recent conversation w/ @yonghong-song:
Current bcc compilation process is split into a few steps:
1) Compile w/ arch-specific headers, generate IR
2) `BPFModule` does IR optimization
3) Switch target arch to `bpf`, finish w/ `MCJIT`
Before 3) target arch is set to the underlying system architecture, not `bpf`. When doing IR optimization, LLVM 12+ can try to generate more verifier-friendly code _if_ it knows that it's targeting `bpf`.
So we should try setting target arch = `bpf` in 2). Yonghong mentioned that this broke `inject.py` when he experimented with it, and that he doesn't think we need to gate this switch on LLVM version if we can fix `inject.py`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.