@@ -17,25 +17,28 @@ mod tests;
1717
1818extern "Rust" {
1919 // These are the magic symbols to call the global allocator. rustc generates
20- // them to call `__rg_alloc` etc. if there is a `#[global_allocator]` attribute
20+ // them to call the global allocator if there is a `#[global_allocator]` attribute
2121 // (the code expanding that attribute macro generates those functions), or to call
2222 // the default implementations in std (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
2323 // otherwise.
24- // The rustc fork of LLVM 14 and earlier also special-cases these function names to be able to optimize them
25- // like `malloc`, `realloc`, and `free`, respectively.
2624 #[ rustc_allocator]
2725 #[ rustc_nounwind]
26+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
2827 fn __rust_alloc ( size : usize , align : usize ) -> * mut u8 ;
2928 #[ rustc_deallocator]
3029 #[ rustc_nounwind]
30+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
3131 fn __rust_dealloc ( ptr : * mut u8 , size : usize , align : usize ) ;
3232 #[ rustc_reallocator]
3333 #[ rustc_nounwind]
34+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
3435 fn __rust_realloc ( ptr : * mut u8 , old_size : usize , align : usize , new_size : usize ) -> * mut u8 ;
3536 #[ rustc_allocator_zeroed]
3637 #[ rustc_nounwind]
38+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
3739 fn __rust_alloc_zeroed ( size : usize , align : usize ) -> * mut u8 ;
3840
41+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
3942 static __rust_no_alloc_shim_is_unstable: u8 ;
4043}
4144
@@ -342,6 +345,7 @@ extern "Rust" {
342345 // This is the magic symbol to call the global alloc error handler. rustc generates
343346 // it to call `__rg_oom` if there is a `#[alloc_error_handler]`, or to call the
344347 // default implementations below (`__rdl_oom`) otherwise.
348+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
345349 fn __rust_alloc_error_handler ( size : usize , align : usize ) -> !;
346350}
347351
@@ -411,6 +415,7 @@ pub mod __alloc_error_handler {
411415 extern "Rust" {
412416 // This symbol is emitted by rustc next to __rust_alloc_error_handler.
413417 // Its value depends on the -Zoom={panic,abort} compiler option.
418+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
414419 static __rust_alloc_error_handler_should_panic: u8 ;
415420 }
416421
0 commit comments