@@ -12,25 +12,28 @@ use core::ptr::{self, NonNull};
1212
1313extern "Rust" {
1414 // These are the magic symbols to call the global allocator. rustc generates
15- // them to call `__rg_alloc` etc. if there is a `#[global_allocator]` attribute
15+ // them to call the global allocator if there is a `#[global_allocator]` attribute
1616 // (the code expanding that attribute macro generates those functions), or to call
1717 // the default implementations in std (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
1818 // otherwise.
19- // The rustc fork of LLVM 14 and earlier also special-cases these function names to be able to optimize them
20- // like `malloc`, `realloc`, and `free`, respectively.
2119 #[ rustc_allocator]
2220 #[ rustc_nounwind]
21+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
2322 fn __rust_alloc ( size : usize , align : usize ) -> * mut u8 ;
2423 #[ rustc_deallocator]
2524 #[ rustc_nounwind]
25+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
2626 fn __rust_dealloc ( ptr : * mut u8 , size : usize , align : usize ) ;
2727 #[ rustc_reallocator]
2828 #[ rustc_nounwind]
29+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
2930 fn __rust_realloc ( ptr : * mut u8 , old_size : usize , align : usize , new_size : usize ) -> * mut u8 ;
3031 #[ rustc_allocator_zeroed]
3132 #[ rustc_nounwind]
33+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
3234 fn __rust_alloc_zeroed ( size : usize , align : usize ) -> * mut u8 ;
3335
36+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
3437 static __rust_no_alloc_shim_is_unstable: u8 ;
3538}
3639
@@ -359,6 +362,7 @@ extern "Rust" {
359362 // This is the magic symbol to call the global alloc error handler. rustc generates
360363 // it to call `__rg_oom` if there is a `#[alloc_error_handler]`, or to call the
361364 // default implementations below (`__rdl_oom`) otherwise.
365+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
362366 fn __rust_alloc_error_handler ( size : usize , align : usize ) -> !;
363367}
364368
@@ -429,6 +433,7 @@ pub mod __alloc_error_handler {
429433 extern "Rust" {
430434 // This symbol is emitted by rustc next to __rust_alloc_error_handler.
431435 // Its value depends on the -Zoom={panic,abort} compiler option.
436+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
432437 static __rust_alloc_error_handler_should_panic: u8 ;
433438 }
434439
0 commit comments