build: replace mold with the wild linker

This commit is contained in:
Amaan Qureshi 2026-06-15 21:53:46 -04:00
commit b42e6f4af9
No known key found for this signature in database
GPG key ID: 2171751AD2A2739A
8 changed files with 53 additions and 66 deletions

View file

@ -1,16 +1,16 @@
# Use a linker wrapper that invokes mold then strips junk sections with objcopy.
# mold cannot discard .eh_frame/.dynstr/.comment via linker scripts, so we do
# it as a post-link step.
# See:
# <https://github.com/rui314/mold?tab=readme-ov-file#how-to-use>
# Link the tier-1 Linux arches with the wild linker, driven by clang via the
# scripts/clang-wild wrapper.
#
# Binary-specific link flags live in microfetch/build.rs via cargo:rustc-link-arg-bin
# so they only affect the final binary and don't break proc-macro or build-script linking.
[target.'cfg(target_os = "linux")']
linker = "scripts/ld-wrapper"
rustflags = [
# Suppress .eh_frame emission from our own codegen (does not cover compiler_builtins;
# those remnants are removed by the linker wrapper via objcopy post-link)
"-C",
"force-unwind-tables=no",
]
# Suppress .eh_frame emission from our own codegen.
rustflags = ["-C", "force-unwind-tables=no"]
[target.x86_64-unknown-linux-gnu]
linker = "scripts/clang-wild"
rustflags = ["-C", "force-unwind-tables=no"]
[target.aarch64-unknown-linux-gnu]
linker = "scripts/clang-wild"
rustflags = ["-C", "force-unwind-tables=no"]