Skip to content

one-line config for using rust-lld #11378

@skyzh

Description

@skyzh

Problem

I'm thinking of if it is possible to use rust-lld installed by rustup component add llvm-tools-preview using a one-line config like linker=rust-lld. Currently configuring it on macOS is relatively hard.

Basically what I'm doing now is like:

rustflags = [
    "-Clink-arg=-fuse-ld=/Users/skyzh/.rustup/toolchains/nightly-2022-10-16-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin/gcc-ld/ld64.lld",
]

Probably we can do something to make the configuration easier?

Proposed Solution

If linker = 'rust-lld' in config.toml, we can automatically generate the args for rustc by appending

 "-Clink-arg=-fuse-ld=${RUSTUP_TOOLCHAIN_PATH}/lib/rustlib/${ARCH}/bin/gcc-ld/ld64.lld"

to rustflags, so that we can easily use the rust-lld linker installed with rustup.

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-configurationArea: cargo config files and env varsA-rustflagsArea: rustflagsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions