@@ -17,25 +17,28 @@ mod tests;
17
17
18
18
extern "Rust" {
19
19
// 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
21
21
// (the code expanding that attribute macro generates those functions), or to call
22
22
// the default implementations in std (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
23
23
// 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.
26
24
#[ rustc_allocator]
27
25
#[ rustc_nounwind]
26
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
28
27
fn __rust_alloc ( size : usize , align : usize ) -> * mut u8 ;
29
28
#[ rustc_deallocator]
30
29
#[ rustc_nounwind]
30
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
31
31
fn __rust_dealloc ( ptr : * mut u8 , size : usize , align : usize ) ;
32
32
#[ rustc_reallocator]
33
33
#[ rustc_nounwind]
34
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
34
35
fn __rust_realloc ( ptr : * mut u8 , old_size : usize , align : usize , new_size : usize ) -> * mut u8 ;
35
36
#[ rustc_allocator_zeroed]
36
37
#[ rustc_nounwind]
38
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
37
39
fn __rust_alloc_zeroed ( size : usize , align : usize ) -> * mut u8 ;
38
40
41
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
39
42
static __rust_no_alloc_shim_is_unstable: u8 ;
40
43
}
41
44
@@ -342,6 +345,7 @@ extern "Rust" {
342
345
// This is the magic symbol to call the global alloc error handler. rustc generates
343
346
// it to call `__rg_oom` if there is a `#[alloc_error_handler]`, or to call the
344
347
// default implementations below (`__rdl_oom`) otherwise.
348
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
345
349
fn __rust_alloc_error_handler ( size : usize , align : usize ) -> !;
346
350
}
347
351
@@ -411,6 +415,7 @@ pub mod __alloc_error_handler {
411
415
extern "Rust" {
412
416
// This symbol is emitted by rustc next to __rust_alloc_error_handler.
413
417
// Its value depends on the -Zoom={panic,abort} compiler option.
418
+ #[ cfg_attr( not( bootstrap) , rustc_std_internal_symbol) ]
414
419
static __rust_alloc_error_handler_should_panic: u8 ;
415
420
}
416
421
0 commit comments