Skip to content

Commit 15e83c8

Browse files
committed
Rework link.unwinding
This reworks this section to change the emphasis on "using non-rustc linkers". To me, that seemed confusing, since this also applies to using rustc (just that rustc automatically validates and generates an error if it is validated).
1 parent 8d82263 commit 15e83c8

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/linkage.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,7 @@ r[link.unwinding]
279279
### Prohibited linkage and unwinding
280280

281281
r[link.unwinding.intro]
282-
If you are *not* using `rustc` to link Rust files, you must take care to ensure that unwinding is
283-
handled consistently across the entire binary. Linking without `rustc` includes using `dlopen` or similar facilities
284-
where linking is done by the system runtime without `rustc` being involved. In the following,
285-
we define what exactly is meant by "handling unwinding consistently".
282+
Panic unwinding must be supported consistently across the binary per the following rules.
286283

287284
r[link.unwinding.potential]
288285
A Rust artifact is called *potentially unwinding* if any of the following conditions is met:
@@ -301,8 +298,9 @@ r[link.unwinding.prohibited]
301298
If a Rust artifact is potentially unwinding, then all its crates must be built with the `unwind` [panic strategy].
302299

303300
> [!NOTE]
304-
> This restriction can only be violated when mixing code with different [`-C panic`] flags
305-
> while also using a non-`rustc` linker. Most users do not have to be concerned about this.
301+
> 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.
302+
>
303+
> This can only happen when mixing code with different [`-C panic`] flags, so most users do not have to be concerned about this.
306304
307305
> [!NOTE]
308306
> To guarantee that a library will be sound (and linkable with `rustc`)

src/panic.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ The _panic strategy_ defines the kind of panic runtime that a crate is built to
4949
> [!NOTE]
5050
> When compiling code with the `abort` panic strategy, the optimizer may assume that unwinding across Rust frames is impossible, which can result in both code-size and runtime speed improvements.
5151
52-
r[panic.strategy.mixed]
53-
When linking with the `unwind` runtime, all crates must be built with the `unwind` strategy.
52+
> [!NOTE]
53+
> See [link.unwinding] for restrictions on linking crates with different panic strategies. An implication is that crates built with the `unwind` strategy can use the `abort` runtime, but not vice-versa.
5454
5555
r[panic.unwind]
5656
## Unwinding

0 commit comments

Comments
 (0)