Skip to contentSkip to conversation

Prebuilt LLVM 18.1.0-rc2 uploaded

DISCUSSION Nathan Chancellor 2 participants 11 messages Feb 8, 2024 – Feb 29, 2024

lore
Share & tools
lore
#0 lore raw

Hi all,

I have built and uploaded a prebuilt version of LLVM 18.1.0-rc2 to
https://mirrors.edge.kernel.org/pub/tools/llvm/.

As with Linux -rc releases, this is not the final version that will ship. If you run across any issues, especially ones that were not present in earlier LLVM releases, please consider reporting them to us so that we have a chance to investigate and fix them before the final release.

Cheers,
Nathan

#1 lore raw
Quoted 9 lines · Nathan Chancellor

I have built and uploaded a prebuilt version of LLVM 18.1.0-rc2 to
https://mirrors.edge.kernel.org/pub/tools/llvm/.

As with Linux -rc releases, this is not the final version that will ship. If you run across any issues, especially ones that were not present in earlier LLVM releases, please consider reporting them to us so that we have a chance to investigate and fix them before the final release.

I took a look at the LLVM 18 prerelease to see if these would work with Rust for e.g. CI and other users (instead of using the LLVM-provided apt ones, for instance), and noticed it does not bundle libclang.so.

Would it be possible to include it so that we can use bindgen and thus enable Rust with them?

I understand they are intended to be minimal toolchains, but if you think it would not be an unreasonable overhead, then it would be great to have it.

Either way, thanks for these toolchains, Nathan!

Cheers,
Miguel

#2 lore raw

Hi Miguel,

Quoted 16 lines · Miguel Ojeda
Quoted 9 lines · Nathan Chancellor

I have built and uploaded a prebuilt version of LLVM 18.1.0-rc2 to
https://mirrors.edge.kernel.org/pub/tools/llvm/.

As with Linux -rc releases, this is not the final version that will ship. If you run across any issues, especially ones that were not present in earlier LLVM releases, please consider reporting them to us so that we have a chance to investigate and fix them before the final release.

I took a look at the LLVM 18 prerelease to see if these would work with Rust for e.g. CI and other users (instead of using the LLVM-provided apt ones, for instance), and noticed it does not bundle libclang.so.

Quoted 6 lines

Would it be possible to include it so that we can use bindgen and thus enable Rust with them?

I understand they are intended to be minimal toolchains, but if you think it would not be an unreasonable overhead, then it would be great to have it.

Absolutely, I am more than happy to include libclang.so and anything else that would be useful for the kernel. Everything gets built but I only install what has felt needed for the kernel, so there is no real overhead aside from package size, which obviously should not increase much with this change. I've added the targets to my build scripts and kicked off a set of builds. If they finish successfully, I will upload them so that you can test them out and make sure they will work.

Thanks for bringing this up and giving them a go, cheers! Nathan

#3 lore raw
Quoted 26 lines · Nathan Chancellor

Hi Miguel,

Quoted 16 lines · Miguel Ojeda
Quoted 9 lines · Nathan Chancellor

I have built and uploaded a prebuilt version of LLVM 18.1.0-rc2 to
https://mirrors.edge.kernel.org/pub/tools/llvm/.

As with Linux -rc releases, this is not the final version that will ship. If you run across any issues, especially ones that were not present in earlier LLVM releases, please consider reporting them to us so that we have a chance to investigate and fix them before the final release.

I took a look at the LLVM 18 prerelease to see if these would work with Rust for e.g. CI and other users (instead of using the LLVM-provided apt ones, for instance), and noticed it does not bundle libclang.so.

Quoted 6 lines

Would it be possible to include it so that we can use bindgen and thus enable Rust with them?

I understand they are intended to be minimal toolchains, but if you think it would not be an unreasonable overhead, then it would be great to have it.

Quoted 7 lines

Absolutely, I am more than happy to include libclang.so and anything else that would be useful for the kernel. Everything gets built but I only install what has felt needed for the kernel, so there is no real overhead aside from package size, which obviously should not increase much with this change. I've added the targets to my build scripts and kicked off a set of builds. If they finish successfully, I will upload them so that you can test them out and make sure they will work.

Alright, I reuploaded 18.1.0-rc2 with libclang.so included, please let me know if this will work for you going forward.

Cheers,
Nathan

Tested-by
#4 lore raw
Quoted 3 lines · Nathan Chancellor

Alright, I reuploaded 18.1.0-rc2 with libclang.so included, please let me know if this will work for you going forward.

Thanks Nathan, that was quick!

I tried it, and it worked like a charm. bindgen reports:

    $ bindgen --version --verbose
    bindgen 0.65.1
    Clang: ClangBuiltLinux clang version 18.1.0rc
(https://github.com/llvm/llvm-project.git
c6c86965d967886ca5a2ed8968c949cd42cdd49a)

And I built next-20240213 for LoongArch kernel with Rust enabled:

# Linux/loongarch 6.8.0-rc4 Kernel Configuration CONFIG_CC_VERSION_TEXT="ClangBuiltLinux clang version 18.1.0rc
(https://github.com/llvm/llvm-project.git
c6c86965d967886ca5a2ed8968c949cd42cdd49a)"

    CONFIG_WERROR=y
    CONFIG_RUST=y
    CONFIG_RUSTC_VERSION_TEXT="rustc 1.75.0 (82e1608df 2023-12-21)"
    CONFIG_BINDGEN_VERSION_TEXT="bindgen 0.65.1"

