- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Description
This is a tracking issue for the experimental extern "rust-cold" ABI.
The feature gate for the issue is #![feature(rust_cold_cc)].
This allows emitting functions with coldcc in LLVM and CallConv::Cold in cranelift.  These are more aggressive than the stable #[cold], as they can use a different calling convention (and thus have incompatible fns), not just affect branch weights -- for example, they might require more/slower code in the callee in exchange for smaller call sites.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
- Implement
- Adjust documentation (see instructions on rustc-dev-guide)
- Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
-  How can we make using this compatible with mixing codegen backends -- particularly in the context of using an LLVM-compiled standard library with a cranelift-compiled binary or tests cc Use preserve_mostccforextern "rust-cold"#115260 (comment)
-  Should this be coldcc,preservemost_cc, or something else in LLVM?- clang offers clang::preserve_mostbut nothing named "cold", FWIW: https://clang.llvm.org/docs/AttributeReference.html#calling-conventions
- As a Rust-* convention we're not promising anything, so can always change the details later.
 
- clang offers 
Implementation history
-  Add support for emitting functions with coldccto LLVM #97512
-  Don't use coldccUsepreserve_mostccforextern "rust-cold"#115260
-  compiler: Accept "improper" ctypes in extern "rust-cold" fn #130667 - Suppresses extern "C"improper ctypes lint, since this is a Rust ABI