summaryrefslogtreecommitdiff
path: root/compiler/rustc_codegen_cranelift
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-11 07:28:44 +0000
committerbors <bors@rust-lang.org>2023-03-11 07:28:44 +0000
commite350fe4e608b653da47e8012d13ef701613e717b (patch)
tree32bb29f8449dd0701a30197fe3222bc13f4a170e /compiler/rustc_codegen_cranelift
parent19c53768af6e48514238e4224b5bf5ecd51bc7b1 (diff)
parent030ea0578fb361b66becc898547cec406f3c53ce (diff)
downloadrust-e350fe4e608b653da47e8012d13ef701613e717b.tar.gz
Auto merge of #109001 - matthiaskrgr:rollup-a3agnwp, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #105798 (Relax ordering rules for `asm!` operands) - #105962 (Stabilize path_as_mut_os_str) - #106085 (use problem matchers for tidy CI) - #107711 (Stabilize movbe target feature) - #108017 (Add `--no-undefined-version` link flag and fix associated breakage) - #108891 (Remove an extraneous include) - #108902 (no more do while :<) - #108912 (Document tool lints) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_cranelift')
-rw-r--r--compiler/rustc_codegen_cranelift/src/allocator.rs28
1 files changed, 10 insertions, 18 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/allocator.rs b/compiler/rustc_codegen_cranelift/src/allocator.rs
index 1c73957ca57..2c246ceb37d 100644
--- a/compiler/rustc_codegen_cranelift/src/allocator.rs
+++ b/compiler/rustc_codegen_cranelift/src/allocator.rs
@@ -4,6 +4,7 @@
use crate::prelude::*;
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_span::symbol::sym;
@@ -13,24 +14,15 @@ pub(crate) fn codegen(
module: &mut impl Module,
unwind_context: &mut UnwindContext,
) -> bool {
- let any_dynamic_crate = tcx.dependency_formats(()).iter().any(|(_, list)| {
- 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(
- module,
- unwind_context,
- kind,
- tcx.alloc_error_handler_kind(()).unwrap(),
- tcx.sess.opts.unstable_opts.oom,
- );
- true
- } else {
- false
- }
+ let Some(kind) = allocator_kind_for_codegen(tcx) else { return false };
+ codegen_inner(
+ module,
+ unwind_context,
+ kind,
+ tcx.alloc_error_handler_kind(()).unwrap(),
+ tcx.sess.opts.unstable_opts.oom,
+ );
+ true
}
fn codegen_inner(