Skip to content

Commit

Permalink
cold callsite disabled, fixes #123
Browse files Browse the repository at this point in the history
Signed-off-by: Quentin JEROME <qjerome@users.noreply.github.com>
  • Loading branch information
qjerome committed Oct 4, 2023
1 parent 2eadc33 commit 9035343
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,13 @@ impl Linker {
fn llvm_init(&mut self) {
let mut args = Vec::<Cow<str>>::new();
args.push("bpf-linker".into());
// Disable cold call site detection. Many accessors in aya-ebpf return Result<T, E>
// where the layout is larger than 64 bits, but the LLVM BPF target only supports
// up to 64 bits return values. Since the accessors are tiny in terms of code, we
// avoid the issue by annotating them with #[inline(always)]. If they are classified
// as cold though - and they often are starting from LLVM17 - #[inline(always)]
// is ignored and the BPF target fails codegen.
args.push("--cold-callsite-rel-freq=0".into());
if self.options.unroll_loops {
// setting cmdline arguments is the only way to customize the unroll pass with the
// C API.
Expand Down

0 comments on commit 9035343

Please sign in to comment.