summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2017-03-17 21:23:14 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2017-03-17 21:23:29 +0100
commite80e2408d4e54999784338182527ec16949addd8 (patch)
treeda387582912c3d0fc94d5d9f178523a2b97e8c7a
parent2c564b6fc8d396c5b56eab073d5ac89fc6b3cce1 (diff)
llvm: update to 4.0.0, allow to compile musl with it
-rw-r--r--mk/vars.mk6
-rw-r--r--toolchain/Makefile10
-rw-r--r--toolchain/llvm/Makefile34
-rw-r--r--toolchain/llvm/Makefile.inc6
4 files changed, 44 insertions, 12 deletions
diff --git a/mk/vars.mk b/mk/vars.mk
index e017dee9e..7dcc756ee 100644
--- a/mk/vars.mk
+++ b/mk/vars.mk
@@ -102,8 +102,11 @@ endif
ifeq ($(ADK_BUILD_COMPILER_LLVM),y)
TARGET_CC:= clang --target=${GNU_TARGET_NAME} --sysroot=$(STAGING_TARGET_DIR)
TARGET_CXX:= clang++ --target=${GNU_TARGET_NAME} --sysroot=$(STAGING_TARGET_DIR)
+TARGET_LDFLAGS:= -fuse-ld=lld -stdlib=libc++
endif
+# gcc specific
+ifeq ($(ADK_BUILD_COMPILER_GCC),y)
# for x86_64 x32 ABI we need to extend TARGET_CC/TARGET_CXX
ifeq ($(ADK_TARGET_ABI_X32),y)
TARGET_CC+= $(ADK_TARGET_ABI_CFLAGS)
@@ -238,6 +241,9 @@ TARGET_CFLAGS+= -mxl-barrel-shift
TARGET_CXXFLAGS+= -mxl-barrel-shift
endif
+endif
+# end gcc specific
+
# add configured compiler flags for optimization
TARGET_CFLAGS+= $(ADK_TARGET_CFLAGS_OPT)
TARGET_CXXFLAGS+= $(ADK_TARGET_CFLAGS_OPT)
diff --git a/toolchain/Makefile b/toolchain/Makefile
index e90feb42d..fb46789f2 100644
--- a/toolchain/Makefile
+++ b/toolchain/Makefile
@@ -12,13 +12,13 @@
include $(ADK_TOPDIR)/rules.mk
-TARGETS:=binutils gmp mpfr mpc
-
ifeq ($(ADK_BUILD_COMPILER_GCC),y)
+TARGETS:=binutils gmp mpfr mpc
TARGETS+=gcc
COMPILER:=gcc
endif
ifeq ($(ADK_BUILD_COMPILER_LLVM),y)
+TARGETS:=binutils
TARGETS+=llvm
COMPILER:=llvm
endif
@@ -67,7 +67,13 @@ clean: $(TARGETS_CLEAN)
download: $(DOWNLOAD)
final: $(FINAL)
+
+ifeq ($(ADK_BUILD_COMPILER_LLVM),y)
+$(COMPILER)-configure: binutils-install
+else
$(COMPILER)-configure: binutils-install gmp-install mpfr-install mpc-install
+endif
+
ifeq ($(ADK_TARGET_LIB_NEWLIB),y)
$(CLIB)-install: $(COMPILER)-configure
else
diff --git a/toolchain/llvm/Makefile b/toolchain/llvm/Makefile
index 52228f221..be5e4dab8 100644
--- a/toolchain/llvm/Makefile
+++ b/toolchain/llvm/Makefile
@@ -10,32 +10,52 @@ include ${ADK_TOPDIR}/mk/buildhlp.mk
BUILD_DIR_INITIAL:= $(WRKBUILD)-initial
BUILD_DIR_FINAL:= $(WRKBUILD)-final
+LLVM_VERSION:=4.0.0
+
+ifeq ($(ADK_TARGET_ARCH_ARM),y)
LLVM_TARGETS:=ARM
+ifeq ($(ADK_TARGET_SOFT_FLOAT),y)
+LLVM_TRIPLE:=arm-linux-eabi
+endif
+ifeq ($(ADK_TARGET_HARD_FLOAT),y)
+LLVM_TRIPLE:=arm-linux-eabihf
+endif
+endif
$(BUILD_DIR_INITIAL)/.configured:
- (cd $(DL_DIR) && wget http://llvm.org/releases/3.8.0/cfe-3.8.0.src.tar.xz)
- (cd $(DL_DIR) && wget http://llvm.org/releases/3.8.0/compiler-rt-3.8.0.src.tar.xz)
- (cd $(WRKBUILD)/tools && tar xvf $(DL_DIR)/cfe-3.8.0.src.tar.xz && mv cfe-3.8.0.src clang)
- (cd $(WRKBUILD)/projects && tar xvf $(DL_DIR)/compiler-rt-3.8.0.src.tar.xz && mv compiler-rt-3.8.0.src compiler-rt)
+ (cd $(DL_DIR); \
+ for file in cfe lld compiler-rt libcxx libcxxabi; do \
+ if [ ! -f $${file}-$(LLVM_VERSION).src.tar.xz ]; then \
+ wget http://llvm.org/releases/$(LLVM_VERSION)/$${file}-$(LLVM_VERSION).src.tar.xz ; \
+ fi; \
+ done; \
+ )
+ (cd $(WRKBUILD)/tools && tar xvf $(DL_DIR)/cfe-$(LLVM_VERSION).src.tar.xz && mv cfe-$(LLVM_VERSION).src clang)
+ (cd $(WRKBUILD)/tools && tar xvf $(DL_DIR)/lld-$(LLVM_VERSION).src.tar.xz && mv lld-$(LLVM_VERSION).src lld)
+ (cd $(WRKBUILD)/projects && tar xvf $(DL_DIR)/compiler-rt-$(LLVM_VERSION).src.tar.xz && mv compiler-rt-$(LLVM_VERSION).src compiler-rt)
+ (cd $(WRKBUILD)/projects && tar xvf $(DL_DIR)/libcxx-$(LLVM_VERSION).src.tar.xz && mv libcxx-$(LLVM_VERSION).src libcxx)
+ (cd $(WRKBUILD)/projects && tar xvf $(DL_DIR)/libcxxabi-$(LLVM_VERSION).src.tar.xz && mv libcxxabi-$(LLVM_VERSION).src libcxxabi)
mkdir -p $(BUILD_DIR_INITIAL)
cd $(BUILD_DIR_INITIAL); \
PATH='$(HOST_PATH)' \
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$(TOOLCHAIN_DIR)/usr \
- -DLLVM_DEFAULT_TARGET_TRIPLE="arm-none-eabi" \
-DCMAKE_CXX_FLAGS="-std=c++11" \
+ -DLLVM_ENABLE_EH=ON \
+ -DLLVM_ENABLE_RTTI=ON \
+ -DLLVM_DEFAULT_TARGET_TRIPLE=$(LLVM_TRIPLE) \
-DLLVM_TARGETS_TO_BUILD=$(LLVM_TARGETS) \
$(WRKBUILD)
touch $@
$(BUILD_DIR_INITIAL)/.compiled: $(BUILD_DIR_INITIAL)/.configured
PATH='$(TARGET_PATH)' \
- $(MAKE) -C $(BUILD_DIR_INITIAL) all
+ $(MAKE) -j$(ADK_MAKE_JOBS) -C $(BUILD_DIR_INITIAL) all
touch $@
$(WRKBUILD)/.configured: $(BUILD_DIR_INITIAL)/.compiled
PATH='$(TARGET_PATH)' \
- $(MAKE) -C $(BUILD_DIR_INITIAL) install
+ $(MAKE) -j$(ADK_MAKE_JOBS) -C $(BUILD_DIR_INITIAL) install
touch $@
$(WRKBUILD)/.compiled:
diff --git a/toolchain/llvm/Makefile.inc b/toolchain/llvm/Makefile.inc
index 1c66bedc5..fe41a1d93 100644
--- a/toolchain/llvm/Makefile.inc
+++ b/toolchain/llvm/Makefile.inc
@@ -2,9 +2,9 @@
# material, please see the LICENCE file in the top-level directory.
PKG_NAME:= llvm
-PKG_VERSION:= 3.8.0
-PKG_HASH:= 555b028e9ee0f6445ff8f949ea10e9cd8be0d084840e21fbbe1d31d51fc06e46
-PKG_SITES:= http://llvm.org/releases/3.8.0/
+PKG_VERSION:= 4.0.0
+PKG_HASH:= 8d10511df96e73b8ff9e7abbfb4d4d432edbdbe965f1f4f07afaf370b8a533be
+PKG_SITES:= http://llvm.org/releases/4.0.0/
PKG_RELEASE:= 1
DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.src.tar.xz
WRKDIST= ${WRKDIR}/${PKG_NAME}-${PKG_VERSION}.src