Skip to content
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

panic runtime and C-unwind documentation #1226

Merged
merged 42 commits into from
Feb 27, 2025
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5f63e46
panic runtime and C-unwind documentation
BatmanAoD Oct 2, 2024
c8fc0e8
Rust version number for destructors guarantee
BatmanAoD Nov 24, 2024
edd5b18
Fix identifeirs in functions.md and move the guarantee about destruct…
chorman0773 Nov 25, 2024
39de76c
Add identifier syntax to panic.md
chorman0773 Nov 25, 2024
6413901
Move note in linkage.md
chorman0773 Nov 25, 2024
70f8292
Fix whitespace issues in previous commit
chorman0773 Nov 25, 2024
d08e406
Fix omitted whitespace issue (thanks VSC)
chorman0773 Nov 25, 2024
a20802e
Update src/items/functions.md
chorman0773 Nov 26, 2024
2525ab4
fix wording regarding UB due to unwinding linkage
RalfJung Nov 29, 2024
5bff1e3
improve terminology
RalfJung Dec 21, 2024
7453efd
Do not document a rustc-lint as a language rule
ehuss Jan 10, 2025
c3cc7fa
Use built-in std linking
ehuss Jan 10, 2025
860691e
Fix misspelled word
ehuss Jan 10, 2025
543bc27
Remove vectorcall-unwind, it is unstable
ehuss Jan 14, 2025
4bb0248
Sort unwind list
ehuss Jan 14, 2025
386b2f3
Switch link for ABI to the list of ABIs
ehuss Jan 14, 2025
c7a7961
Tweak wording of "beyond rust main function"
ehuss Jan 14, 2025
20af0b1
Make sure a terminal rule is used for this definition
ehuss Jan 14, 2025
da53531
Remove historical note
ehuss Jan 14, 2025
8fd8208
Clarify that this is unspecified
ehuss Jan 14, 2025
0f3c015
Fix rule name to follow style
ehuss Jan 14, 2025
63677c1
Add missing rule name
ehuss Jan 14, 2025
caa17fc
Reword the title of this section
ehuss Jan 14, 2025
0b37538
Unwrap the panic chapter
ehuss Jan 14, 2025
eafe95d
Update rules to be with headers
ehuss Jan 14, 2025
5f21a1a
Apply suggestions from RalfJung
ehuss Jan 14, 2025
79cc53f
Move panic runtimes towards the top of the chapter
ehuss Jan 15, 2025
c38044d
Add the concept of panic strategy
ehuss Jan 15, 2025
20bd38f
Fix typo
ehuss Jan 15, 2025
f309b2f
Drop sentence about UB of how to violate the Rust runtime
ehuss Jan 15, 2025
2617cd5
Add "panic" to "unwind runtime"
ehuss Jan 16, 2025
d49c90c
Clarify optimization for abort strategy
ehuss Jan 16, 2025
6eaa1fa
Add another link for panic strategy
ehuss Jan 16, 2025
a740002
Normatively define the abort and unwind runtimes
ehuss Jan 16, 2025
f7cb25e
Rework link.unwinding
ehuss Jan 16, 2025
34e0b68
Apply suggestions from RalfJung
ehuss Jan 17, 2025
8f4dc2b
Clarify function pointer variadics also support `-unwind`
ehuss Jan 21, 2025
6e76b5c
Fix minor typo
ehuss Jan 30, 2025
7049886
Simplify wording of standard ABI strings
ehuss Feb 10, 2025
003a8a4
Remove "panic runtime" and emphasize panic_handler more
ehuss Feb 10, 2025
cdd00de
no unnecessary line-breaks in new text
BatmanAoD Feb 15, 2025
ffc056c
fix link
BatmanAoD Feb 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from RalfJung
Co-authored-by: Ralf Jung <[email protected]>
2 people authored and BatmanAoD committed Feb 15, 2025
commit 34e0b68e3276c8aa1742448d1a4116d5a0ebec36
4 changes: 3 additions & 1 deletion src/linkage.md
Original file line number Diff line number Diff line change
@@ -279,7 +279,7 @@ r[link.unwinding]
### Prohibited linkage and unwinding

r[link.unwinding.intro]
Panic unwinding must be supported consistently across the binary per the following rules.
Panic unwinding can only be used if the binary is built consistently according to the following rules.

r[link.unwinding.potential]
A Rust artifact is called *potentially unwinding* if any of the following conditions is met:
@@ -296,8 +296,10 @@ A Rust artifact is called *potentially unwinding* if any of the following condit
r[link.unwinding.prohibited]
If a Rust artifact is potentially unwinding, then all its crates must be built with the `unwind` [panic strategy].
Otherwise, unwinding can cause undefined behavior.

> [!NOTE]
> If you are using `rustc` to link, these rules are enforced automatically.
> If you are *not* using `rustc` to link, you must take care to ensure that unwinding is handled consistently across the entire binary. Linking without `rustc` includes using `dlopen` or similar facilities where linking is done by the system runtime without `rustc` being involved.
>
> This can only happen when mixing code with different [`-C panic`] flags, so most users do not have to be concerned about this.