mold icon indicating copy to clipboard operation
mold copied to clipboard

mold + rust + mac missing line numbers

Open nipunn1313 opened this issue 3 years ago • 3 comments

Using mold on mac with rust

✗ mold --version
mold 1.4.2 (compatible with GNU ld)

Test program:

➜  test_crash git:(master) ✗ cat src/main.rs
fn main() {
    panic!("HELLO");
}

Without mold

➜  test_crash git:(master) ✗ RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/test_crash`
thread 'main' panicked at 'HELLO', src/main.rs:2:5
stack backtrace:
   0: rust_begin_unwind
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/panicking.rs:100:14
   2: test_crash::main
             at ./src/main.rs:2:5
   3: core::ops::function::FnOnce::call_once
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

With mold

➜  test_crash git:(master) ✗ RUSTFLAGS="-C link-arg=-fuse-ld=/opt/homebrew/bin/ld64.mold" RUST_BACKTRACE=1 cargo run
   Compiling test_crash v0.1.0 (/Users/nipunn/src/test_crash)
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/test_crash`
thread 'main' panicked at 'HELLO', src/main.rs:2:5
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: test_crash::main
   3: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

nipunn1313 avatar Sep 26 '22 23:09 nipunn1313

I can not reproduce this on my Linux machine:

ENV

$ rustc --version
rustc 1.64.0 (a55dd71d5 2022-09-19)

$ mold --version
mold 1.4.2 (compatible with GNU ld)

$ uname -a
Linux fedora 5.19.9-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Sep 15 09:49:52 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

TEST

$ cat ~/.cargo/config.toml
[build]
rustflags = ["-C", "link-arg=-fuse-ld=mold"]

$ cat src/main.rs
fn main() {
    panic!("HELLO");
}

$ RUST_BACKTRACE=1 cargo r -q
thread 'main' panicked at 'HELLO', src/main.rs:2:5
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
   2: rust::main
             at ./src/main.rs:2:5
   3: core::ops::function::FnOnce::call_once
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

SteveLauC avatar Sep 27 '22 07:09 SteveLauC

mold/macOS is internally a different implementation than mold/Linux, so it's not surprising that it's not reproducible on Linux.

rui314 avatar Sep 27 '22 07:09 rui314

Related to #663?

nsabovic avatar Nov 19 '22 22:11 nsabovic