Replies: 1 comment 1 reply
-
This is basically because rustc is a full-on compiler driver like Clang is, that also calls the linker, but has a lot of hardcoded linker flags. The exact same thing happens with the target wasm32-unknown-unknown. In that configuration rustc only knows how to call one linker, that being its bundled build of LLD, So to make rustc happy, you need to change the linker. With Buck, the linker is set on the cxx toolchain.. You can either have the cxx toolchain's linker be plain LLD (or whatever else rustc wants you to use), or a shell script that rewrites args. In your case plain LLD is probably the go. This is different from ld.lld; ld.lld is equivalent to There isn't a way to configure the Please note that you will need to configure the linker using a my_custom_cxx_toolchain_rule(
name = "cxx",
linker = select({
"config//os:none": select({
"config//cpu:arm64": "/path/to/rust-lld",
}),
"DEFAULT": "clang++",
}),
) This way Buck will e.g. link proc-macros for your dev machine using clang++, and then link final binaries for this target using rust-lld. |
Beta Was this translation helpful? Give feedback.
-
I'm trying to pass linker_flags to rust_binary with
-Tsome/linker/script.ld
. Attempting to userustc_target_triple = "aarch64-unknown-none",
with system_rust_toolchain seems to giveI can't seem to set it to use ld.lld directly because that causes
I also had to add
Beta Was this translation helpful? Give feedback.
All reactions