Skip to content

Commit d7e02c2

Browse files
committed
Move -Zlinker-features to -Clinker-features
1 parent 80cbbeb commit d7e02c2

File tree

10 files changed

+16
-16
lines changed

10 files changed

+16
-16
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
14181418
}
14191419
}
14201420

1421-
let features = sess.opts.unstable_opts.linker_features;
1421+
let features = sess.opts.cg.linker_features;
14221422

14231423
// linker and linker flavor specified via command line have precedence over what the target
14241424
// specification specifies

compiler/rustc_session/src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl LinkSelfContained {
389389
}
390390
}
391391

392-
/// The different values that `-Z linker-features` can take on the CLI: a list of individually
392+
/// The different values that `-C linker-features` can take on the CLI: a list of individually
393393
/// enabled or disabled features used during linking.
394394
///
395395
/// There is no need to enable or disable them in bulk. Each feature is fine-grained, and can be

compiler/rustc_session/src/options.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1983,6 +1983,8 @@ options! {
19831983
on a C toolchain or linker installed in the system"),
19841984
linker: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
19851985
"system linker to link outputs with"),
1986+
linker_features: LinkerFeaturesCli = (LinkerFeaturesCli::default(), parse_linker_features, [UNTRACKED],
1987+
"a comma-separated list of linker features to enable (+) or disable (-): `lld`"),
19861988
linker_flavor: Option<LinkerFlavorCli> = (None, parse_linker_flavor, [UNTRACKED],
19871989
"linker flavor"),
19881990
linker_plugin_lto: LinkerPluginLto = (LinkerPluginLto::Disabled,
@@ -2263,8 +2265,6 @@ options! {
22632265
"link native libraries in the linker invocation (default: yes)"),
22642266
link_only: bool = (false, parse_bool, [TRACKED],
22652267
"link the `.rlink` file generated by `-Z no-link` (default: no)"),
2266-
linker_features: LinkerFeaturesCli = (LinkerFeaturesCli::default(), parse_linker_features, [UNTRACKED],
2267-
"a comma-separated list of linker features to enable (+) or disable (-): `lld`"),
22682268
lint_llvm_ir: bool = (false, parse_bool, [TRACKED],
22692269
"lint LLVM IR (default: no)"),
22702270
lint_mir: bool = (false, parse_bool, [UNTRACKED],

compiler/rustc_target/src/spec/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ impl ToJson for LinkSelfContainedComponents {
718718
}
719719

720720
bitflags::bitflags! {
721-
/// The `-Z linker-features` components that can individually be enabled or disabled.
721+
/// The `-C linker-features` components that can individually be enabled or disabled.
722722
///
723723
/// They are feature flags intended to be a more flexible mechanism than linker flavors, and
724724
/// also to prevent a combinatorial explosion of flavors whenever a new linker feature is
@@ -749,7 +749,7 @@ bitflags::bitflags! {
749749
rustc_data_structures::external_bitflags_debug! { LinkerFeatures }
750750

751751
impl LinkerFeatures {
752-
/// Parses a single `-Z linker-features` well-known feature, not a set of flags.
752+
/// Parses a single `-C linker-features` well-known feature, not a set of flags.
753753
pub fn from_str(s: &str) -> Option<LinkerFeatures> {
754754
Some(match s {
755755
"cc" => LinkerFeatures::CC,

tests/run-make/compressed-debuginfo-zstd/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn prepare_and_check<F: FnOnce(&mut Rustc) -> &mut Rustc>(to_find: &str, prepare
2626
run_in_tmpdir(|| {
2727
let mut rustc = Rustc::new();
2828
rustc
29-
.arg("-Zlinker-features=+lld")
29+
.arg("-Clinker-features=+lld")
3030
.arg("-Clink-self-contained=+linker")
3131
.arg("-Zunstable-options")
3232
.arg("-Cdebuginfo=full")

tests/run-make/rust-lld-custom-target/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() {
2323
rustc()
2424
.crate_type("cdylib")
2525
.target("custom-target.json")
26-
.arg("-Zlinker-features=-lld")
26+
.arg("-Clinker-features=-lld")
2727
.input("lib.rs"),
2828
);
2929
}

tests/run-make/rust-lld-link-script-provide/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use run_make_support::rustc;
1010
fn main() {
1111
rustc()
1212
.input("main.rs")
13-
.arg("-Zlinker-features=+lld")
13+
.arg("-Clinker-features=+lld")
1414
.arg("-Clink-self-contained=+linker")
1515
.arg("-Zunstable-options")
1616
.link_arg("-Tscript.t")

tests/run-make/rust-lld-x86_64-unknown-linux-gnu-dist/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ fn main() {
1212
assert_rustc_uses_lld(rustc().input("main.rs"));
1313

1414
// But it can still be disabled by turning the linker feature off.
15-
assert_rustc_doesnt_use_lld(rustc().arg("-Zlinker-features=-lld").input("main.rs"));
15+
assert_rustc_doesnt_use_lld(rustc().arg("-Clinker-features=-lld").input("main.rs"));
1616
}

tests/run-make/rust-lld-x86_64-unknown-linux-gnu/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ fn main() {
1616
assert_rustc_uses_lld(rustc().input("main.rs"));
1717

1818
// But it can still be disabled by turning the linker feature off.
19-
assert_rustc_doesnt_use_lld(rustc().arg("-Zlinker-features=-lld").input("main.rs"));
19+
assert_rustc_doesnt_use_lld(rustc().arg("-Clinker-features=-lld").input("main.rs"));
2020
}

tests/run-make/rust-lld/rmake.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ fn main() {
1212
// asking the linker to display its version number with a link-arg.
1313
assert_rustc_uses_lld(
1414
rustc()
15-
.arg("-Zlinker-features=+lld")
15+
.arg("-Clinker-features=+lld")
1616
.arg("-Clink-self-contained=+linker")
1717
.arg("-Zunstable-options")
1818
.input("main.rs"),
1919
);
2020

2121
// It should not be used when we explicitly opt-out of lld.
22-
assert_rustc_doesnt_use_lld(rustc().arg("-Zlinker-features=-lld").input("main.rs"));
22+
assert_rustc_doesnt_use_lld(rustc().arg("-Clinker-features=-lld").input("main.rs"));
2323

2424
// While we're here, also check that the last linker feature flag "wins" when passed multiple
2525
// times to rustc.
2626
assert_rustc_uses_lld(
2727
rustc()
2828
.arg("-Clink-self-contained=+linker")
2929
.arg("-Zunstable-options")
30-
.arg("-Zlinker-features=-lld")
31-
.arg("-Zlinker-features=+lld")
32-
.arg("-Zlinker-features=-lld,+lld")
30+
.arg("-Clinker-features=-lld")
31+
.arg("-Clinker-features=+lld")
32+
.arg("-Clinker-features=-lld,+lld")
3333
.input("main.rs"),
3434
);
3535
}

0 commit comments

Comments
 (0)