From 82822e450477e7e859ecde656f6e6a6e6c05e930 Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Sat, 16 Nov 2024 10:43:37 +0000 Subject: [PATCH] config: add extras for lld and mold --- config/extra/with-lld.mk | 1 + config/extra/with-mold.mk | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 config/extra/with-lld.mk create mode 100644 config/extra/with-mold.mk diff --git a/config/extra/with-lld.mk b/config/extra/with-lld.mk new file mode 100644 index 0000000000..a028924676 --- /dev/null +++ b/config/extra/with-lld.mk @@ -0,0 +1 @@ +LDFLAGS+=-fuse-ld=lld diff --git a/config/extra/with-mold.mk b/config/extra/with-mold.mk new file mode 100644 index 0000000000..6d6639e790 --- /dev/null +++ b/config/extra/with-mold.mk @@ -0,0 +1,16 @@ +# Switches linker to 'mold' +# https://github.com/rui314/mold +# +# This linker is usually much faster than the default linker when working +# with large binaries (Rust projects, fdctl, etc.) + +MOLD_LDFLAGS=-fuse-ld=mold + +ifdef FD_USING_GCC +ifeq ($(shell test $(FD_COMPILER_MAJOR_VERSION) -lt 12 && echo 1),1) +# Old GCC versions don't recognize mold +MOLD_LDFLAGS=-B$(shell which mold) +endif +endif + +LDFLAGS+=$(MOLD_LDFLAGS)