about summary refs log tree commit diff
path: root/library/panic_unwind/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2025-08-20Migrate `panic_unwind` to use `cfg_select!`Josh Stone-9/+16
2025-04-09update cfgsBoxy-2/+2
2025-03-17Mark imports of #[rustc_std_internal_symbol] items with this attributebjorn3-0/+2
This ensures that they will be correctly mangled in a future commit.
2025-02-18update `cfg(bootstrap)`Josh Stone-1/+1
2025-02-14panic_unwind: Apply unsafe_op_in_unsafe_fnEric Huss-3/+6
2025-02-09Mark extern blocks as unsafeMichael Goulet-1/+1
2025-01-20panic_unwind: add `#![warn(unreachable_pub)]`Urgau-0/+1
2025-01-06Rollup merge of #131830 - hoodmane:emscripten-wasm-eh, r=workingjubileeJacob Pratt-1/+2
Add support for wasm exception handling to Emscripten target This is a draft because we need some additional setting for the Emscripten target to select between the old exception handling and the new exception handling. I don't know how to add a setting like that, would appreciate advice from Rust folks. We could maybe choose to use the new exception handling if `Ctarget-feature=+exception-handling` is passed? I tried this but I get errors from llvm so I'm not doing it right.
2025-01-06Add support for wasm exception handling to Emscripten targetHood Chatham-1/+2
Gated behind an unstable `-Z emscripten-wasm-eh` flag
2024-11-30Switch rtems target to panic unwindJan Sommer-1/+1
2024-10-21move strict provenance lints to new feature gate, remove old feature gatesRalf Jung-2/+0
2024-09-24Initial std library support for NuttXHuang Qi-1/+1
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-09-03Port std library to RTEMSJan Sommer-1/+1
2024-07-28step cfg(bootstrap)Mark Rousskov-1/+0
2024-07-01Use the native unwind function in miri where possiblebjorn3-21/+13
2024-06-19Stabilise c_unwindGary Guo-1/+1
2024-04-11Refactor `panic_unwind/seh.rs` pointer use; x86 now conforms to ↵niluxv-0/+2
strict-provenance
2024-02-22Use Itanium ABI for thrown exceptionsNoa-7/+1
2024-02-22Unconditionally pass -wasm-enable-ehNoa-6/+1
2024-02-22std support for wasm32 panic=unwindNoa-1/+12
2023-11-16panic_unwind: support unwinding on xousSean Cross-0/+1
Now that `unwind` supports Xous, enable unwinding panics on Xous. Signed-off-by: Sean Cross <sean@xobs.io>
2023-09-20Rename BoxMeUp to PanicPayload.Mara Bos-2/+2
2023-08-23Bump cfg(bootstrap)Mark Rousskov-2/+1
2023-08-07stabilize abi_thiscallBenedikt Radtke-1/+1
2023-08-03Add `internal_features` lintNilstrieb-0/+1
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-03-26Remove unnecessary raw pointer in __rust_start_panic argbjorn3-2/+2
It is no longer necessary as __rust_start_panic switched to the Rust abi.
2022-12-30Replace libstd, libcore, liballoc in docs.jonathanCogan-2/+2
2022-11-04Fix build of thumbv7a-pc-windows-msvcArlo Siemsen-1/+2
2022-08-23Remove custom frame info registration on i686-pc-windows-gnuAmanieu d'Antras-3/+0
The indirection is no longer needed since we always link to libgcc even when the panic_abort runtime is used. Instead we can just call the libgcc functions directly.
2022-08-23Move personality functions to stdAmanieu d'Antras-2/+0
These were previously in the panic_unwind crate with dummy stubs in the panic_abort crate. However it turns out that this is insufficient: we still need a proper personality function even with -C panic=abort to handle the following cases: 1) `extern "C-unwind"` still needs to catch foreign exceptions with -C panic=abort to turn them into aborts. This requires landing pads and a personality function. 2) ARM EHABI uses the personality function when creating backtraces. The dummy personality function in panic_abort was causing backtrace generation to get stuck in a loop since the personality function is responsible for advancing the unwind state to the next frame.
2022-06-03Fully stabilize NLLJack Huey-1/+0
2022-05-14Use Rust ABI for `__rust_start_panic` and `_{rdl,rg}_oom`Gary Guo-1/+1
2022-01-21adapt L4Bender implementationBenjamin Lamowski-0/+4
- Fix style errors. - L4-bender does not yet support dynamic linking. - Stack unwinding is not yet supported for x86_64-unknown-l4re-uclibc. For now, just abort on panics. - Use GNU-style linker options where possible. As suggested by review: - Use standard GNU-style ld syntax for relro flags. - Use standard GNU-style optimization flags and logic. - Use standard GNU-style ld syntax for --subsystem. - Don't read environment variables in L4Bender linker. Thanks to CARGO_ENCODED_RUSTFLAGS introduced in #9601, l4-bender's arguments can now be passed from the L4Re build system without resorting to custom parsing of environment variables.
2021-11-10Review commentsAlex Crichton-2/+1
2021-11-10std: Get the standard library compiling for wasm64Alex Crichton-0/+1
This commit goes through and updates various `#[cfg]` as appropriate to get the wasm64-unknown-unknown target behaving similarly to the wasm32-unknown-unknown target. Most of this is just updating various conditions for `target_arch = "wasm32"` to also account for `target_arch = "wasm64"` where appropriate. This commit also lists `wasm64` as an allow-listed architecture to not have the `restricted_std` feature enabled, enabling experimentation with `-Z build-std` externally. The main goal of this commit is to enable playing around with `wasm64-unknown-unknown` externally via `-Z build-std` in a way that's similar to the `wasm32-unknown-unknown` target. These targets are effectively the same and only differ in their pointer size, but wasm64 is much newer and has much less ecosystem/library support so it'll still take time to get wasm64 fully-fledged.
2021-09-28Add SOLID targetsTomoaki Kawada-0/+1
SOLID[1] is an embedded development platform provided by Kyoto Microcomputer Co., Ltd. This commit introduces a basic Tier 3 support for SOLID. # New Targets The following targets are added: - `aarch64-kmc-solid_asp3` - `armv7a-kmc-solid_asp3-eabi` - `armv7a-kmc-solid_asp3-eabihf` SOLID's target software system can be divided into two parts: an RTOS kernel, which is responsible for threading and synchronization, and Core Services, which provides filesystems, networking, and other things. The RTOS kernel is a μITRON4.0[2][3]-derived kernel based on the open-source TOPPERS RTOS kernels[4]. For uniprocessor systems (more precisely, systems where only one processor core is allocated for SOLID), this will be the TOPPERS/ASP3 kernel. As μITRON is traditionally only specified at the source-code level, the ABI is unique to each implementation, which is why `asp3` is included in the target names. More targets could be added later, as we support other base kernels (there are at least three at the point of writing) and are interested in supporting other processor architectures in the future. # C Compiler Although SOLID provides its own supported C/C++ build toolchain, GNU Arm Embedded Toolchain seems to work for the purpose of building Rust. # Unresolved Questions A μITRON4 kernel can support `Thread::unpark` natively, but it's not used by this commit's implementation because the underlying kernel feature is also used to implement `Condvar`, and it's unclear whether `std` should guarantee that parking tokens are not clobbered by other synchronization primitives. # Unsupported or Unimplemented Features Most features are implemented. The following features are not implemented due to the lack of native support: - `fs::File::{file_attr, truncate, duplicate, set_permissions}` - `fs::{symlink, link, canonicalize}` - Process creation - Command-line arguments Backtrace generation is not really a good fit for embedded targets, so it's intentionally left unimplemented. Unwinding is functional, however. ## Dynamic Linking Dynamic linking is not supported. The target platform supports dynamic linking, but enabling this in Rust causes several problems. - The linker invocation used to build the shared object of `std` is too long for the platform-provided linker to handle. - A linker script with specific requirements is required for the compiled shared object to be actually loadable. As such, we decided to disable dynamic linking for now. Regardless, the users can try to create shared objects by manually invoking the linker. ## Executable Building an executable is not supported as the notion of "executable files" isn't well-defined for these targets. [1] https://solid.kmckk.com/SOLID/ [2] http://ertl.jp/ITRON/SPEC/mitron4-e.html [3] https://en.wikipedia.org/wiki/ITRON_project [4] https://toppers.jp/
2021-08-10STD support for the ESP-IDF frameworkivmarkov-1/+2
2021-08-03rustc: Fill out remaining parts of C-unwind ABIAlex Crichton-3/+2
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-07-03Remove the deprecated `core::raw` and `std::raw` module.Charles Lew-1/+0
2021-06-04rustdoc: link to stable/beta docs consistently in documentationJoshua Nelson-4/+1
## User-facing changes - Intra-doc links to primitives that currently go to rust-lang.org/nightly/std/primitive.x.html will start going to channel that rustdoc was built with. Nightly will continue going to /nightly; Beta will link to /beta; stable compilers will link to /1.52.1 (or whatever version they were built as). - Cross-crate links from std to core currently go to /nightly unconditionally. They will start going to /1.52.0 on stable channels (but remain the same on nightly channels). - Intra-crate links from std to std (or core to core) currently go to the same URL they are hosted at; they will continue to do so. Notably, this is different from everything else because it can preserve the distinction between /stable and /1.52.0 by using relative links. Note that "links" includes both intra-doc links and rustdoc's own automatically generated hyperlinks. ## Implementation changes - Update the testsuite to allow linking to /beta and /1.52.1 in docs - Use an html_root_url for the standard library that's dependent on the channel This avoids linking to nightly docs on stable. - Update rustdoc to use channel-dependent links for primitives from an unknown crate - Set DOC_RUST_LANG_ORG_CHANNEL from bootstrap to ensure it's in sync - Include doc.rust-lang.org in the channel
2021-03-24Revert "Revert stabilizing integer::BITS."Mara Bos-1/+0
2021-02-03Revert stabilizing integer::BITS.Mara Bos-0/+1
2021-01-31stabilize int_bits_constAshley Mannix-1/+0
2020-12-25fix another comment, and make __rust_start_panic code a bit more ↵Ralf Jung-2/+2
semantically clear
2020-12-21slightly more typed interface to panic implementationRalf Jung-2/+1
2020-11-22Drop support for cloudabi targetsLzu Tao-1/+0
2020-09-20Rollup merge of #76866 - est31:master, r=lcnrRalf Jung-1/+0
Remove unused feature gates from library/ crates Removes some unused feature gates from library crates. It's likely not a complete list as I only tested a subset for which it's more likely that it is unused.
2020-09-19Use `T::BITS` instead of `size_of::<T> * 8`.Mara Bos-0/+1
2020-09-18Remove unused libc feature gateest31-1/+0
Libc isn't used by alloc. And std and panic_* use libc from crates.io now, which isn't feature gated.
2020-08-28Auto merge of #70212 - Amanieu:catch_foreign, r=Mark-Simulacrumbors-0/+3
Abort when foreign exceptions are caught by catch_unwind Prior to this PR, foreign exceptions were not caught by catch_unwind, and instead passed through invisibly. This represented a painful soundness hole in some libraries ([take_mut](https://github.com/Sgeo/take_mut/blob/master/src/lib.rs#L37)), which relied on `catch_unwind` to handle all possible exit paths from a closure. With this PR, foreign exceptions are now caught by `catch_unwind` and will trigger an abort since catching foreign exceptions is currently UB according to the latest proposals by the FFI unwind project group. cc @rust-lang/wg-ffi-unwind