microfetch/.cargo/config.toml
Amaan Qureshi 1539533c54
build: move link flags to build.rs
Binary-specific link flags (-nostartfiles, -static, section stripping)
now use cargo:rustc-link-arg-bin so they don't break proc-macro or
build-script linking. ld-wrapper only strips sections from static
binaries.
2026-04-11 02:53:36 -04:00

16 lines
719 B
TOML

# 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>
#
# 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",
]