aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwangpc <wangpengcheng.pp@bytedance.com>2024-02-29 12:06:46 +0800
committerChristoph Müllner <christophm30@gmail.com>2024-02-29 14:04:37 +0100
commit94dddaf5e55fe85054b54988ad503e4d2f5a8966 (patch)
tree0937a2fc8d3e031e278749eb9a034aedead52761
parent19464804adf3a8ec03de55a29de984e053f6cb3a (diff)
downloadriscv-gnu-toolchain-94dddaf5e55fe85054b54988ad503e4d2f5a8966.zip
riscv-gnu-toolchain-94dddaf5e55fe85054b54988ad503e4d2f5a8966.tar.gz
riscv-gnu-toolchain-94dddaf5e55fe85054b54988ad503e4d2f5a8966.tar.bz2
Add LTO support of Clang/LLVM
We need to build LLVMgold.so and copy it to installation dir. I think it deserves to be default, so I don't add an option to enable this.
-rw-r--r--Makefile.in12
1 files changed, 12 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in
index daab494..46b78bd 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -357,6 +357,8 @@ stamps/build-binutils-linux: $(BINUTILS_SRCDIR) $(BINUTILS_SRC_GIT) $(PREPARATIO
$(CONFIGURE_HOST) \
--prefix=$(INSTALL_DIR) \
--with-sysroot=$(SYSROOT) \
+ --enable-gold \
+ --enable-plugins \
$(MULTILIB_FLAGS) \
@with_guile@ \
--disable-werror \
@@ -526,6 +528,8 @@ stamps/build-binutils-linux-native: $(BINUTILS_SRCDIR) $(BINUTILS_SRC_GIT) stamp
--target=$(LINUX_TUPLE) \
$(CONFIGURE_HOST) \
--prefix=$(INSTALL_DIR)/native \
+ --enable-gold \
+ --enable-plugins \
$(MULTILIB_FLAGS) \
@with_guile@ \
--disable-werror \
@@ -583,6 +587,8 @@ stamps/build-binutils-newlib: $(BINUTILS_SRCDIR) $(BINUTILS_SRC_GIT) $(PREPARATI
--target=$(NEWLIB_TUPLE) \
$(CONFIGURE_HOST) \
--prefix=$(INSTALL_DIR) \
+ --enable-gold \
+ --enable-plugins \
@with_guile@ \
--disable-werror \
$(BINUTILS_TARGET_FLAGS) \
@@ -770,6 +776,8 @@ stamps/build-binutils-musl: $(BINUTILS_SRCDIR) $(BINUTILS_SRC_GIT) $(PREPARATION
$(CONFIGURE_HOST) \
--prefix=$(INSTALL_DIR) \
--with-sysroot=$(SYSROOT) \
+ --enable-gold \
+ --enable-plugins \
$(MULTILIB_FLAGS) \
@with_guile@ \
--disable-werror \
@@ -966,10 +974,12 @@ stamps/build-llvm-linux: $(LLVM_SRCDIR) $(LLVM_SRC_GIT) \
-DDEFAULT_SYSROOT="../sysroot" \
-DLLVM_RUNTIME_TARGETS=$(call make_tuple,$(XLEN),linux-gnu) \
-DLLVM_INSTALL_TOOLCHAIN_ONLY=On \
+ -DLLVM_BINUTILS_INCDIR=`find $(INSTALL_DIR) -name plugin-api.h | xargs dirname` \
-DLLVM_PARALLEL_LINK_JOBS=4
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
cp $(notdir $@)/lib/riscv$(XLEN)-unknown-linux-gnu/libc++* $(SYSROOT)/lib
+ cp $(notdir $@)/lib/LLVMgold.so $(INSTALL_DIR)/lib
cd $(INSTALL_DIR)/bin && ln -s -f clang $(LINUX_TUPLE)-clang && ln -s -f clang++ $(LINUX_TUPLE)-clang++
mkdir -p $(dir $@) && touch $@
@@ -984,9 +994,11 @@ stamps/build-llvm-newlib: $(LLVM_SRCDIR) $(LLVM_SRC_GIT) stamps/build-gcc-newlib
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_DEFAULT_TARGET_TRIPLE="$(NEWLIB_TUPLE)" \
-DLLVM_INSTALL_TOOLCHAIN_ONLY=On \
+ -DLLVM_BINUTILS_INCDIR=`find $(INSTALL_DIR) -name plugin-api.h | xargs dirname` \
-DLLVM_PARALLEL_LINK_JOBS=4
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
+ cp $(notdir $@)/lib/LLVMgold.so $(INSTALL_DIR)/lib
cd $(INSTALL_DIR)/bin && ln -s -f clang $(NEWLIB_TUPLE)-clang && \
ln -s -f clang++ $(NEWLIB_TUPLE)-clang++
mkdir -p $(dir $@) && touch $@