mold: Segfault linking llvm-sys

Possibly related: https://github.com/rui314/mold/issues/1164

Create a ~/.cargo/config.toml file and put this in it:

[target.x86_64-unknown-linux-gnu]
rustflags = [
  # Doubt these matter
  "-C", "target-cpu=native",
  "-C", "target-feature=-avx2",
  # This is the line that breaks things
  "-C", "link-arg=-fuse-ld=mold", "-C", "link-arg=-Wl,--icf=all",
]

Checkout https://github.com/TheDan64/inkwell/commit/0b2cde9394320ab6f097ef10408d663a28d44be3 and then run cargo t --features llvm16-0. Tasty segfault.

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

Since it’s a distro-provided LLVM package I suspect that strip was ran on it which is known to corrupt addrsig sections. LLD has a workaround for it but we don’t and we didn’t actually encounter such corrupt files until now.

Let me quickly draft a workaround in mold to so that you can test if it fixes your case.