-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Tracking Issue for naked_functions_target_rustic_abi
#138997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
…bi, r=traviscross,compiler-errors add `naked_functions_rustic_abi` feature gate tracking issue: rust-lang#138997 Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable. r? `@traviscross`
…bi, r=traviscross,compiler-errors add `naked_functions_rustic_abi` feature gate tracking issue: rust-lang#138997 Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable. r? ``@traviscross``
…bi, r=traviscross,compiler-errors add `naked_functions_rustic_abi` feature gate tracking issue: rust-lang#138997 Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable. r? ```@traviscross```
…bi, r=traviscross,compiler-errors add `naked_functions_rustic_abi` feature gate tracking issue: rust-lang#138997 Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable. r? ````@traviscross````
Rollup merge of rust-lang#139001 - folkertdev:naked-function-rustic-abi, r=traviscross,compiler-errors add `naked_functions_rustic_abi` feature gate tracking issue: rust-lang#138997 Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable. r? ````@traviscross````
…gross35 Allow (but don't require) `#[unsafe(naked)]` so that `compiler-builtins` can upgrade to it tracking issue: rust-lang#138997 Per rust-lang#134213 (comment), we want to make the `#[naked]` attribute an unsafe attribute. Making that change runs into a cyclic dependency with `compiler-builtins` which uses `#[naked]`, where `rustc` needs an updated `compiler-builtins` and vice versa. So based on rust-lang#139753 and [#t-compiler/help > updating &rust-lang#96;compiler-builtins&rust-lang#96; and &rust-lang#96;rustc&rust-lang#96;](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/updating.20.60compiler-builtins.60.20and.20.60rustc.60), this PR allows, but does not require `#[unsafe(naked)]`, and makes that change for some of the tests to check that both `#[naked]` and `#[unsafe(naked)]` are accepted. Then we can upgrade and synchronize `compiler-builtins`, and then make `#[naked]` (without `unsafe`) invalid. r? `@traviscross` (or someone from t-compiler if you're faster and this look allright)
…gross35 Allow (but don't require) `#[unsafe(naked)]` so that `compiler-builtins` can upgrade to it tracking issue: rust-lang#138997 Per rust-lang#134213 (comment), we want to make the `#[naked]` attribute an unsafe attribute. Making that change runs into a cyclic dependency with `compiler-builtins` which uses `#[naked]`, where `rustc` needs an updated `compiler-builtins` and vice versa. So based on rust-lang#139753 and [#t-compiler/help > updating &rust-lang#96;compiler-builtins&rust-lang#96; and &rust-lang#96;rustc&rust-lang#96;](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/updating.20.60compiler-builtins.60.20and.20.60rustc.60), this PR allows, but does not require `#[unsafe(naked)]`, and makes that change for some of the tests to check that both `#[naked]` and `#[unsafe(naked)]` are accepted. Then we can upgrade and synchronize `compiler-builtins`, and then make `#[naked]` (without `unsafe`) invalid. r? ``@traviscross`` (or someone from t-compiler if you're faster and this look allright)
Rollup merge of rust-lang#139797 - folkertdev:naked-allow-unsafe, r=tgross35 Allow (but don't require) `#[unsafe(naked)]` so that `compiler-builtins` can upgrade to it tracking issue: rust-lang#138997 Per rust-lang#134213 (comment), we want to make the `#[naked]` attribute an unsafe attribute. Making that change runs into a cyclic dependency with `compiler-builtins` which uses `#[naked]`, where `rustc` needs an updated `compiler-builtins` and vice versa. So based on rust-lang#139753 and [#t-compiler/help > updating &rust-lang#96;compiler-builtins&rust-lang#96; and &rust-lang#96;rustc&rust-lang#96;](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/updating.20.60compiler-builtins.60.20and.20.60rustc.60), this PR allows, but does not require `#[unsafe(naked)]`, and makes that change for some of the tests to check that both `#[naked]` and `#[unsafe(naked)]` are accepted. Then we can upgrade and synchronize `compiler-builtins`, and then make `#[naked]` (without `unsafe`) invalid. r? `@traviscross` (or someone from t-compiler if you're faster and this look allright)
…ttribute, r=tgross35,traviscross Make `#[naked]` an unsafe attribute tracking issue: rust-lang#138997 Per rust-lang#134213 (comment), the `#[naked]` attribute is now an unsafe attribute (in any edition). This can only be merged when the above PRs are merged, I'd just like to see if there are any CI surprises here, and maybe there is early review feedback too. r? `@traviscross`
…ttribute, r=tgross35,traviscross Make `#[naked]` an unsafe attribute tracking issue: rust-lang#138997 Per rust-lang#134213 (comment), the `#[naked]` attribute is now an unsafe attribute (in any edition). This can only be merged when the above PRs are merged, I'd just like to see if there are any CI surprises here, and maybe there is early review feedback too. r? ``@traviscross``
Rollup merge of rust-lang#139753 - folkertdev:naked-function-unsafe-attribute, r=tgross35,traviscross Make `#[naked]` an unsafe attribute tracking issue: rust-lang#138997 Per rust-lang#134213 (comment), the `#[naked]` attribute is now an unsafe attribute (in any edition). This can only be merged when the above PRs are merged, I'd just like to see if there are any CI surprises here, and maybe there is early review feedback too. r? ``@traviscross``
… r=tgross35,traviscross Make `#[naked]` an unsafe attribute tracking issue: rust-lang/rust#138997 Per rust-lang/rust#134213 (comment), the `#[naked]` attribute is now an unsafe attribute (in any edition). This can only be merged when the above PRs are merged, I'd just like to see if there are any CI surprises here, and maybe there is early review feedback too. r? ``@traviscross``
An interesting motivating example is multiversioning on x86 systems. The https://rust.godbolt.org/z/GaPKzeYez #![feature(naked_functions_rustic_abi)]
use std::sync::atomic::*;
type FmaFn = unsafe extern "Rust" fn(f32, f32, f32) -> f32;
#[unsafe(link_section = ".data")]
static FMA_FN: AtomicPtr<()> = unsafe { AtomicPtr::new(std::mem::transmute(resolve_fma as FmaFn)) };
#[unsafe(naked)]
pub extern "Rust" fn fma(a: f32, b: f32, c: f32) -> f32 {
std::arch::naked_asm!("jmp qword ptr [rip + {}]", sym FMA_FN)
}
#[target_feature(enable = "fma")]
fn fma_fast(a: f32, b: f32, c: f32) -> f32 {
a.mul_add(b, c)
}
fn fma_slow(a: f32, b: f32, c: f32) -> f32 {
a.mul_add(b, c)
}
#[cold]
fn resolve_fma(a: f32, b: f32, c: f32) -> f32 {
let f: FmaFn = if is_x86_feature_detected!("fma") {
fma_fast
} else {
fma_slow
};
FMA_FN.store(unsafe { std::mem::transmute(f) }, Ordering::Relaxed);
unsafe { f(a, b, c) }
} The naked The naked function is required to work around a limitation in LLVM, that would add a This came up in #t-libs > significant mul_add perf regression since nightly-2025-03-06 |
The feature gate for the issue is
#![feature(naked_functions_target_rustic_abi)]
.Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi (
"Rust"
,"rust-cold"
,"rust-call"
and"rust-intrinsic"
) unstable.Splitting out this feature was decided on in https://hackmd.io/20YsMoNgRjyxhBm_aVEwQg#Stabilize-naked_functions-rust134213.
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.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Steps
instructions?)
Unresolved Questions
XXX --- list all the "unresolved questions" found in the RFC to ensure they are
not forgotten
Implementation history
@rustbot label +A-naked +F-naked_functions
The text was updated successfully, but these errors were encountered: