about summary refs log tree commit diff
path: root/library/unwind/src/libunwind.rs
AgeCommit message (Collapse)AuthorLines
2025-08-16Indent some code inside `cfg_select!`Josh Triplett-174/+178
The previous code inside `cfg_if!` wasn't indented, so the conversion to `cfg_select!` left it not indented. Indent it.
2025-08-16library: Migrate from `cfg_if` to `cfg_select`Josh Triplett-14/+17
Migrate the standard library from using the external `cfg_if` crate to using the now-built-in `cfg_select` macro. This does not yet eliminate the dependency from `library/std/Cargo.toml`, because while the standard library itself no longer uses `cfg_if`, it also incorporates the `backtrace` crate, which does. Migration assisted by the following vim command (after selecting the full `cfg_if!` invocation): ``` '<,'>s/\(cfg_if::\)\?cfg_if/cfg_select/ | '<,'>s/^\( *\)} else {/\1}\r\1_ => {/c | '<,'>s/^\( *\)} else if #\[cfg(\(.*\))\] /\1}\r\1\2 => /e | '<,'>s/if #\[cfg(\(.*\))\] {/\1 => {/e ``` This is imperfect, but substantially accelerated the process. This prompts for confirmation on the `} else {` since that can also appear inside one of the arms. This also requires manual intervention to handle any multi-line conditions.
2025-06-06Add new Tier-3 targets: `loongarch32-unknown-none*`WANG Rui-1/+1
MCP: https://github.com/rust-lang/compiler-team/issues/865
2025-03-17Rollup merge of #137621 - Berrysoft:cygwin-std, r=joboetJacob Pratt-3/+6
Add std support to cygwin target
2025-03-16Rollup merge of #138573 - Noratrieb:no-unsound-bad-bonk-bonk, r=workingjubileeJacob Pratt-10/+7
Make `_Unwind_Action` a type alias, not enum It's bitflags in practice, so an enum is unsound, as an enum must only have the described values. The x86_64 psABI declares it as a `typedef int _Unwind_Action`, which seems reasonable. I made a newtype first but that was more annoying than just a typedef. We don't really use this value for much other than a short check. I ran `x check library --target aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu,x86_64-fortanix-unknown-sgx,x86_64-unknown-haiku,x86_64-unknown-fuchsi a,x86_64-unknown-freebsd,x86_64-unknown-dragonfly,x86_64-unknown-netbsd,x86_64-unknown-openbsd,x86_64-unknown-redox,riscv64-linux-android,armv7-unknown-freebsd` (and some more but they failed to build for other reasons :D) fixes #138558 r? workingjubilee have fun
2025-03-16make `_Unwind_Action` a type alias, not enumNoratrieb-10/+7
It's bitflags in practice, so an enum is unsound, as an enum must only have the described values. The x86_64 psABI declares it as a `typedef int _Unwind_Action`, which seems reasonable. I made a newtype first but that was more annoying than just a typedef. We don't really use this value for much other than a short check.
2025-03-12Fix panic handler for cygwinBerrysoft-3/+6
2025-03-10Target definition for `wasm32-wali-linux-musl` to support the Wasm LinuxArjun Ramesh-1/+4
Interface This commit does not patch libc, stdarch, or cc
2025-02-14unwind: Apply unsafe_op_in_unsafe_fnEric Huss-9/+11
2025-02-09Mark extern blocks as unsafeMichael Goulet-8/+8
2024-10-03control libunwind linkage mode via `crt-static` on gnullvm targetsMateusz Mikuła-6/+3
Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
2024-09-25Use `&raw` in the standard libraryJosh Stone-2/+2
Since the stabilization in #127679 has reached stage0, 1.82-beta, we can start using `&raw` freely, and even the soft-deprecated `ptr::addr_of!` and `ptr::addr_of_mut!` can stop allowing the unstable feature. I intentionally did not change any documentation or tests, but the rest of those macro uses are all now using `&raw const` or `&raw mut` in the standard library.
2024-09-08Fix linking error when compiling for 32-bit watchOSMads Marquart-5/+8
In https://github.com/rust-lang/rust/pull/124748, I mistakenly conflated "not SjLj" to mean "ARM EHABI", which isn't true, watchOS armv7k (specifically only that architecture) uses a third unwinding method called "DWARF CFI".
2024-05-05Fix unwinding on 32-bit watchOS ARMMads Marquart-12/+12
The code is written in a way to support 32-bit iOS and tvOS ARM devices, for future compatibility even though we currently only have a target for 32-bit iOS ARM.
2024-04-14Replace libc::c_int with core::ffi::c_intChris Denton-1/+1
And remove the libc crate when it isn't needed
2024-03-18Support for visionOSAdam Gastineau-1/+1
2024-03-11Rollup merge of #121438 - coolreader18:wasm32-panic-unwind, r=cuviperJubilee-1/+1
std support for wasm32 panic=unwind Tracking issue: #118168 This adds std support for `-Cpanic=unwind` on wasm, and with it slightly more fleshed out rustc support. Now, the stable default is still panic=abort without exception-handling, but if you `-Zbuild-std` with `RUSTFLAGS=-Cpanic=unwind`, you get wasm exception-handling try/catch blocks in the binary: ```rust #[no_mangle] pub fn foo_bar(x: bool) -> *mut u8 { let s = Box::<str>::from("hello"); maybe_panic(x); Box::into_raw(s).cast() } #[inline(never)] #[no_mangle] fn maybe_panic(x: bool) { if x { panic!("AAAAA"); } } ``` ```wat ;; snip... (try $label$5 (do (call $maybe_panic (local.get $0) ) (br $label$1) ) (catch_all (global.set $__stack_pointer (local.get $1) ) (call $__rust_dealloc (local.get $2) (i32.const 5) (i32.const 1) ) (rethrow $label$5) ) ) ;; snip... ```
2024-02-24library: use `addr_of!`Pavel Grigorenko-2/+2
2024-02-22Use Itanium ABI for thrown exceptionsNoa-1/+1
2023-11-16unwind: add support for using `unwinding` crateSean Cross-5/+8
The `unwinding` crate supports processing unwinding data, and is written entirely in Rust. This allows it to be ported to new platforms more easily than using the llvm-based `libunwind`. While `libunwind` is very well supported on major targets, it is difficult to use on other targets. SGX is an example of this where Rust carries custom patches in order to enable backtrace support. This adds an alternative for supported architectures. Rather than providing a custom target, `unwinding` allows for a solution that is completely written in Rust. This adds `xous` as the first consumer, and forthcoming patches will modify libstd to take advantage of this. Signed-off-by: Sean Cross <sean@xobs.io>
2023-10-10Use pointers instead of `usize` addresses for landing padsniluxv-7/+7
This bring unwind and personality code more in line with strict-provenance
2023-08-14add a csky-unknown-linux-gnuabiv2 targetDirreke-0/+3
2023-07-18support for mips32r6 as a target_arch valuechenx97-1/+1
2023-07-18support for mips64r6 as a target_arch valuechenx97-1/+1
2023-06-21wip: Support Apple tvOS in libstdThom Chiovoloni-1/+1
2023-04-04library/unwind: Add definitions for loongarch64zhaixiaojuan-0/+3
2023-03-03Match unmatched backticks in library/est31-1/+1
2022-12-30Replace libstd, libcore, liballoc in line comments.jonathanCogan-1/+1
2022-11-22Rollup merge of #104464 - mati865:reduce-eh-overallocation-amd64, r=thomccDylan DPC-1/+4
Reduce exceptions overallocation on non Windows x86_64 Addressing https://github.com/rust-lang/rust/pull/103894#discussion_r1020950196
2022-11-15Reduce exceptions overallocation on non Windows x86_64Mateusz Mikuła-1/+4
Addressing https://github.com/rust-lang/rust/pull/103894#discussion_r1020950196
2022-11-15Fix building of `aarch64-pc-windows-gnullvm`Mateusz Mikuła-1/+1
That change had been lost during rebase
2022-11-12Bump unwinder private data size for AArch64 WindowsMateusz Mikuła-1/+4
This fixes unwinding on `aarch64-*-windows-gnu*`.
2022-11-01Change the way libunwind is linked for `*-windows-gnullvm` targetsMateusz Mikuła-1/+4
2022-07-20Library changes for Apple WatchOSVladimir Michael Eatwell-3/+3
2022-05-14Use re-export instead of inline wrapper in libunwindGary Guo-4/+1
This ensures that there are no calls to `C-unwind` function in libunwind.
2022-03-07Rollup merge of #93350 - gburgessiv:master, r=Mark-SimulacrumMatthias Krüger-0/+4
libunwind: readd link attrs to _Unwind_Backtrace It seems the removal of these in 1c07096a45a15de64216f12ec726333870e372b1 was unintended; readding them fixes the build. fixes rust-lang/rust#93349 r? `@alexcrichton`
2022-02-12library/unwind: Define unwinder_private_data_size for m68kJohn Paul Adrian Glaubitz-0/+3
2022-01-26libunwind: readd link attrs to _Unwind_BacktraceGeorge Burgess IV-0/+4
It seems the removal of these in 1c07096a45a15de64216f12ec726333870e372b1 was unintended; readding them fixes the build. fixes rust-lang/rust#93349
2021-08-28build llvm libunwind.a in rustbuild12101111-13/+22
2021-08-03rustc: Fill out remaining parts of C-unwind ABIAlex Crichton-6/+7
This commit intends to fill out some of the remaining pieces of the C-unwind ABI. This has a number of other changes with it though to move this design space forward a bit. Notably contained within here is: * On `panic=unwind`, the `extern "C"` ABI is now considered as "may unwind". This fixes a longstanding soundness issue where if you `panic!()` in an `extern "C"` function defined in Rust that's actually UB because the LLVM representation for the function has the `nounwind` attribute, but then you unwind. * Whether or not a function unwinds now mainly considers the ABI of the function instead of first checking the panic strategy. This fixes a miscompile of `extern "C-unwind"` with `panic=abort` because that ABI can still unwind. * The aborting stub for non-unwinding ABIs with `panic=unwind` has been reimplemented. Previously this was done as a small tweak during MIR generation, but this has been moved to a separate and dedicated MIR pass. This new pass will, for appropriate functions and function calls, insert a `cleanup` landing pad for any function call that may unwind within a function that is itself not allowed to unwind. Note that this subtly changes some behavior from before where previously on an unwind which was caught-to-abort it would run active destructors in the function, and now it simply immediately aborts the process. * The `#[unwind]` attribute has been removed and all users in tests and such are now using `C-unwind` and `#![feature(c_unwind)]`. I think this is largely the last piece of the RFC to implement. Unfortunately I believe this is still not stabilizable as-is because activating the feature gate changes the behavior of the existing `extern "C"` ABI in a way that has no replacement. My thinking for how to enable this is that we add support for the `C-unwind` ABI on stable Rust first, and then after it hits stable we change the behavior of the `C` ABI. That way anyone straddling stable/beta/nightly can switch to `C-unwind` safely.
2021-01-27Support AArch64 ILP32 in libunwind bindingsAmanieu d'Antras-1/+4
2020-10-09Remove useless `all` in cfgMateusz Mikuła-1/+1
2020-09-28library/{panic_,}unwind: Add definitions for sparc-unknow-linux-gnuJohn Paul Adrian Glaubitz-1/+1
2020-09-17library/unwind: Add missing )Alistair Francis-1/+1
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2020-09-16library/unwind: Consolidate RV32 and RV64Alistair Francis-4/+1
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2020-09-16library/unwind: Add support for RISC-V 32-bitAlistair Francis-0/+3
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2020-07-27mv std libs to library/mark-0/+279