denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
94.66k stars 5.25k forks source link

Linking with mold #15804

Open littledivy opened 2 years ago

littledivy commented 2 years ago

M1

mold:

lld:

CheatCod commented 1 year ago

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

littledivy commented 4 months ago

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