deno icon indicating copy to clipboard operation
deno copied to clipboard

Linking with mold

Open littledivy opened this issue 3 years ago • 2 comments

M1

mold:

  • Incremental release build: 4m 50s
  • fresh release build: 6m 23s
  • incremental debug build: 5s
  • fresh debug build: 1m 57s

lld:

  • incremental release build: 5m 59s
  • fresh release build: 6m 52s
  • incremental debug build: 17s
  • fresh debug build: 3m 02s

littledivy avatar Sep 07 '22 13:09 littledivy

I'm running into linker errors using mold on linux. I'm on Ubuntu 22.04 with AMD Ryzen 3700x.

  = note: mold: error: undefined symbol: deno/target/debug/deps/librusqlite-3dc0f25710901296.rlib(rusqlite-3dc0f25710901296.rusqlite.aa997a1e-cgu.15.rcgu.o): sqlite3_error_offset
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: could not compile `deno_runtime` due to previous error

Same error happens with lld too

CheatCod avatar May 08 '23 23:05 CheatCod

I'm getting 2x faster debug builds with mold -run as of fabd9a214b278bb119818187de66121c5f91b751

[divy@divy deno]$ time mold -run cargo build -p deno --bin=deno
   Compiling deno_fs v0.62.0 (/home/divy/gh/deno/ext/fs)
   Compiling deno_node v0.89.0 (/home/divy/gh/deno/ext/node)
   Compiling deno_kv v0.60.0 (/home/divy/gh/deno/ext/kv)
   Compiling deno_runtime v0.160.0 (/home/divy/gh/deno/runtime)
   Compiling deno v1.43.4 (/home/divy/gh/deno/cli)
warning: struct `TestRegisterResult` is never constructed
  --> cli/ops/testing.rs:99:8
   |
99 | struct TestRegisterResult {
   |        ^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: `deno` (bin "deno") generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 26.66s

real	0m26.717s
user	0m19.413s
sys	0m3.822s
[divy@divy deno]$ time cargo build -p deno --bin=deno
   Compiling deno_fs v0.62.0 (/home/divy/gh/deno/ext/fs)
   Compiling deno_node v0.89.0 (/home/divy/gh/deno/ext/node)
   Compiling deno_kv v0.60.0 (/home/divy/gh/deno/ext/kv)
   Compiling deno_runtime v0.160.0 (/home/divy/gh/deno/runtime)
   Compiling deno v1.43.4 (/home/divy/gh/deno/cli)
warning: struct `TestRegisterResult` is never constructed
  --> cli/ops/testing.rs:99:8
   |
99 | struct TestRegisterResult {
   |        ^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: `deno` (bin "deno") generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 50.10s

real	0m50.288s
user	0m39.570s
sys	0m13.591s
[divy@divy deno]$
$ readelf -p .comment target/debug/deno
String dump of section '.comment':
  [     0]  mold 2.31.0 (02b439af483484693de1e6a851a2f8b1a95656bb; compatible with GNU ld)
  [    50]  rustc version 1.78.0 (9b00956e5 2024-04-29) (Arch Linux rust 1:1.78.0-1)
  [    99]  GCC: (GNU) 14.1.1 20240507

littledivy avatar May 22 '24 07:05 littledivy