From 90353438e5a248f4c837b782cf452d1e13a31d60 Mon Sep 17 00:00:00 2001 From: Quentin JEROME Date: Wed, 27 Sep 2023 09:05:03 +0200 Subject: [PATCH] cold callsite disabled, fixes #123 Signed-off-by: Quentin JEROME --- src/linker.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/linker.rs b/src/linker.rs index 0216ce59..717aa025 100644 --- a/src/linker.rs +++ b/src/linker.rs @@ -482,6 +482,13 @@ impl Linker { fn llvm_init(&mut self) { let mut args = Vec::>::new(); args.push("bpf-linker".into()); + // Disable cold call site detection. Many accessors in aya-ebpf return Result + // 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.