about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-12-02 13:52:47 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-03-17 14:06:56 +0000
commit42de015549ad6e60d6f0e603daf0948259a2840d (patch)
tree624e29f89b18f3bac4c05342f3a08975b0d1d0c0 /library/alloc/src
parent60b785fc8d2ca002189c7c4956f46e3ebe66fb63 (diff)
downloadrust-42de015549ad6e60d6f0e603daf0948259a2840d.tar.gz
rust-42de015549ad6e60d6f0e603daf0948259a2840d.zip
Mark imports of #[rustc_std_internal_symbol] items with this attribute
This ensures that they will be correctly mangled in a future commit.
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/alloc.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs
index 2f752f6eb39..1e03a191276 100644
--- a/library/alloc/src/alloc.rs
+++ b/library/alloc/src/alloc.rs
@@ -10,25 +10,28 @@ use core::ptr::{self, NonNull};
 
 unsafe extern "Rust" {
     // These are the magic symbols to call the global allocator. rustc generates
-    // them to call `__rg_alloc` etc. if there is a `#[global_allocator]` attribute
+    // them to call the global allocator if there is a `#[global_allocator]` attribute
     // (the code expanding that attribute macro generates those functions), or to call
     // the default implementations in std (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
     // otherwise.
-    // The rustc fork of LLVM 14 and earlier also special-cases these function names to be able to optimize them
-    // like `malloc`, `realloc`, and `free`, respectively.
     #[rustc_allocator]
     #[rustc_nounwind]
+    #[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
     fn __rust_alloc(size: usize, align: usize) -> *mut u8;
     #[rustc_deallocator]
     #[rustc_nounwind]
+    #[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
     fn __rust_dealloc(ptr: *mut u8, size: usize, align: usize);
     #[rustc_reallocator]
     #[rustc_nounwind]
+    #[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
     fn __rust_realloc(ptr: *mut u8, old_size: usize, align: usize, new_size: usize) -> *mut u8;
     #[rustc_allocator_zeroed]
     #[rustc_nounwind]
+    #[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
     fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8;
 
+    #[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
     static __rust_no_alloc_shim_is_unstable: u8;
 }
 
@@ -357,6 +360,7 @@ unsafe extern "Rust" {
     // This is the magic symbol to call the global alloc error handler. rustc generates
     // it to call `__rg_oom` if there is a `#[alloc_error_handler]`, or to call the
     // default implementations below (`__rdl_oom`) otherwise.
+    #[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
     fn __rust_alloc_error_handler(size: usize, align: usize) -> !;
 }
 
@@ -423,6 +427,7 @@ pub mod __alloc_error_handler {
         unsafe extern "Rust" {
             // This symbol is emitted by rustc next to __rust_alloc_error_handler.
             // Its value depends on the -Zoom={panic,abort} compiler option.
+            #[cfg_attr(not(bootstrap), rustc_std_internal_symbol)]
             static __rust_alloc_error_handler_should_panic: u8;
         }