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;
This commit is contained in:
parent
2be697f60d
commit
da466a2adc
@ -3,7 +3,7 @@
|
|||||||
use gccjit::{FunctionType, GlobalKind, ToRValue};
|
use gccjit::{FunctionType, GlobalKind, ToRValue};
|
||||||
use rustc_ast::expand::allocator::{
|
use rustc_ast::expand::allocator::{
|
||||||
alloc_error_handler_name, default_fn_name, global_fn_name, AllocatorKind, AllocatorTy,
|
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::bug;
|
||||||
use rustc_middle::ty::TyCtxt;
|
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 = tcx.sess.opts.unstable_opts.oom.should_panic();
|
||||||
let value = context.new_rvalue_from_int(i8, value as i32);
|
let value = context.new_rvalue_from_int(i8, value as i32);
|
||||||
global.global_set_initializer_rvalue(value);
|
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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user