-
Notifications
You must be signed in to change notification settings - Fork 13k
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
no_std panic=abort dev builds require rust_eh_personality
#56152
Comments
This also happens with |
I believe this is already the case, but if you use a stock standard library (or libcore) the standard library is built with panic=unwind which causes the symbol to be referenced. The "solution" is to compile libcore/libstd as panic=abort |
Yes i've come across this issue today, so I think this needs more attention and someone to contribute to making a PR about it |
for now the fix is to use opt-level = 1 in the debug profile for the optimizer to optimize it out |
I think it would be possible to generate an aborting rust_eh_personality when compiling with |
Came across this issue today. Really weird that it only manifests in debug builds. |
I would guess that the rust_eh_personality reference just so happens to get optimized away in release mode. There is no guarantee that this will remain the case in the future. |
rust_eh_personality
rust_eh_personality
At time of writing, searched nightlies: from nightly-2024-06-01 to nightly-2024-09-19 bisected with cargo-bisect-rustc v0.6.9Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --start=2024-06-01 --end=2024-09-19 --script script Mea culpa, I guess. |
Practically speaking, this means the resulting library (cdylib) can't be loaded because the symbol can't be resolved.
This doesn't happen with
--release
(there is no undefined reference torust_eh_personality
). And this doesn't happen when the body ofchunk_alloc_mmap
is further reduced to onlyptr::null_mut()
.If I add -Wl,-Map,map to the linker arguments, the output
map
file says the symbol reference comes from:So rust actively creates a pointer to
rust_eh_personality
in.data
. DW suggests this would have something to do with DWARF, so I tried enabling debug info on the release profile, but that still didn't make it happen with--release
.Cc: @japaric, @alexcrichton
The text was updated successfully, but these errors were encountered: