@@ -10,25 +10,28 @@ use core::ptr::{self, NonNull};
1010
1111unsafe extern "Rust" {
1212 // These are the magic symbols to call the global allocator. rustc generates
13- // them to call `__rg_alloc` etc. if there is a `#[global_allocator]` attribute
13+ // them to call the global allocator if there is a `#[global_allocator]` attribute
1414 // (the code expanding that attribute macro generates those functions), or to call
1515 // the default implementations in std (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
1616 // otherwise.
17- // The rustc fork of LLVM 14 and earlier also special-cases these function names to be able to optimize them
18- // like `malloc`, `realloc`, and `free`, respectively.
1917 #[ rustc_allocator]
2018 #[ rustc_nounwind]
19+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
2120 fn __rust_alloc ( size : usize , align : usize ) -> * mut u8 ;
2221 #[ rustc_deallocator]
2322 #[ rustc_nounwind]
23+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
2424 fn __rust_dealloc ( ptr : * mut u8 , size : usize , align : usize ) ;
2525 #[ rustc_reallocator]
2626 #[ rustc_nounwind]
27+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
2728 fn __rust_realloc ( ptr : * mut u8 , old_size : usize , align : usize , new_size : usize ) -> * mut u8 ;
2829 #[ rustc_allocator_zeroed]
2930 #[ rustc_nounwind]
31+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
3032 fn __rust_alloc_zeroed ( size : usize , align : usize ) -> * mut u8 ;
3133
34+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
3235 static __rust_no_alloc_shim_is_unstable: u8 ;
3336}
3437
@@ -357,6 +360,7 @@ unsafe extern "Rust" {
357360 // This is the magic symbol to call the global alloc error handler. rustc generates
358361 // it to call `__rg_oom` if there is a `#[alloc_error_handler]`, or to call the
359362 // default implementations below (`__rdl_oom`) otherwise.
363+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
360364 fn __rust_alloc_error_handler ( size : usize , align : usize ) -> !;
361365}
362366
@@ -423,6 +427,7 @@ pub mod __alloc_error_handler {
423427 unsafe extern "Rust" {
424428 // This symbol is emitted by rustc next to __rust_alloc_error_handler.
425429 // Its value depends on the -Zoom={panic,abort} compiler option.
430+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
426431 static __rust_alloc_error_handler_should_panic: u8 ;
427432 }
428433
0 commit comments