@@ -15,25 +15,28 @@ mod tests;
1515
1616extern "Rust" {
1717 // These are the magic symbols to call the global allocator. rustc generates
18- // them to call `__rg_alloc` etc. if there is a `#[global_allocator]` attribute
18+ // them to call the global allocator if there is a `#[global_allocator]` attribute
1919 // (the code expanding that attribute macro generates those functions), or to call
2020 // the default implementations in std (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
2121 // otherwise.
22- // The rustc fork of LLVM 14 and earlier also special-cases these function names to be able to optimize them
23- // like `malloc`, `realloc`, and `free`, respectively.
2422 #[ rustc_allocator]
2523 #[ rustc_nounwind]
24+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
2625 fn __rust_alloc ( size : usize , align : usize ) -> * mut u8 ;
2726 #[ rustc_deallocator]
2827 #[ rustc_nounwind]
28+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
2929 fn __rust_dealloc ( ptr : * mut u8 , size : usize , align : usize ) ;
3030 #[ rustc_reallocator]
3131 #[ rustc_nounwind]
32+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
3233 fn __rust_realloc ( ptr : * mut u8 , old_size : usize , align : usize , new_size : usize ) -> * mut u8 ;
3334 #[ rustc_allocator_zeroed]
3435 #[ rustc_nounwind]
36+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
3537 fn __rust_alloc_zeroed ( size : usize , align : usize ) -> * mut u8 ;
3638
39+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
3740 static __rust_no_alloc_shim_is_unstable: u8 ;
3841}
3942
@@ -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