diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2022-09-10 11:33:44 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-05-11 14:35:09 +0000 |
| commit | da466a2adc6aa4a1250a7022d216b35ef25e3fbd (patch) | |
| tree | 46a33c9811ac1eb8f62642dde998985b1e00a66f | |
| parent | 2be697f60d53fe321a74fb99d3cde452a94eb3da (diff) | |
| download | rust-da466a2adc6aa4a1250a7022d216b35ef25e3fbd.tar.gz rust-da466a2adc6aa4a1250a7022d216b35ef25e3fbd.zip | |
Prevent insta-stable no alloc shim support
You will need to add the following as replacement for the old __rust_*
definitions when not using the alloc shim.
#[no_mangle]
static __rust_no_alloc_shim_is_unstable: u8 = 0;
| -rw-r--r-- | src/allocator.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/allocator.rs b/src/allocator.rs index ff68de8c8f1..13f88192bbc 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -3,7 +3,7 @@ use gccjit::FnAttribute; use gccjit::{FunctionType, GlobalKind, ToRValue}; use rustc_ast::expand::allocator::{ alloc_error_handler_name, default_fn_name, global_fn_name, AllocatorKind, AllocatorTy, - ALLOCATOR_METHODS, + ALLOCATOR_METHODS, NO_ALLOC_SHIM_IS_UNSTABLE, }; use rustc_middle::bug; use rustc_middle::ty::TyCtxt; @@ -127,4 +127,9 @@ pub(crate) unsafe fn codegen(tcx: TyCtxt<'_>, mods: &mut GccContext, _module_nam let value = tcx.sess.opts.unstable_opts.oom.should_panic(); let value = context.new_rvalue_from_int(i8, value as i32); global.global_set_initializer_rvalue(value); + + let name = NO_ALLOC_SHIM_IS_UNSTABLE.to_string(); + let global = context.new_global(None, GlobalKind::Exported, i8, name); + let value = context.new_rvalue_from_int(i8, 0); + global.global_set_initializer_rvalue(value); } |
