Skip to content

Commit 94dddaf

Browse files
wangpc-ppcmuellner
authored andcommitted
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.
1 parent 1946480 commit 94dddaf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Makefile.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ stamps/build-binutils-linux: $(BINUTILS_SRCDIR) $(BINUTILS_SRC_GIT) $(PREPARATIO
357357
$(CONFIGURE_HOST) \
358358
--prefix=$(INSTALL_DIR) \
359359
--with-sysroot=$(SYSROOT) \
360+
--enable-gold \
361+
--enable-plugins \
360362
$(MULTILIB_FLAGS) \
361363
@with_guile@ \
362364
--disable-werror \
@@ -526,6 +528,8 @@ stamps/build-binutils-linux-native: $(BINUTILS_SRCDIR) $(BINUTILS_SRC_GIT) stamp
526528
--target=$(LINUX_TUPLE) \
527529
$(CONFIGURE_HOST) \
528530
--prefix=$(INSTALL_DIR)/native \
531+
--enable-gold \
532+
--enable-plugins \
529533
$(MULTILIB_FLAGS) \
530534
@with_guile@ \
531535
--disable-werror \
@@ -583,6 +587,8 @@ stamps/build-binutils-newlib: $(BINUTILS_SRCDIR) $(BINUTILS_SRC_GIT) $(PREPARATI
583587
--target=$(NEWLIB_TUPLE) \
584588
$(CONFIGURE_HOST) \
585589
--prefix=$(INSTALL_DIR) \
590+
--enable-gold \
591+
--enable-plugins \
586592
@with_guile@ \
587593
--disable-werror \
588594
$(BINUTILS_TARGET_FLAGS) \
@@ -770,6 +776,8 @@ stamps/build-binutils-musl: $(BINUTILS_SRCDIR) $(BINUTILS_SRC_GIT) $(PREPARATION
770776
$(CONFIGURE_HOST) \
771777
--prefix=$(INSTALL_DIR) \
772778
--with-sysroot=$(SYSROOT) \
779+
--enable-gold \
780+
--enable-plugins \
773781
$(MULTILIB_FLAGS) \
774782
@with_guile@ \
775783
--disable-werror \
@@ -966,10 +974,12 @@ stamps/build-llvm-linux: $(LLVM_SRCDIR) $(LLVM_SRC_GIT) \
966974
-DDEFAULT_SYSROOT="../sysroot" \
967975
-DLLVM_RUNTIME_TARGETS=$(call make_tuple,$(XLEN),linux-gnu) \
968976
-DLLVM_INSTALL_TOOLCHAIN_ONLY=On \
977+
-DLLVM_BINUTILS_INCDIR=`find $(INSTALL_DIR) -name plugin-api.h | xargs dirname` \
969978
-DLLVM_PARALLEL_LINK_JOBS=4
970979
$(MAKE) -C $(notdir $@)
971980
$(MAKE) -C $(notdir $@) install
972981
cp $(notdir $@)/lib/riscv$(XLEN)-unknown-linux-gnu/libc++* $(SYSROOT)/lib
982+
cp $(notdir $@)/lib/LLVMgold.so $(INSTALL_DIR)/lib
973983
cd $(INSTALL_DIR)/bin && ln -s -f clang $(LINUX_TUPLE)-clang && ln -s -f clang++ $(LINUX_TUPLE)-clang++
974984
mkdir -p $(dir $@) && touch $@
975985

@@ -984,9 +994,11 @@ stamps/build-llvm-newlib: $(LLVM_SRCDIR) $(LLVM_SRC_GIT) stamps/build-gcc-newlib
984994
-DLLVM_ENABLE_PROJECTS="clang;lld" \
985995
-DLLVM_DEFAULT_TARGET_TRIPLE="$(NEWLIB_TUPLE)" \
986996
-DLLVM_INSTALL_TOOLCHAIN_ONLY=On \
997+
-DLLVM_BINUTILS_INCDIR=`find $(INSTALL_DIR) -name plugin-api.h | xargs dirname` \
987998
-DLLVM_PARALLEL_LINK_JOBS=4
988999
$(MAKE) -C $(notdir $@)
9891000
$(MAKE) -C $(notdir $@) install
1001+
cp $(notdir $@)/lib/LLVMgold.so $(INSTALL_DIR)/lib
9901002
cd $(INSTALL_DIR)/bin && ln -s -f clang $(NEWLIB_TUPLE)-clang && \
9911003
ln -s -f clang++ $(NEWLIB_TUPLE)-clang++
9921004
mkdir -p $(dir $@) && touch $@

0 commit comments

Comments
 (0)