Skip to content

Commit

Permalink
Remove support for alias -Z symbol-mangling-version
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalathar committed Nov 2, 2023
1 parent a9e1e43 commit 76103a8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 26 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,6 @@ fn test_unstable_options_tracking_hash() {
tracked!(split_lto_unit, Some(true));
tracked!(src_hash_algorithm, Some(SourceFileHashAlgorithm::Sha1));
tracked!(stack_protector, StackProtector::All);
tracked!(symbol_mangling_version, Some(SymbolManglingVersion::V0));
tracked!(teach, true);
tracked!(thinlto, Some(true));
tracked!(thir_unsafeck, true);
Expand Down
33 changes: 12 additions & 21 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2674,28 +2674,19 @@ pub fn build_session_options(
);
}

// Handle both `-Z symbol-mangling-version` and `-C symbol-mangling-version`; the latter takes
// precedence.
match (cg.symbol_mangling_version, unstable_opts.symbol_mangling_version) {
(Some(smv_c), Some(smv_z)) if smv_c != smv_z => {
handler.early_error(
"incompatible values passed for `-C symbol-mangling-version` \
and `-Z symbol-mangling-version`",
);
}
(Some(SymbolManglingVersion::V0), _) => {}
(Some(_), _) if !unstable_opts.unstable_options => {
handler
.early_error("`-C symbol-mangling-version=legacy` requires `-Z unstable-options`");
}
(None, None) => {}
(None, smv) => {
handler.early_warn(
"`-Z symbol-mangling-version` is deprecated; use `-C symbol-mangling-version`",
);
cg.symbol_mangling_version = smv;
// Check for unstable values of `-C symbol-mangling-version`.
// This is what prevents them from being used on stable compilers.
match cg.symbol_mangling_version {
// Stable values:
None | Some(SymbolManglingVersion::V0) => {}
// Unstable values:
Some(SymbolManglingVersion::Legacy) => {
if !unstable_opts.unstable_options {
handler.early_error(
"`-C symbol-mangling-version=legacy` requires `-Z unstable-options`",
);
}
}
_ => {}
}

// Check for unstable values of `-C instrument-coverage`.
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1823,9 +1823,6 @@ written to standard error output)"),
"control if mem::uninitialized and mem::zeroed panic on more UB"),
strip: Strip = (Strip::None, parse_strip, [UNTRACKED],
"tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`)"),
symbol_mangling_version: Option<SymbolManglingVersion> = (None,
parse_symbol_mangling_version, [TRACKED],
"which mangling version to use for symbol names ('legacy' (default) or 'v0')"),
#[rustc_lint_opt_deny_field_access("use `Session::teach` instead of this field")]
teach: bool = (false, parse_bool, [TRACKED],
"show extended diagnostic help (default: no)"),
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/crate-hash-rustc-version/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include ../tools.mk
# Ensure that crates compiled with different rustc versions cannot
# be dynamically linked.

FLAGS := -Cprefer-dynamic -Zsymbol-mangling-version=v0
FLAGS := -Cprefer-dynamic -Csymbol-mangling-version=v0
UNAME := $(shell uname)
ifeq ($(UNAME),Linux)
EXT=".so"
Expand Down

0 comments on commit 76103a8

Please sign in to comment.