I also built our rust-next branch for x86_64 and QEMU-boot tested it with the couple Rust samples:

    [ 0.000000] Linux version 6.8.0-rc1-gf090f0d0eea9

(root@02f0b7650ba6) (ClangBuiltLinux clang version 18.1.0rc
(https://github.com/llvm/llvm-project.git
c6c86965d967886ca5a2ed8968c949cd42cdd49a), ClangBuiltLinux LLD 18.1.0) #1 SMP PREEMPT_DYNAMIC Tue Feb 13 20:14:57 UTC 2024

    [ 1.788925] rust_minimal: My numbers are [72, 108, 200]

I have hooked it up into my small CI to keep using your toolchain in a subset of the builds :)

Not sure if you pick tags for this sort of thing, but in case it is useful:

Thanks again!

Cheers,
Miguel

#6 lore raw
Quoted 7 lines · Miguel Ojeda
Quoted 2 lines · Miguel Ojeda

Thanks Nathan, that was quick!

Is it possible to add libclang for the older toolchains? Or are they supposed to be immutable?

How far back would you like it added? I don't necessarily mind rebuilding older releases but certain entities may notice the checksums change.

https://gitlab.com/Linaro/tuxmake/-/merge_requests/364

Not the end of the world though.

Quoted 2 lines

Relatedly, Connor reports KCFI not working with LLVM 18:
https://lore.kernel.org/rust-for-linux/20240227-uncertain-amaze-6197e627ad95@wendy/

I see now this was PEBKAC :)

Cheers,
Nathan

#7 lore raw
Quoted 8 lines · Nathan Chancellor

How far back would you like it added? I don't necessarily mind rebuilding older releases but certain entities may notice the checksums change.

https://gitlab.com/Linaro/tuxmake/-/merge_requests/364

Not the end of the world though.

I think a reasonable set would be those versions matching the LLVM that Rust bundles (for rustc versions we have since 6.1 LTS). That
is: 15, 16 and 17.

Conveniently, LLVM 15 also matches the minimum external LLVM supported by rustc in 6.6 LTS.

If those are too much, LLVM 17 would already cover what 6.6 LTS' Rust bundles.

Cheers,
Miguel

#8 lore raw
Quoted 10 lines · Miguel Ojeda
Quoted 8 lines · Nathan Chancellor

How far back would you like it added? I don't necessarily mind rebuilding older releases but certain entities may notice the checksums change.

https://gitlab.com/Linaro/tuxmake/-/merge_requests/364

Not the end of the world though.

Quoted 8 lines

I think a reasonable set would be those versions matching the LLVM that Rust bundles (for rustc versions we have since 6.1 LTS). That
is: 15, 16 and 17.

Conveniently, LLVM 15 also matches the minimum external LLVM supported by rustc in 6.6 LTS.

If those are too much, LLVM 17 would already cover what 6.6 LTS' Rust bundles.

15 through 17 is a reasonable rebuild request, I've added it to the queue along with 18.1.0-rc4, which was just released. I'll message you when I have them uploaded.

Cheers,
Nathan

#9 lore raw
Quoted 15 lines · Nathan Chancellor
Quoted 14 lines · Miguel Ojeda
Quoted 8 lines · Nathan Chancellor

How far back would you like it added? I don't necessarily mind rebuilding older releases but certain entities may notice the checksums change.

https://gitlab.com/Linaro/tuxmake/-/merge_requests/364

Not the end of the world though.

I think a reasonable set would be those versions matching the LLVM that Rust bundles (for rustc versions we have since 6.1 LTS). That
is: 15, 16 and 17.

Quoted 8 lines
Quoted 4 lines

Conveniently, LLVM 15 also matches the minimum external LLVM supported by rustc in 6.6 LTS.

If those are too much, LLVM 17 would already cover what 6.6 LTS' Rust bundles.

15 through 17 is a reasonable rebuild request, I've added it to the queue along with 18.1.0-rc4, which was just released. I'll message you when I have them uploaded.

This is now done, please let me know if there are any issues!

Cheers,
Nathan

#10 lore raw
Quoted 8 lines · Nathan Chancellor
Quoted 4 lines · Nathan Chancellor

15 through 17 is a reasonable rebuild request, I've added it to the queue along with 18.1.0-rc4, which was just released. I'll message you when I have them uploaded.

This is now done, please let me know if there are any issues!

Thanks a ton Nathan! That was very fast.

I gave them all (15, 16, 17, 18.1.0-rc4) a test (but only x86_64), and they worked fine -- I could boot-test in QEMU (x86_64) a Rust-enabled kernel and load the sample modules:

CONFIG_CC_VERSION_TEXT="ClangBuiltLinux clang version 15.0.7
(https://github.com/llvm/llvm-project.git
8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)" CONFIG_CC_VERSION_TEXT="ClangBuiltLinux clang version 16.0.6
(https://github.com/llvm/llvm-project.git
7cbf1a2591520c2491aa35339f227775f4d3adf6)" CONFIG_CC_VERSION_TEXT="ClangBuiltLinux clang version 17.0.6
(https://github.com/llvm/llvm-project.git
6009708b4367171ccdbf4b5905cb6a803753fe18)" CONFIG_CC_VERSION_TEXT="ClangBuiltLinux clang version 18.1.0rc
(https://github.com/llvm/llvm-project.git
461274b81d8641eab64d494accddc81d7db8a09e)"

Cheers,
Miguel