Skip to content

add a RUSTLINKFLAGS environment variable #4349

@froydnj

Description

@froydnj

The motivating example here is when you want to have development and release profiles with lto = false, because LTO is so expensive. Why not put lto = true in your release profile? Because the release profile might not be used for releases, per se; it might be used for people doing local development, and they don't want to bear the burden of compiling with LTO all the time. They want to compile with optimization on so at least their performance measurements are not completely out of whack.

But you do want to compile with LTO at certain times: when you're doing a formal release of your software, for instance. It would be convenient to turn LTO on via -C lto in RUSTFLAGS...but -C lto isn't valid for all places where RUSTFLAGS would be passed.

Hence the request for a RUSTLINKFLAGS or similar that would specify flags to be used in the final link of a binary artifact.

This could be made somewhat superfluous by #2007, where we could specify another profile for "release releases", but it might still be handy to have for flags that can't be injected via Cargo.toml.

/cc @luser @glandium

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.A-environment-variablesArea: environment variablesA-profilesArea: profilesA-rustflagsArea: rustflagsC-bugCategory: bugS-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