@@ -12,25 +12,28 @@ use core::ptr::{self, NonNull};
12
12
13
13
unsafe extern "Rust" {
14
14
// 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
16
16
// (the code expanding that attribute macro generates those functions), or to call
17
17
// the default implementations in std (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
18
18
// 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.
21
19
#[ rustc_allocator]
22
20
#[ rustc_nounwind]
21
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
23
22
fn __rust_alloc ( size : usize , align : usize ) -> * mut u8 ;
24
23
#[ rustc_deallocator]
25
24
#[ rustc_nounwind]
25
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
26
26
fn __rust_dealloc ( ptr : * mut u8 , size : usize , align : usize ) ;
27
27
#[ rustc_reallocator]
28
28
#[ rustc_nounwind]
29
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
29
30
fn __rust_realloc ( ptr : * mut u8 , old_size : usize , align : usize , new_size : usize ) -> * mut u8 ;
30
31
#[ rustc_allocator_zeroed]
31
32
#[ rustc_nounwind]
33
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
32
34
fn __rust_alloc_zeroed ( size : usize , align : usize ) -> * mut u8 ;
33
35
36
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
34
37
static __rust_no_alloc_shim_is_unstable: u8 ;
35
38
}
36
39
@@ -359,6 +362,7 @@ unsafe extern "Rust" {
359
362
// This is the magic symbol to call the global alloc error handler. rustc generates
360
363
// it to call `__rg_oom` if there is a `#[alloc_error_handler]`, or to call the
361
364
// default implementations below (`__rdl_oom`) otherwise.
365
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
362
366
fn __rust_alloc_error_handler ( size : usize , align : usize ) -> !;
363
367
}
364
368
@@ -429,6 +433,7 @@ pub mod __alloc_error_handler {
429
433
unsafe extern "Rust" {
430
434
// This symbol is emitted by rustc next to __rust_alloc_error_handler.
431
435
// Its value depends on the -Zoom={panic,abort} compiler option.
436
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
432
437
static __rust_alloc_error_handler_should_panic: u8 ;
433
438
}
434
439
0 commit comments