-
-
Notifications
You must be signed in to change notification settings - Fork 451
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
Mold causes Rust to lose backtraces in certain cases. #33
Comments
Thank you for your report! Do I need to install an unofficial version of Rust to build your code? It looks like the stable version of Rust doesn't support the |
@rui314 yes you need to select nightly channel of Rust.
should do the trick. |
...or you can use (Which is very useful for things like using the stable toolchain, but using |
@itsfarseen Thank you for the instruction. I think I successfully build your code, but it looks like a backtrace was displayed correctly as shown below.
I'm sure that the binary has been built by lld:
What am I missing? |
This is the output I'm getting: Compiling sqlx-no-backtrace v0.1.0 (/media/linux2/Projects/97.Temp/repro-sqlx-rocket-anyhow-no-backtrace)
warning: unused import: `sqlx`
--> src/main.rs:4:5
|
4 | use sqlx;
| ^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: 1 warning emitted
Finished dev [unoptimized + debuginfo] target(s) in 1m 31s
Running `target/debug/sqlx-no-backtrace`
0: <unknown>
1: <unknown>
2: <unknown>
3: <unknown>
4: <unknown>
5: <unknown>
6: <unknown>
7: __libc_start_main
8: <unknown> |
Oh my mold and gcc versions seem to be different:
Let me try again with latest master. Also my rust version is:
|
Same with latest master:
|
Possible points of differences:
|
For me
Otherwise it gets built by LLD:
PS: I had copied mold and mold-wrapper.so to /usr/local/bin for convenience |
I believe in your environment ld.lld is used by default, and that's why My rustc is mold doesn't have a compile-time options. However you build it, the linker should behave the same. I added a new feature so that it is easy to collect input files from mold users. Can you re-sync your local mold repo, rebuild mold and then re-run
Then please share the tar file (or the exectuable file) with me, so that I can run mold with the exact same input files as yours. |
Here's repro.tar.xz: https://file.io/EGi5GrZBrtFS |
It looks like mold-linked debug info is broken. If I remove debug info from an executable with |
It looks like there's a bug in the code to handle compressed debug info. I'm preparing a patch. |
I can confirm that this fixes the backtrace issue in Rust 👍 |
Hello, what does |
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/mold"] |
@adsick Are you on windows or on 32bit or an ARM Linux? |
I am on Fedora Linux 35 (64 bit) |
@adsick did you put this in |
Of course I did |
@adsick it was supposed to go in |
Ah, yes, I'll fix that, thanks a lot! |
@itsfarseen I've enabled the discussion forum feature now. |
Minimal repro:
https://github.com/itsfarseen/repro-sqlx-rocket-anyhow-no-backtrace
A notable thing is, if I comment out
use sqlx;
import, it works fine. If I don't importsqlx
, I think Rust compiler is smart enough to skip compiling it.I don't have to use anything inside sqlx, just importing it causes backtraces to be lost.
Cargo.toml
Rust version: rustc 1.53.0-nightly (ca075d268 2021-04-28)
The text was updated successfully, but these errors were encountered: