Skip to content

Commit 200b689

Browse files
Kobzollqd
authored andcommitted
Move -Zlinker-features to -Clinker-features
1 parent 863344f commit 200b689

File tree

10 files changed

+17
-17
lines changed

10 files changed

+17
-17
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,7 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
14141414
}
14151415
}
14161416

1417-
let features = sess.opts.unstable_opts.linker_features;
1417+
let features = sess.opts.cg.linker_features;
14181418

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

compiler/rustc_session/src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ impl LinkSelfContained {
391391
}
392392
}
393393

394-
/// The different values that `-Z linker-features` can take on the CLI: a list of individually
394+
/// The different values that `-C linker-features` can take on the CLI: a list of individually
395395
/// enabled or disabled features used during linking.
396396
///
397397
/// 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
@@ -1988,6 +1988,8 @@ options! {
19881988
on a C toolchain or linker installed in the system"),
19891989
linker: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
19901990
"system linker to link outputs with"),
1991+
linker_features: LinkerFeaturesCli = (LinkerFeaturesCli::default(), parse_linker_features, [UNTRACKED],
1992+
"a comma-separated list of linker features to enable (+) or disable (-): `lld`"),
19911993
linker_flavor: Option<LinkerFlavorCli> = (None, parse_linker_flavor, [UNTRACKED],
19921994
"linker flavor"),
19931995
linker_plugin_lto: LinkerPluginLto = (LinkerPluginLto::Disabled,
@@ -2273,8 +2275,6 @@ options! {
22732275
"link native libraries in the linker invocation (default: yes)"),
22742276
link_only: bool = (false, parse_bool, [TRACKED],
22752277
"link the `.rlink` file generated by `-Z no-link` (default: no)"),
2276-
linker_features: LinkerFeaturesCli = (LinkerFeaturesCli::default(), parse_linker_features, [UNTRACKED],
2277-
"a comma-separated list of linker features to enable (+) or disable (-): `lld`"),
22782278
lint_llvm_ir: bool = (false, parse_bool, [TRACKED],
22792279
"lint LLVM IR (default: no)"),
22802280
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

+6-6
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

21-
// 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"));
21+
// It should not be used when we explicitly opt-out of lld.
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)