-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Pass -Cpanic=abort for the panic_abort crate #140254
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
Conversation
rustbot has assigned @petrochenkov. Use |
It's less of a practical concern, but shouldn't I guess the proper solution would be to move |
Ah, crate loader still searches for |
If panic=abort was used while compiling the standard library, panic_unwind won't be used anyway as any panic=abort dependency will force panic=abort to be used and thus panic_unwind doesn't get linked in.
The LLVM backend needs to know if the current crate uses panic=unwind or panic=abort before any source code gets parsed:
There already is a sanity check that the found crate is a panic runtime: rust/compiler/rustc_metadata/src/creader.rs Lines 999 to 1001 in 862156d
|
88b79e8
to
7e58a46
Compare
@rustbot ready |
@bors r+ |
Should be possible with https://doc.rust-lang.org/cargo/reference/unstable.html#profile-rustflags-option ? Something like (in case if it allowed to pass package name, didn't checked that): [profile.release.package.panic_abort]
rustflags = [ "-C", "panic=abort" ] |
Didn't know that was possible already. That is a much better solution. @bors r- |
Wouldn't that break |
7e58a46
to
929e632
Compare
Off-topic: Just wondering, Rust 1.87 depends on LLVM 20, but the Jobs are named 19? 🤔
rust/src/ci/docker/scripts/build-clang.sh Lines 7 to 8 in 18491d5
rust/src/ci/scripts/install-clang.sh Lines 13 to 14 in 036b5fc
https://github.com/llvm/llvm-project/releases/tag/llvmorg-20.1.7 Why not use renovate comments instead to group those 2 scripts together? |
The panic_abort crate must be compiled with panic=abort, but cargo doesn't allow setting the panic strategy for a single crate the usual way using panic="abort", but luckily per-package rustflags do allow this. Bootstrap previously handled this in its rustc wrapper, but for example the build systems of cg_clif and cg_gcc don't use the rustc wrapper, so they would either need to add one, patch the standard library or be unable to build a sysroot suitable for both panic=abort and panic=unwind (as is currently the case).
929e632
to
a0badba
Compare
I don't think it should break @rustbot ready |
We test rustc with the current LLVM (20) and one version before (19). The scripts that you link in different environments (inside/outside) Docker, and on different OSes, and they are not always fully synchronized. |
Thanks for explaining, I created a PR to merge those versions if you're interested: #142786 |
Cargo works in mysterious ways, why does it allow to specify rustflags per-profile, but doesn't allow to just specify rustflags regardless of profile? In any case, from reading https://doc.rust-lang.org/cargo/reference/profiles.html it looks like all profiles (including the remaining built-in ones) ultimately inherit from either |
…petrochenkov Pass -Cpanic=abort for the panic_abort crate The panic_abort crate must be compiled with panic=abort, but cargo doesn't allow setting the panic strategy for a single crate the usual way using `panic="abort"`, but luckily per-package rustflags do allow this. Bootstrap previously handled this in its rustc wrapper, but for example the build systems of cg_clif and cg_gcc don't use the rustc wrapper, so they would either need to add one, patch the standard library or be unable to build a sysroot suitable for both panic=abort and panic=unwind (as is currently the case). Required for rust-lang/rustc_codegen_cranelift#1567
Rollup of 6 pull requests Successful merges: - #140254 (Pass -Cpanic=abort for the panic_abort crate) - #142600 (Port `#[rustc_pub_transparent]` to the new attribute system) - #142617 (improve search graph docs, reset `encountered_overflow` between reruns) - #142641 (Generate symbols.o for proc-macros too) - #142776 (All HIR attributes are outer) - #142800 (integer docs: remove extraneous text) r? `@ghost` `@rustbot` modify labels: rollup
…petrochenkov Pass -Cpanic=abort for the panic_abort crate The panic_abort crate must be compiled with panic=abort, but cargo doesn't allow setting the panic strategy for a single crate the usual way using `panic="abort"`, but luckily per-package rustflags do allow this. Bootstrap previously handled this in its rustc wrapper, but for example the build systems of cg_clif and cg_gcc don't use the rustc wrapper, so they would either need to add one, patch the standard library or be unable to build a sysroot suitable for both panic=abort and panic=unwind (as is currently the case). Required for rust-lang/rustc_codegen_cranelift#1567
Rollup of 10 pull requests Successful merges: - #140254 (Pass -Cpanic=abort for the panic_abort crate) - #142594 (Add DesugaringKind::FormatLiteral) - #142600 (Port `#[rustc_pub_transparent]` to the new attribute system) - #142617 (improve search graph docs, reset `encountered_overflow` between reruns) - #142641 (Generate symbols.o for proc-macros too) - #142747 (rustdoc_json: conversion cleanups) - #142776 (All HIR attributes are outer) - #142800 (integer docs: remove extraneous text) - #142850 (remove asm_goto feature annotation, for it is now stabilized) - #142860 (Notify me on tidy changes) r? `@ghost` `@rustbot` modify labels: rollup
…petrochenkov Pass -Cpanic=abort for the panic_abort crate The panic_abort crate must be compiled with panic=abort, but cargo doesn't allow setting the panic strategy for a single crate the usual way using `panic="abort"`, but luckily per-package rustflags do allow this. Bootstrap previously handled this in its rustc wrapper, but for example the build systems of cg_clif and cg_gcc don't use the rustc wrapper, so they would either need to add one, patch the standard library or be unable to build a sysroot suitable for both panic=abort and panic=unwind (as is currently the case). Required for rust-lang/rustc_codegen_cranelift#1567
Rollup of 9 pull requests Successful merges: - #140254 (Pass -Cpanic=abort for the panic_abort crate) - #142600 (Port `#[rustc_pub_transparent]` to the new attribute system) - #142617 (improve search graph docs, reset `encountered_overflow` between reruns) - #142641 (Generate symbols.o for proc-macros too) - #142747 (rustdoc_json: conversion cleanups) - #142776 (All HIR attributes are outer) - #142800 (integer docs: remove extraneous text) - #142850 (remove asm_goto feature annotation, for it is now stabilized) - #142860 (Notify me on tidy changes) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - #140254 (Pass -Cpanic=abort for the panic_abort crate) - #142600 (Port `#[rustc_pub_transparent]` to the new attribute system) - #142617 (improve search graph docs, reset `encountered_overflow` between reruns) - #142747 (rustdoc_json: conversion cleanups) - #142776 (All HIR attributes are outer) - #142800 (integer docs: remove extraneous text) - #142841 (Enable fmt-write-bloat for Windows) - #142845 (Enable textrel-on-minimal-lib for Windows) - #142850 (remove asm_goto feature annotation, for it is now stabilized) - #142860 (Notify me on tidy changes) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #140254 - bjorn3:rustc_panic_abort_abort, r=petrochenkov Pass -Cpanic=abort for the panic_abort crate The panic_abort crate must be compiled with panic=abort, but cargo doesn't allow setting the panic strategy for a single crate the usual way using `panic="abort"`, but luckily per-package rustflags do allow this. Bootstrap previously handled this in its rustc wrapper, but for example the build systems of cg_clif and cg_gcc don't use the rustc wrapper, so they would either need to add one, patch the standard library or be unable to build a sysroot suitable for both panic=abort and panic=unwind (as is currently the case). Required for rust-lang/rustc_codegen_cranelift#1567
The panic_abort crate must be compiled with panic=abort, but cargo doesn't allow setting the panic strategy for a single crate the usual way using
panic="abort"
, but luckily per-package rustflags do allow this. Bootstrap previously handled this in its rustc wrapper, but for example the build systems of cg_clif and cg_gcc don't use the rustc wrapper, so they would either need to add one, patch the standard library or be unable to build a sysroot suitable for both panic=abort and panic=unwind (as is currently the case).Required for rust-lang/rustc_codegen_cranelift#1567