Rollup merge of #108017 - chbaker0:fix-105967, r=chbaker0
Add `--no-undefined-version` link flag and fix associated breakage LLVM upstream sets `--no-undefined-version` by default in lld: https://reviews.llvm.org/D135402. Due to a bug in how version scripts are generated, this breaks the `dylib` output type for most crates. See https://github.com/rust-lang/rust/issues/105967#issuecomment-1428671533 for details. This PR adds the flag to gcc flavor linkers in anticipation of this LLVM change rolling in, and patches `rustc` to not attempt to export `__rust_*` allocator symbols when they weren't generated. Fixes #105967
This commit is contained in:
commit
b23a3a36ed
@ -4,6 +4,7 @@
|
|||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
|
use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
|
||||||
|
use rustc_codegen_ssa::base::allocator_kind_for_codegen;
|
||||||
use rustc_session::config::OomStrategy;
|
use rustc_session::config::OomStrategy;
|
||||||
use rustc_span::symbol::sym;
|
use rustc_span::symbol::sym;
|
||||||
|
|
||||||
@ -13,13 +14,7 @@ pub(crate) fn codegen(
|
|||||||
module: &mut impl Module,
|
module: &mut impl Module,
|
||||||
unwind_context: &mut UnwindContext,
|
unwind_context: &mut UnwindContext,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let any_dynamic_crate = tcx.dependency_formats(()).iter().any(|(_, list)| {
|
let Some(kind) = allocator_kind_for_codegen(tcx) else { return false };
|
||||||
use rustc_middle::middle::dependency_format::Linkage;
|
|
||||||
list.iter().any(|&linkage| linkage == Linkage::Dynamic)
|
|
||||||
});
|
|
||||||
if any_dynamic_crate {
|
|
||||||
false
|
|
||||||
} else if let Some(kind) = tcx.allocator_kind(()) {
|
|
||||||
codegen_inner(
|
codegen_inner(
|
||||||
module,
|
module,
|
||||||
unwind_context,
|
unwind_context,
|
||||||
@ -28,9 +23,6 @@ pub(crate) fn codegen(
|
|||||||
tcx.sess.opts.unstable_opts.oom,
|
tcx.sess.opts.unstable_opts.oom,
|
||||||
);
|
);
|
||||||
true
|
true
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn codegen_inner(
|
fn codegen_inner(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user