redbpf icon indicating copy to clipboard operation
redbpf copied to clipboard

Add support for LLVM 14 (Rust 1.60)

Open rsdy opened this issue 2 years ago • 9 comments

The latest stable is now built against LLVM14.

rsdy avatar Apr 07 '22 15:04 rsdy

This is blocked by llvm-sys: https://gitlab.com/taricorp/llvm-sys.rs/-/issues/30

nbaksalyar avatar Apr 07 '22 21:04 nbaksalyar

Note that I'm probably going to use this upgrade opportunity to deprecate support for LLVM versions <13. RedBPF 3 will only support 13 +14.

rsdy avatar Apr 07 '22 23:04 rsdy

I submitted a patch for llvm-sys and my fork can be used to start implementing support for llvm14 in redbpf. I can give it a try. :)

nbaksalyar avatar Apr 09 '22 23:04 nbaksalyar

Hi is there any update for LLVM 14 support? @nbaksalyar

b0bleet avatar May 03 '22 13:05 b0bleet

@b0bleet I'm a bit cautious on merging this, but should be functional. If you're keen on testing, that would be super helpful. The biggest obstacle in mergin #316 is fixing the CI.

rsdy avatar May 03 '22 14:05 rsdy

Hi @rsdy . I've got this PR staged to upgrade the build images to llvm14. CI for the images is passing here. I might have made some invalid assumptions, or upgraded too much, so just let me know, and I will revise.

DerekStrickland avatar Oct 17 '22 10:10 DerekStrickland

Sorry this has stalled a bit. I started a new job recently. Hoping to get back to this later this week. When I left off I found a couple of more changes to the upstream build-images repo that I'll need to submit around pinning linux header versions on some distros.

Also, I started running into variable kernel implementations and was struggling to find the right mechanism to dynamically change the implementation based on what the kernel supports as documented in this Rust Forum thread. Unfortunately, it seems like there are multiple inconsistencies based on distro. If there is already a way that you are handling this, please feel free to point me towards the right example code. Otherwise, I'll take a pass at it as best as I can devise.

DerekStrickland avatar Nov 07 '22 09:11 DerekStrickland

@DerekStrickland thanks a lot for your work, and bringing this to the Rust forum. I think the combination of the two approaches brought up in the thread is probably the correct thing to do.

I can't take a look in depth at the code right now, but https://github.com/BLAKE3-team/BLAKE3 pops into mind, where a significant amount of CPU feature detection happens in build.rs. Setting those cfg variables through the build file allows subsequent checks on them while building the crate. I should probably add that some heuristics translate feature-flags into internal cfg variables, too.

We should have all the code that parses Linux kernel versions that would allow you to toggle necessary feature tags. I should be able to get more in-depth look towards the end of the week if you think that's helpful.

rsdy avatar Nov 07 '22 23:11 rsdy

Thanks for the guidance. I'll take a look at the link you provided after Wednesday, and reach back out if I have further questions, or something to review.

DerekStrickland avatar Nov 08 '22 00:11 DerekStrickland