ProjectSerenity / firefly

[WIP] Firefly is a research OS inspired by Linux and Plan 9.
BSD 3-Clause "New" or "Revised" License
12 stars 0 forks source link

bazel: Bring in `llvm-tools` for use in the build tooling #12

Closed SlyMarbo closed 2 years ago

SlyMarbo commented 2 years ago

We currently use llvm-tools in both the bootloader's build script and the bootimage to build the bootable image. In both cases, this uses the llvm-tools crate. This will work correctly if the tools have been installed with rustup component add llvm-tools-preview, but not if they haven't. We don't want to depend on Rust having been installed previously outside Bazel.

It appears that the llvm-tools are installed by rules_rust by default, so they are available in Bazel, they just aren't being picked up by the llvm-tools crate. We should fix that, then we'll have one fewer requirement on the host environment.

SlyMarbo commented 2 years ago

Eyeballing the code here and comparing it with the layout produced by rules_rust, this should be working already. As mentioned above, rules_rust already pulls in llvm-tools. rustc is at @rust_linux_x86_64//bin:rustc and calling rustc --print sysroot returns an absolute path to @rust_linux_x86_64. The llvm-tools crate effectively looks for SYSROOT/lib/rustlib/*/bin/llvm-objdump. Locally, that works, resolving to the path @rust_linux_x86_64//lib/rustlib/x86_64-unknown-linux-gnu/bin:llvm-objdump.

I'm going to leave this as low priority for now, unless it starts causing real issues.

SlyMarbo commented 2 years ago

I reckon this is fixed by 813727b8c767937cafa84da64b8c586d38f22a46. If that turns out not to be true, this can be reopened later.