Closed
Description
opened on Jul 31, 2020
This is a tracking issue for the RFC "C-unwind ABI" (rust-lang/rfcs#2945).
The feature gate for the issue is #![feature(c_unwind)]
.
This RFC was created as part of the ffi-unwind project group tracked at rust-lang/lang-team#19.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also uses 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 the RFC
- Adjust behavior of panic
extern "C" fn"
- Adjust documentation
- Stabilization PR (see instructions on rustc-dev-guide)
Implementation notes
Major provisions in the RFC:
- Add a
C-unwind
ABI andsystem-unwind
(I think), we may need more variants. - For external functions with the C ABI, we already (I believe) add the "nounwind" LLVM attributes when we build them. We want to continue doing this.
- For external functions with the C-unwind ABI, we do not want any such attributes.
- For Rust functions defined with the C ABI, e.g.,
extern "C" fn foo() { ... }
, we want to force them to abort if there is a panic. The MIR helper functionshould_abort_on_panic
already exists and I think will modify the generated code to insert the required shims in such a case. They should also be marked as "nounwind" in LLVM, if they're not already. - Rust functions with the "C-unwind" ABI should not abort on panic.
- Use ABI to guide the "nounwind" attribute on callsites as well.
- Write suitable codegen tests to check generated LLVM IR.
Unresolved Questions
None. The unresolved questions in the RFC were meant to be solved by future RFCs building on this one.
Implementation history
- Initial implementation: Implement RFC 2945: "C-unwind" ABI #76570
- Additional work (removing
#[unwind]
, adjusting panic handling): rustc: Fill out remaining parts of C-unwind ABI #86155
Metadata
Assignees
Labels
Area: Concerning the application binary interface (ABI)Area: Foreign function interface (FFI)Blocker: Approved by a merged RFC but not yet implemented.Category: An issue tracking the progress of sth. like the implementation of an RFC`#![feature(c_unwind)]`Status: The implementation is incomplete.Relevant to the language team, which will review and decide on the PR/issue.This issue / PR is in PFCP or FCP with a disposition to merge it.The final comment period is finished for this PR / Issue.Marks issues that should be documented in the release notes of the next release.
Activity