Skip to content

Using rules_rust toolchain lld for linking Rust + C++ (cross-language LTO with older clang bitcode than Rust)? #3709

@sthornington

Description

@sthornington

Hi folks,

I'm trying to do Rust-C++ interop with cross-language ThinLTO - in our environment, clang is only at 18 but Rust is all the way current at 1.90.0. The only way I have found that I can link these things is by using clang++ as the linker front-end, but with -fuse-ld=<path-to-that-lld> but I am running into difficulty programmatically getting a label of the path to this binary so that it can be passed to the CC toolchain.

Has anyone been able to do this? It does seem to work as long as the linker is newer than all the bitcode in the objects, but I'm just kinda stuck on the bazel toolchain part, of finding a query or location or something that can be evaluated early enough in the repo/toolchain steps.

Thanks!

Simon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions