toolchain: add mold as additional linker
authorAndre Heider <a.heider@gmail.com>
Fri, 27 Jan 2023 16:53:02 +0000 (17:53 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Tue, 4 Jul 2023 18:25:41 +0000 (20:25 +0200)
Install it as $tripple-ld.mold in order to use -fuse-ld=mold.

Signed-off-by: Andre Heider <a.heider@gmail.com>
toolchain/Makefile
toolchain/mold/Makefile [new file with mode: 0644]

index c0046293c9244ac4f4c0d6e8cbfff713934489b7..09c16f72a780875f5cc8f9425192fee2eb2ad61b 100644 (file)
@@ -27,7 +27,7 @@
 curdir:=toolchain
 
 # subdirectories to descend into
-$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/initial gcc/final $(LIBC) fortify-headers) $(if $(CONFIG_NASM),nasm)
+$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/initial gcc/final $(LIBC) fortify-headers) $(if $(CONFIG_NASM),nasm) $(if $(CONFIG_USE_MOLD),mold)
 
 # builddir dependencies
 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
diff --git a/toolchain/mold/Makefile b/toolchain/mold/Makefile
new file mode 100644 (file)
index 0000000..a2acba8
--- /dev/null
@@ -0,0 +1,22 @@
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/toolchain-build.mk
+
+define Host/Configure
+endef
+
+define Host/Compile
+endef
+
+define Host/Install
+       $(INSTALL_DIR) $(TOOLCHAIN_DIR)/bin
+       $(INSTALL_BIN) $(STAGING_DIR_HOST)/bin/mold $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld.mold
+endef
+
+define Host/Clean
+endef
+
+$(eval $(call HostBuild))