Skip to content

Incorrect RUSTFLAGS parsing #3287

Closed
Closed
@lucab

Description

@lucab

It looks like env_args() is blindly splitting env args on spaces, making -C link-args impossible to use.

This happens when trying to use multiple linker args:

$ rustc -C help | grep link-args
    -C         link-args=val -- extra arguments to pass to the linker (space separated)

$ RUSTFLAGS='-C link-args="-fPIE -pie -Wl,-z,relro -Wl,-z,now"' ./target/release/cargo build --verbose
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name _ --print=file-names -C link-args="-fPIE -pie -Wl,-z,relro -Wl,-z,now" --crate-type bin --crate-type rlib --target x86_64-unknown-linux-gnu` (exit code: 101)
--- stderr
error: Unrecognized option: 'p'.

Output above is from current master (0.15.0-pre).

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