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)