From 7090a2418c31fda63541796a71a0634e0f8788aa Mon Sep 17 00:00:00 2001 From: Abdoulaye Walsimou Gaye Date: Sat, 15 Mar 2014 16:47:19 +0100 Subject: Toolchain: llvm/libcxxrt: move under toolchain/ Signed-off-by: Abdoulaye Walsimou Gaye --- toolchain/compiler-options.kconfig | 90 +++++++++++++++++ toolchain/libcxxrt/Makefile | 108 ++++++++++++++++++++ toolchain/libcxxrt/libcxxrt.kconfig | 76 ++++++++++++++ toolchain/libcxxrt/libcxxrt.mk | 56 +++++++++++ toolchain/llvm/clang-llvm.kconfig | 49 +++++++++ toolchain/llvm/clang/clang.kconfig | 80 +++++++++++++++ toolchain/llvm/clang/clang.mk | 39 +++++++ toolchain/llvm/compiler-rt/Makefile | 134 +++++++++++++++++++++++++ toolchain/llvm/compiler-rt/compiler-rt.kconfig | 77 ++++++++++++++ toolchain/llvm/compiler-rt/compiler-rt.mk | 81 +++++++++++++++ toolchain/llvm/libc++/Makefile | 98 ++++++++++++++++++ toolchain/llvm/libc++/libcxx.kconfig | 80 +++++++++++++++ toolchain/llvm/libc++/libcxx.mk | 71 +++++++++++++ toolchain/llvm/llvm/llvm.kconfig | 79 +++++++++++++++ toolchain/llvm/llvm/llvm.mk | 88 ++++++++++++++++ toolchain/toolchain.kconfig | 10 +- toolchain/toolchain.mk | 10 +- 17 files changed, 1216 insertions(+), 10 deletions(-) create mode 100644 toolchain/compiler-options.kconfig create mode 100644 toolchain/libcxxrt/Makefile create mode 100644 toolchain/libcxxrt/libcxxrt.kconfig create mode 100644 toolchain/libcxxrt/libcxxrt.mk create mode 100644 toolchain/llvm/clang-llvm.kconfig create mode 100644 toolchain/llvm/clang/clang.kconfig create mode 100644 toolchain/llvm/clang/clang.mk create mode 100644 toolchain/llvm/compiler-rt/Makefile create mode 100644 toolchain/llvm/compiler-rt/compiler-rt.kconfig create mode 100644 toolchain/llvm/compiler-rt/compiler-rt.mk create mode 100644 toolchain/llvm/libc++/Makefile create mode 100644 toolchain/llvm/libc++/libcxx.kconfig create mode 100644 toolchain/llvm/libc++/libcxx.mk create mode 100644 toolchain/llvm/llvm/llvm.kconfig create mode 100644 toolchain/llvm/llvm/llvm.mk (limited to 'toolchain') diff --git a/toolchain/compiler-options.kconfig b/toolchain/compiler-options.kconfig new file mode 100644 index 0000000..cfad62f --- /dev/null +++ b/toolchain/compiler-options.kconfig @@ -0,0 +1,90 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012-2013 Abdoulaye Walsimou GAYE . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################ +# +# \file gcc-options.kconfig +# \brief gcc-options.kconfig of Embtoolkit +# \author Abdoulaye Walsimou GAYE +# \date February 2012 +################################################################################ + +config EMBTK_GCC_LANGUAGE_CPP + bool "Support C++" + select KEMBTK_UCLIBC_UCLIBC_HAS_FLOATS if EMBTK_CLIB_UCLIBC + select KEMBTK_UCLIBC_UCLIBC_SUSV3_LEGACY if EMBTK_CLIB_UCLIBC + select KEMBTK_UCLIBC_UCLIBC_CTOR_DTOR if EMBTK_CLIB_UCLIBC + select KEMBTK_UCLIBC_UCLIBC_DYNAMIC_ATEXIT if EMBTK_CLIB_UCLIBC + select KEMBTK_EGLIBC_OPTION_EGLIBC_LIBM if EMBTK_CLIB_EGLIBC + select KEMBTK_EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR if EMBTK_CLIB_EGLIBC + select KEMBTK_EGLIBC_OPTION_POSIX_WIDE_CHAR_DEVICE_IO if EMBTK_CLIB_EGLIBC + help + Your toolchain will be able to build C++ source code +choice + prompt "C++ standard library implementation" + depends on EMBTK_GCC_LANGUAGE_CPP + help + Here you can choose which GCC series you want to use. + + config EMBTK_CXXLIB_GCC_LIBSTDCXX + bool "GCC libstdc++" + help + GCC C++ standard library implementation, under GPLv3 with + runtime exception (see http://gcc.gnu.org/onlinedocs for more + details). + +endchoice + +config EMBTK_CXXLIB_LLVM_LIBCXX + bool + depends on (EMBTK_LLVM_ONLY_TOOLCHAIN || EMBTK_GCC_AND_LLVM_TOOLCHAIN) && (EMBTK_ARCH_MIPS && EMBTK_TARGET_ARCH_32BITS) + help + LLVM C++ standard library implementation, under + the MIT license and the UIUC License (a BSD-like license). + See http://libcxx.llvm.org + +source "toolchain/llvm/libc++/libcxx.kconfig" +source "toolchain/libcxxrt/libcxxrt.kconfig" + +#config EMBTK_GCC_LANGUAGE_JAVA +# bool "Support Java" +# help +# Your toolchain will be able to build Java source code + +config EMBTK_GCC_LANGUAGE_OBJECTIVEC + bool "Support Objective-C" + depends on !EMBTK_CLIB_UCLIBC + help + Your toolchain will be able to build Objective-C source code + +config EMBTK_GCC_LANGUAGE_OBJECTIVECPP + bool "Support Objective-C++" + depends on !EMBTK_CLIB_UCLIBC + help + Your toolchain will be able to build Objective-C source code + +if EMBTK_GCC_ONLY_TOOLCHAIN || EMBTK_GCC_AND_LLVM_TOOLCHAIN +config EMBTK_GCC_LANGUAGE_FORTRAN + bool "Support Fortran" + help + Your toolchain will be able to build fortran source code +endif + +#config EMBTK_GCC_LANGUAGE_ADA +# bool "Support Ada" +# help +# Your toolchain will be able to build Ada source code diff --git a/toolchain/libcxxrt/Makefile b/toolchain/libcxxrt/Makefile new file mode 100644 index 0000000..d7fa28b --- /dev/null +++ b/toolchain/libcxxrt/Makefile @@ -0,0 +1,108 @@ +################################################################################ +# Copyright 2012 Abdoulaye Walsimou GAYE . All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +################################################################################ + +rootsrc ?= $(shell pwd) +LIBDIR ?= lib + +__NO_C_SRCS := $(addprefix $(rootsrc)/src/,cxa_atexit.c cxa_finalize.c) +C_SRCS := $(wildcard $(rootsrc)/src/*.c) +C_SRCS := $(filter-out $(__NO_C_SRCS),$(C_SRCS)) + +CXX_SRCS := $(wildcard $(rootsrc)/src/*.cc) + +__HEADERS := cxxabi.h unwind-arm.h unwind.h unwind-itanium.h +HEADERS := $(addprefix $(rootsrc)/src/,$(__HEADERS)) + +OBJS := $(patsubst %.c,%.o,$(C_SRCS)) +OBJS += $(patsubst %.cc,%.o,$(CXX_SRCS)) +POBJS := $(patsubst %.o,%.po,$(OBJS)) +SOBJS := $(patsubst %.o,%.So,$(OBJS)) + +LIB := cxxrt +SHAREDLIB := $(LIB) +SHAREDLIB_NAME := lib$(SHAREDLIB).so.1 +SHAREDLIB_LINK := lib$(SHAREDLIB).so +SHAREDLIB_SONAME := $(SHAREDLIB_NAME) + +CC ?= gcc +CXX ?= g++ + +ARFLAGS := rvs + +override CFLAGS := $(CFLAGS) -I$(rootsrc)/src -D_GNU_SOURCE +override CXXFLAGS := $(CXXFLAGS) $(CFLAGS) + +define __lib_install + $(if $(SYSROOT), + mkdir -p $(SYSROOT)/$(LIBDIR) + mkdir -p $(SYSROOT)/usr + mkdir -p $(SYSROOT)/usr/include + mkdir -p $(SYSROOT)/usr/include/c++ + mkdir -p $(SYSROOT)/usr/include/c++/v1 + cp lib$(LIB).a $(SYSROOT)/usr/$(LIBDIR)/ + cp lib$(LIB)_pic.a $(SYSROOT)/usr/$(LIBDIR)/ + cp lib$(LIB)_p.a $(SYSROOT)/usr/$(LIBDIR)/ + cp $(HEADERS) $(SYSROOT)/usr/include/c++/v1/) +endef + +all: lib$(LIB).a lib$(LIB)_p.a lib$(LIB)_pic.a + $(Q)true + +install: all + $(Q)$(__lib_install) + $(Q)true + +lib$(LIB).a: $(OBJS) + $(Q)$(AR) $(ARFLAGS) $@ $(OBJS) $(ARADD) + +lib$(LIB)_p.a: $(POBJS) + $(Q)$(AR) $(ARFLAGS) $@ $(POBJS) $(ARADD) + +lib$(LIB)_pic.a: $(SOBJS) + $(Q)$(AR) $(ARFLAGS) $@ $(SOBJS) $(ARADD) + +%.o: %.c + $(Q)$(CC) $(CFLAGS) -c $< -o $@ + +%.o: %.cc + $(Q)$(CXX) $(CXXFLAGS) -c $< -o $@ + +%.po: %.c + $(Q)$(CC) $(CFLAGS) -pg -c $< -o $@ + +%.po: %.cc + $(Q)$(CXX) $(CXXFLAGS) -pg -c $< -o $@ + +%.So: %.c + $(Q)$(CC) -fPIC -DPIC $(CFLAGS) -c $< -o $@ + +%.So: %.cc + $(Q)$(CXX) $(CXXFLAGS) -fPIC -DPIC $(CXXFLAGS) -c $< -o $@ + +clean: + $(Q)rm -rf $(OBJS) $(SOBJS) $(POBJS) + $(Q)rm -rf lib$(LIB).a lib$(LIB)_p.a lib$(LIB)_pic.a + diff --git a/toolchain/libcxxrt/libcxxrt.kconfig b/toolchain/libcxxrt/libcxxrt.kconfig new file mode 100644 index 0000000..f6fa697 --- /dev/null +++ b/toolchain/libcxxrt/libcxxrt.kconfig @@ -0,0 +1,76 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012 Abdoulaye Walsimou GAYE . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################ +# +# \file libcxxrt.kconfig +# \brief libcxxrt.kconfig of Embtoolkit +# \author Abdoulaye Walsimou GAYE +# \date December 2012 +################################################################################ + +config EMBTK_HAVE_LIBCXXRT + bool + depends on EMBTK_CXXLIB_LLVM_LIBCXX + select EMBTK_LIBCXXRT_VERSION_4_0_10 + default y + +# +# libcxxrt version +# +config EMBTK_LIBCXXRT_VERSION_4_0_10 + bool + select EMBTK_LIBCXXRT_NEED_PATCH + +config EMBTK_LIBCXXRT_VERSION_GIT + bool + help + Answer Y here if you want to build your toolchain based on + libcxxrt sources from its GIT repository. + +# +# GIT repository options +# +config EMBTK_LIBCXXRT_GIT_BRANCH + string "Branch to use" + default "master" + depends on EMBTK_LIBCXXRT_VERSION_GIT + help + The branch of the git repository to use, the default is master. + +config EMBTK_LIBCXXRT_GIT_REVISION + string "Checkout a specific revision instead of the latest" + depends on EMBTK_LIBCXXRT_VERSION_GIT + help + Chechout a specific revision instead of the latest. + +config EMBTK_LIBCXXRT_REFSPEC + string + default "toolchain" + +# +# Versions strings for tarball packages. +# +config EMBTK_LIBCXXRT_VERSION_STRING + string + default "4.0.10" if EMBTK_LIBCXXRT_VERSION_4_0_10 + default "git" if EMBTK_LIBCXXRT_VERSION_GIT + +config EMBTK_LIBCXXRT_NEED_PATCH + bool +config EMBTK_LIBCXXRT_NEED_AUTORECONF + bool diff --git a/toolchain/libcxxrt/libcxxrt.mk b/toolchain/libcxxrt/libcxxrt.mk new file mode 100644 index 0000000..bf12ecf --- /dev/null +++ b/toolchain/libcxxrt/libcxxrt.mk @@ -0,0 +1,56 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012 Abdoulaye Walsimou GAYE . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################ +# +# \file libcxxrt.mk +# \brief libcxxrt.mk of Embtoolkit +# \author Abdoulaye Walsimou GAYE +# \date December 2012 +################################################################################ + +LIBCXXRT_NAME := libcxxrt +LIBCXXRT_VERSION := $(call embtk_get_pkgversion,libcxxrt) +LIBCXXRT_SITE := ftp://ftp.embtoolkit.org/embtoolkit.org/packages-mirror/$(LIBCXXRT_VERSION) +#LIBCXXRT_GIT_SITE := git://github.com/pathscale/libcxxrt.git +LIBCXXRT_GIT_SITE := git://www.embtoolkit.org/libcxxrt.git +LIBCXXRT_PACKAGE := libcxxrt-$(LIBCXXRT_VERSION).tar.bz2 +LIBCXXRT_SRC_DIR := $(embtk_toolsb)/libcxxrt-$(LIBCXXRT_VERSION) +LIBCXXRT_BUILD_DIR := $(call __embtk_pkg_srcdir,libcxxrt) + +__embtk_libcxxrt_cflags := $(TARGET_CFLAGS) + +LIBCXXRT_MAKE_OPTS := CC="$(TARGETCC)" CFLAGS="$(__embtk_libcxxrt_cflags)" +LIBCXXRT_MAKE_OPTS += CXX="$(TARGETCXX)" LIBDIR=$(LIBDIR) +LIBCXXRT_MAKE_OPTS += AR=$(TARGETAR) RANLIB=$(TARGETRANLIB) +LIBCXXRT_MAKE_OPTS += SYSROOT="$(embtk_sysroot)" + +define embtk_install_libcxxrt + $(call embtk_makeinstall_pkg,libcxxrt) +endef + +define embtk_beforeinstall_libcxxrt + ln -sf $(EMBTK_ROOT)/mk/libc++/libcxxrt/Makefile \ + $(LIBCXXRT_BUILD_DIR)/Makefile +endef + +define embtk_cleanup_libcxxrt + if [ -e $(LIBCXXRT_BUILD_DIR)/Makefile ]; then \ + $(MAKE) -C $(LIBCXXRT_BUILD_DIR) clean; \ + fi + rm -rf $(LIBCXXRT_BUILD_DIR)/Makefile +endef diff --git a/toolchain/llvm/clang-llvm.kconfig b/toolchain/llvm/clang-llvm.kconfig new file mode 100644 index 0000000..1e29995 --- /dev/null +++ b/toolchain/llvm/clang-llvm.kconfig @@ -0,0 +1,49 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012-2013 Abdoulaye Walsimou GAYE . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################ +# +# \file clang-llvm.kconfig +# \brief clang-llvm.kconfig of Embtoolkit +# \author Abdoulaye Walsimou GAYE +# \date December 2012 +################################################################################ + +# +# clang/llvm version +# +choice + prompt "Version of llvm you wish" + help + Version of llvm you wish + + config EMBTK_CLANG_LLVM_VERSION_3_3 + bool "clang/llvm-3.3" + select EMBTK_LLVM_VERSION_3_3 + select EMBTK_CLANG_VERSION_3_3 + config EMBTK_CLANG_LLVM_VERSION_3_2 + bool "clang/llvm-3.2" + select EMBTK_LLVM_VERSION_3_2 + select EMBTK_CLANG_VERSION_3_2 + config EMBTK_CLANG_LLVM_VERSION_GIT + bool "Use clang/llvm git repository" + select EMBTK_LLVM_VERSION_GIT + select EMBTK_CLANG_VERSION_GIT + help + Answer Y here if you want to build your toolchain based on + clang/llvm sources from its GIT repository. +endchoice diff --git a/toolchain/llvm/clang/clang.kconfig b/toolchain/llvm/clang/clang.kconfig new file mode 100644 index 0000000..701fcfa --- /dev/null +++ b/toolchain/llvm/clang/clang.kconfig @@ -0,0 +1,80 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012-2013 Abdoulaye Walsimou GAYE . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################ +# +# \file clang.kconfig +# \brief clang.kconfig of Embtoolkit +# \author Abdoulaye Walsimou GAYE +# \date October 2012 +################################################################################ + +config EMBTK_HAVE_CLANG + bool + default y + +# +# clang version +# +config EMBTK_CLANG_VERSION_3_3 + bool + select EMBTK_CLANG_NEED_PATCH +config EMBTK_CLANG_VERSION_3_2 + bool + select EMBTK_CLANG_NEED_PATCH + +config EMBTK_CLANG_VERSION_GIT + bool + help + Answer Y here if you want to build your toolchain based on + clang sources from its GIT repository. + +# +# GIT repository options +# +config EMBTK_CLANG_GIT_BRANCH + string "clang branch to use" + default "master" + depends on EMBTK_CLANG_VERSION_GIT + help + The branch of the git repository to use, the default is master. + +config EMBTK_CLANG_GIT_REVISION + string "Clang specific revision to use instead of the latest" + depends on EMBTK_CLANG_VERSION_GIT + help + Chechout a specific revision instead of the latest. + +config EMBTK_CLANG_REFSPEC + string + default "toolchain" + +# +# Versions strings for tarball packages. +# +config EMBTK_CLANG_VERSION_STRING + string + default "3.3" if EMBTK_CLANG_VERSION_3_3 + default "3.2" if EMBTK_CLANG_VERSION_3_2 + default "git" if EMBTK_CLANG_VERSION_GIT + + +config EMBTK_CLANG_NEED_PATCH + bool +config EMBTK_CLANG_NEED_AUTORECONF + bool + diff --git a/toolchain/llvm/clang/clang.mk b/toolchain/llvm/clang/clang.mk new file mode 100644 index 0000000..0a5484b --- /dev/null +++ b/toolchain/llvm/clang/clang.mk @@ -0,0 +1,39 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012 Abdoulaye Walsimou GAYE . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################ +# +# \file clang.mk +# \brief clang.mk of Embtoolkit +# \author Abdoulaye Walsimou GAYE +# \date October 2012 +################################################################################ + +CLANG_NAME := clang +CLANG_VERSION := $(call embtk_get_pkgversion,clang) +CLANG_SITE := http://llvm.org/releases/$(CLANG_VERSION) +#CLANG_GIT_SITE := http://llvm.org/git/clang.git +CLANG_GIT_SITE := git://www.embtoolkit.org/clang.git +CLANG_PACKAGE := clang-$(CLANG_VERSION).src.tar.gz +CLANG_SRC_DIR := $(embtk_toolsb)/clang-$(CLANG_VERSION).src +CLANG_BUILD_DIR := $(embtk_toolsb)/clang-build + +define embtk_install_clang + $(call embtk_pinfo,"Compile/Install of clang will be done within llvm...") + $(call embtk_download_pkg,clang) + $(call embtk_decompress_pkg,clang) +endef diff --git a/toolchain/llvm/compiler-rt/Makefile b/toolchain/llvm/compiler-rt/Makefile new file mode 100644 index 0000000..e4a18ba --- /dev/null +++ b/toolchain/llvm/compiler-rt/Makefile @@ -0,0 +1,134 @@ +################################################################################ +# Copyright 2013 Abdoulaye Walsimou GAYE . All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +################################################################################ + +rootsrc/ ?= +LIBDIR ?= lib + +# +# Sanitizer common part +# +SANCOMMON := sanitizer_common +SANCOMMON_CXXSRCS := $(wildcard $(rootsrc/)lib/sanitizer_common/*.cc) +SANCOMMON_CXXSRCS += $(wildcard $(rootsrc/)lib/interception/*.cc) +SANCOMMON_CSRCS := $(wildcard $(rootsrc/)lib/sanitizer_common/*.c) +SANCOMMON_CSRCS += $(wildcard $(rootsrc/)lib/interception/*.c) + +SANCOMMON_OBJS := $(patsubst %.cc,%.o,$(SANCOMMON_CXXSRCS)) +SANCOMMON_OBJS += $(patsubst %.c,%.o,$(SANCOMMON_CSRCS)) + +SANCOMMON_EXTRA_CFLAGS := -fno-rtti + +# +# Address sanitizer part +# +ASAN := asan +ASAN_CXXSRCS := $(wildcard $(rootsrc/)lib/asan/*.cc) +ASAN_CSRCS := $(wildcard $(rootsrc/)lib/asan/*.c) + +ASAN_OBJS := $(patsubst %.cc,%.o,$(ASAN_CXXSRCS)) +ASAN_OBJS += $(patsubst %.c,%.o,$(ASAN_CSRCS)) + +ASAN_EXTRA_CFLAGS := -fno-rtti + +# +# Thread sanitizer part +# +TSAN := tsan +TSAN_CXXSRCS := $(wildcard $(rootsrc/)lib/tsan/rtl/*.cc) +TSAN_CSRCS := $(wildcard $(rootsrc/)lib/tsan/rtl/*.c) +TSAN_OBJS := $(patsubst %.cc,%.o,$(TSAN_CXXSRCS)) +TSAN_OBJS += $(patsubst %.c,%.o,$(TSAN_CSRCS)) + +# +# Undefined behavior sanitizer part +# +UBSAN := ubsan +UBSAN_CXXSRCS := $(wildcard $(rootsrc/)lib/ubsan/*.cc) +UBSAN_CSRCS := $(wildcard $(rootsrc/)lib/ubsan/*.c) + +UBSAN_OBJS := $(patsubst %.cc,%.o,$(UBSAN_CXXSRCS)) +UBSAN_OBJS += $(patsubst %.c,%.o,$(UBSAN_CSRCS)) + +# +# Common part +# +CC ?= gcc +CXX ?= g++ + +SANCOMMON_CFLAGS := -W -Wall -fPIC -fno-builtin -fno-exceptions +SANCOMMON_CFLAGS += -fomit-frame-pointer -funwind-tables +SANCOMMON_CFLAGS += -fno-stack-protector -fvisibility=hidden -g +# +# FIXME: remove this avec full merge of compiler-rt/llvm/clang-3.3. +# The copy of compiler-rt shipped with EmbToolkit was in the middle of +# compiler-rt-3.3 development. +# +SANCOMMON_CFLAGS += -DASAN_ALLOCATOR_VERSION=1 + +ARFLAGS := rvs + +override CFLAGS := $(CFLAGS) $(SANCOMMON_CFLAGS) +override CPPFLAGS := $(CPPFLAGS) -I$(rootsrc/)include -I$(rootsrc/)lib +override CXXFLAGS := $(CXXFLAGS) $(CFLAGS) + +define __lib_install + $(if $(SYSROOT), + mkdir -p $(SYSROOT)/usr + mkdir -p $(SYSROOT)/usr/$(LIBDIR) + cp lib$(SANCOMMON).a $(SYSROOT)/usr/$(LIBDIR) + cp lib$(ASAN).a $(SYSROOT)/usr/$(LIBDIR) + cp lib$(UBSAN).a $(SYSROOT)/usr/$(LIBDIR)) +endef + +all: lib$(SANCOMMON).a lib$(ASAN).a lib$(UBSAN).a + $(Q)true + +install: all + $(Q)$(__lib_install) + +lib$(SANCOMMON).a: EXTRA_CFLAGS = $(SANCOMMON_EXTRA_CFLAGS) +lib$(SANCOMMON).a: $(SANCOMMON_OBJS) + $(Q)$(AR) $(ARFLAGS) $@ $(SANCOMMON_OBJS) + +lib$(ASAN).a: EXTRA_CFLAGS = $(ASAN_EXTRA_CFLAGS) +lib$(ASAN).a: $(ASAN_OBJS) + $(Q)$(AR) $(ARFLAGS) $@ $(ASAN_OBJS) + +lib$(TSAN).a: $(TSAN_OBJS) + $(Q)$(AR) $(ARFLAGS) $@ $(TSAN_OBJS) + +lib$(UBSAN).a: $(UBSAN_OBJS) + $(Q)$(AR) $(ARFLAGS) $@ $(UBSAN_OBJS) + +%.o: %.c + $(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) -c $< -o $@ + +%.o: %.cc + $(Q)$(CXX) $(CXXFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) -c $< -o $@ + +clean: + $(Q)rm -rf $(SANCOMMON_OBJS) $(ASAN_OBJS) $(TSAN_OBJS) $(UBSAN_OBJS) + $(Q)rm -rf lib$(SANCOMMON).a lib$(ASAN).a lib$(TSAN).a lib$(UBSAN).a diff --git a/toolchain/llvm/compiler-rt/compiler-rt.kconfig b/toolchain/llvm/compiler-rt/compiler-rt.kconfig new file mode 100644 index 0000000..cc9cab3 --- /dev/null +++ b/toolchain/llvm/compiler-rt/compiler-rt.kconfig @@ -0,0 +1,77 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012-2013 Abdoulaye Walsimou GAYE . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################ +# +# \file compiler-rt.kconfig +# \brief compiler-rt.kconfig of Embtoolkit +# \author Abdoulaye Walsimou GAYE +# \date October 2012 +################################################################################ + +config EMBTK_HAVE_COMPILER-RT + bool + default y + select EMBTK_COMPILER-RT_VERSION_3_3 + +# +# compiler-rt versions +# +config EMBTK_COMPILER-RT_VERSION_3_3 + bool + select EMBTK_COMPILER-RT_NEED_PATCH + +config EMBTK_COMPILER-RT_VERSION_GIT + bool + help + Answer Y here if you want to build your toolchain based on + compiler-rt sources from its GIT repository. + +# +# GIT repository options +# +config EMBTK_COMPILER-RT_GIT_BRANCH + string "compiler-rt Branch to use" + default "master" + depends on EMBTK_COMPILER-RT_VERSION_GIT + help + The branch of the git repository to use, the default is master. + +config EMBTK_COMPILER-RT_GIT_REVISION + string "compiler-rt revision to Checkout instead of the latest" + depends on EMBTK_COMPILER-RT_VERSION_GIT + help + Chechout a specific revision instead of the latest. + +config EMBTK_COMPILER-RT_REFSPEC + string + default "toolchain" + +# +# Versions strings for tarball packages. +# +config EMBTK_COMPILER-RT_VERSION_STRING + string + default "embtk-3.3" if EMBTK_COMPILER-RT_VERSION_3_3 + default "git" if EMBTK_COMPILER-RT_VERSION_GIT + + +config EMBTK_COMPILER-RT_NEED_PATCH + bool +config EMBTK_COMPILER-RT_NEED_AUTORECONF + bool + diff --git a/toolchain/llvm/compiler-rt/compiler-rt.mk b/toolchain/llvm/compiler-rt/compiler-rt.mk new file mode 100644 index 0000000..1e8ed7c --- /dev/null +++ b/toolchain/llvm/compiler-rt/compiler-rt.mk @@ -0,0 +1,81 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012-2013 Abdoulaye Walsimou GAYE . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################ +# +# \file compiler-rt.mk +# \brief compiler-rt.mk of Embtoolkit +# \author Abdoulaye Walsimou GAYE +# \date October 2012 +################################################################################ + +COMPILER-RT_NAME := compiler-rt +COMPILER-RT_VERSION := $(call embtk_get_pkgversion,compiler-rt) +COMPILER-RT_SITE := ftp://ftp.embtoolkit.org/embtoolkit.org/packages-mirror +#COMPILER-RT_GIT_SITE := http://llvm.org/git/compiler-rt.git +COMPILER-RT_GIT_SITE := git://www.embtoolkit.org/compiler-rt.git +COMPILER-RT_PACKAGE := compiler-rt-$(COMPILER-RT_VERSION).tar.bz2 +COMPILER-RT_SRC_DIR := $(embtk_toolsb)/compiler-rt-$(COMPILER-RT_VERSION) +COMPILER-RT_BUILD_DIR := $(call __embtk_pkg_srcdir,compiler-rt) + +__embtk_compiler-rt_cflags := $(TARGET_CFLAGS) +# +# FIXME: remove this when c++ exceptions handling fully supported in ARM +# +ifeq ($(TARGETCXX),$(TARGETGCXX)) +__embtk_compiler-rt_cflags := $(filter-out $(__clang_cflags),$(__embtk_compiler-rt_cflags)) +endif + +ifeq ($(CONFIG_EMBTK_CLANG_VERSION_3_3),y) +__embtk_compiler-rt_cflags += -DASAN_INTERFACE_VERSION=3 +endif + +ifeq ($(CONFIG_EMBTK_CLIB_MUSL),y) +__embtk_compiler-rt_cflags += -D_FILE_OFFSET_BITS=64 -D__MUSL__ +endif + +COMPILER-RT_MAKE_OPTS := CC="$(TARGETCC)" CFLAGS="$(__embtk_compiler-rt_cflags)" +COMPILER-RT_MAKE_OPTS += CXX="$(TARGETCXX)" LIBDIR="$(LIBDIR)" +COMPILER-RT_MAKE_OPTS += AR=$(TARGETAR) RANLIB=$(TARGETRANLIB) +COMPILER-RT_MAKE_OPTS += SYSROOT="$(embtk_sysroot)" + +define embtk_install_compiler-rt + $(call embtk_makeinstall_pkg,compiler-rt) +endef + +define embtk_beforeinstall_compiler-rt + ln -sf $(EMBTK_ROOT)/mk/llvm/compiler-rt/Makefile \ + $(COMPILER-RT_BUILD_DIR)/Makefile +endef + +__embtk_libasan := libclang_rt.asan-$(__embtk_clang_arch).a +__embtk_libubsan := libclang_rt.ubsan-$(__embtk_clang_arch).a +define embtk_postinstallonce_compiler-rt + echo "GROUP(libasan.a libsanitizer_common.a)" \ + > $(__embtk_clang_libdir)/$(__embtk_libasan) + echo "GROUP(libubsan.a libsanitizer_common.a)" \ + > $(__embtk_clang_libdir)/$(__embtk_libubsan) + cp -R $(call __embtk_pkg_srcdir,compiler-rt)/include/* \ + $(__embtk_clang_incdir)/ +endef + +define embtk_cleanup_compiler-rt + if [ -e $(COMPILER-RT_BUILD_DIR)/Makefile ]; then \ + $(MAKE) -C $(COMPILER-RT_BUILD_DIR) clean; \ + fi + rm -rf $(COMPILER-RT_BUILD_DIR)/Makefile +endef diff --git a/toolchain/llvm/libc++/Makefile b/toolchain/llvm/libc++/Makefile new file mode 100644 index 0000000..da95cab --- /dev/null +++ b/toolchain/llvm/libc++/Makefile @@ -0,0 +1,98 @@ +################################################################################ +# Copyright 2012 Abdoulaye Walsimou GAYE . All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +################################################################################ + +rootsrc ?= $(shell pwd) +LIBDIR ?= lib + +CXX_SRCS := $(wildcard $(rootsrc)/src/*.cpp) + +OBJS := $(patsubst %.cpp,%.o,$(CXX_SRCS)) +SOBJS := $(patsubst %.o,%.So,$(OBJS)) + +__HEADERS := $(wildcard $(rootsrc)/include/*) +HEADERS := $(filter-out $(rootsrc)/include/support,$(__HEADERS)) + +CC ?= gcc +CXX ?= g++ + +LIB := c++ +SHAREDLIB := $(LIB) +SHAREDLIB_NAME := lib$(SHAREDLIB).so.1 +SHAREDLIB_LINK := lib$(SHAREDLIB).so +SHAREDLIB_SONAME := $(SHAREDLIB_NAME) + +override LDFLAGS := $(LDFLAGS) -shared -Wl,--warn-shared-textrel -Wl,-x + +override CXXFLAGS := $(CXXFLAGS) $(CFLAGS) -nostdinc++ -std=c++11 +override CPPFLAGS := $(CPPFLAGS) -I$(rootsrc)/include +override CPPFLAGS += -DLIBCXXRT -DNO_CATGETS_SUPPORT + +LDADD := $(shell $(CC) --print-file-name=libcxxrt_pic.a) +LDADD += -lpthread -lrt -ldl -lc + +ARFLAGS := rvs + +define __lib_install + $(if $(SYSROOT), + mkdir -p $(SYSROOT)/usr + mkdir -p $(SYSROOT)/usr/include + mkdir -p $(SYSROOT)/usr/include/c++ + mkdir -p $(SYSROOT)/usr/include/c++/v1 + cp -R $(HEADERS) $(SYSROOT)/usr/include/c++/v1 + chmod 755 $(SYSROOT)/usr/include/c++/v1 + chmod 644 $(SYSROOT)/usr/include/c++/v1/* + chmod 755 $(SYSROOT)/usr/include/c++/v1/ext + chmod 644 $(SYSROOT)/usr/include/c++/v1/ext/* + mkdir -p $(SYSROOT)/$(LIBDIR) + tar -cf - *.so* | tar -xf - -C $(SYSROOT)/$(LIBDIR)/ + cp lib$(LIB)_nonshared.a $(SYSROOT)/usr/$(LIBDIR)/) +endef + +all: lib$(LIB)_nonshared.a $(SHAREDLIB_NAME) + $(Q)true + +install: all + $(Q)$(__lib_install) + $(Q)true + +$(SHAREDLIB_NAME): $(SOBJS) + $(Q)$(CC) $(LDFLAGS) -o $@ \ + -Wl,-soname,$(SHAREDLIB_SONAME) $(SOBJS) $(LDADD) + $(Q)ln -fs $(SHAREDLIB_NAME) $(SHAREDLIB_LINK) + +lib$(LIB)_nonshared.a: $(OBJS) + $(Q)$(AR) $(ARFLAGS) $@ $(OBJS) + +%.o: %.cpp + $(Q)$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ + +%.So: %.cpp + $(Q)$(CXX) -fPIC $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ + +clean: + $(Q)rm -rf $(OBJS) $(SOBJS) lib$(LIB).a + $(Q)rm -rf $(SHAREDLIB_NAME) $(SHAREDLIB_LINK) + diff --git a/toolchain/llvm/libc++/libcxx.kconfig b/toolchain/llvm/libc++/libcxx.kconfig new file mode 100644 index 0000000..6264a1f --- /dev/null +++ b/toolchain/llvm/libc++/libcxx.kconfig @@ -0,0 +1,80 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012 Abdoulaye Walsimou GAYE . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################ +# +# \file libcxx.kconfig +# \brief libcxx.kconfig of Embtoolkit +# \author Abdoulaye Walsimou GAYE +# \date December 2012 +################################################################################ + +config EMBTK_HAVE_LIBCXX + bool + default y + depends on EMBTK_CXXLIB_LLVM_LIBCXX + select KEMBTK_UCLIBC_UCLIBC_HAS_LOCALE if EMBTK_CLIB_UCLIBC + select KEMBTK_UCLIBC_UCLIBC_HAS_XLOCALE if EMBTK_CLIB_UCLIBC + +# +# libcxx version +# +choice + prompt "Version of libcxx you wish" + depends on EMBTK_HAVE_LIBCXX + help + Version of libcxx you wish + + config EMBTK_LIBCXX_VERSION_GIT + bool "Use libcxx git repository" + help + Answer Y here if you want to build your toolchain based on + libcxx sources from its GIT repository. +endchoice + +# +# GIT repository options +# +config EMBTK_LIBCXX_GIT_BRANCH + string "Branch to use" + default "master" + depends on EMBTK_LIBCXX_VERSION_GIT + help + The branch of the git repository to use, the default is master. + +config EMBTK_LIBCXX_GIT_REVISION + string "Checkout a specific revision instead of the latest" + depends on EMBTK_LIBCXX_VERSION_GIT + help + Chechout a specific revision instead of the latest. + +config EMBTK_LIBCXX_REFSPEC + string + default "toolchain" + +# +# Versions strings for tarball packages. +# +config EMBTK_LIBCXX_VERSION_STRING + string + default "git" if EMBTK_LIBCXX_VERSION_GIT + + +config EMBTK_LIBCXX_NEED_PATCH + bool +config EMBTK_LIBCXX_NEED_AUTORECONF + bool diff --git a/toolchain/llvm/libc++/libcxx.mk b/toolchain/llvm/libc++/libcxx.mk new file mode 100644 index 0000000..c3e14af --- /dev/null +++ b/toolchain/llvm/libc++/libcxx.mk @@ -0,0 +1,71 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012-2014 Abdoulaye Walsimou GAYE . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################ +# +# \file libcxx.mk +# \brief libcxx.mk of Embtoolkit +# \author Abdoulaye Walsimou GAYE +# \date December 2012 +################################################################################ + +LIBCXX_NAME := libcxx +LIBCXX_VERSION := $(call embtk_get_pkgversion,libcxx) +LIBCXX_SITE := ftp://ftp.embtoolkit.org/embtoolkit.org/packages-mirror/$(LIBCXX_VERSION) +#LIBCXX_GIT_SITE := http://llvm.org/git/libcxx.git +LIBCXX_GIT_SITE := git://www.embtoolkit.org/libcxx.git +LIBCXX_PACKAGE := libcxx-$(LIBCXX_VERSION).tar.bz2 +LIBCXX_SRC_DIR := $(embtk_toolsb)/libcxx-$(LIBCXX_VERSION) +LIBCXX_BUILD_DIR := $(call __embtk_pkg_srcdir,libcxx) + +LIBCXX_KEEP_SRC_DIR := y + +LIBCXX_DEPS := libcxxrt_install + +__embtk_libcxx_cflags := $(TARGET_CFLAGS) +__embtk_libcxx_cflags += -I$(embtk_sysroot)/usr/include/c++/v1 + +LIBCXX_MAKE_OPTS := CC="$(TARGETCC)" CFLAGS="$(__embtk_libcxx_cflags)" +LIBCXX_MAKE_OPTS += CXX="$(TARGETCXX)" LIBDIR=$(LIBDIR) +LIBCXX_MAKE_OPTS += AR=$(TARGETAR) RANLIB=$(TARGETRANLIB) +LIBCXX_MAKE_OPTS += SYSROOT="$(embtk_sysroot)" + +define embtk_install_libcxx + $(call embtk_makeinstall_pkg,libcxx) +endef + +define embtk_beforeinstall_libcxx + ln -sf $(EMBTK_ROOT)/mk/libc++/libc++/Makefile \ + $(LIBCXX_BUILD_DIR)/Makefile +endef + +__embtk_staticlibcxx := $(embtk_sysroot)/usr/$(LIBDIR)/libc++.a +define __embtk_postinstall_staticlibcxx + (echo "GROUP(libc++_nonshared.a libcxxrt.a libpthread.a librt.a libdl.a)" \ + > $(__embtk_staticlibcxx)) +endef + +define embtk_postinstallonce_libcxx + $(__embtk_postinstall_staticlibcxx) +endef + +define embtk_cleanup_libcxx + if [ -e $(LIBCXXRT_BUILD_DIR)/Makefile ]; then \ + $(MAKE) -C $(LIBCXXRT_BUILD_DIR) clean; \ + fi + rm -rf $(LIBCXXRT_BUILD_DIR)/Makefile +endef diff --git a/toolchain/llvm/llvm/llvm.kconfig b/toolchain/llvm/llvm/llvm.kconfig new file mode 100644 index 0000000..b443a32 --- /dev/null +++ b/toolchain/llvm/llvm/llvm.kconfig @@ -0,0 +1,79 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012-2013 Abdoulaye Walsimou GAYE . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################ +# +# \file llvm.kconfig +# \brief llvm.kconfig of Embtoolkit +# \author Abdoulaye Walsimou GAYE +# \date October 2012 +################################################################################ + +config EMBTK_HAVE_LLVM + bool + default y + +# +# llvm version +# +config EMBTK_LLVM_VERSION_3_3 + bool + select EMBTK_LLVM_NEED_PATCH +config EMBTK_LLVM_VERSION_3_2 + bool + select EMBTK_LLVM_NEED_PATCH + +config EMBTK_LLVM_VERSION_GIT + bool + help + Answer Y here if you want to build your toolchain based on + llvm sources from its GIT repository. + +# +# GIT repository options +# +config EMBTK_LLVM_GIT_BRANCH + string "llvm branch to use" + default "master" + depends on EMBTK_LLVM_VERSION_GIT + help + The branch of the git repository to use, the default is master. + +config EMBTK_LLVM_GIT_REVISION + string "llvm specific revision to use instead of the latest" + depends on EMBTK_LLVM_VERSION_GIT + help + Chechout a specific revision instead of the latest. + +config EMBTK_LLVM_REFSPEC + string + default "toolchain" + +# +# Versions strings for tarball packages. +# +config EMBTK_LLVM_VERSION_STRING + string + default "3.3" if EMBTK_LLVM_VERSION_3_3 + default "3.2" if EMBTK_LLVM_VERSION_3_2 + default "git" if EMBTK_LLVM_VERSION_GIT + + +config EMBTK_LLVM_NEED_PATCH + bool +config EMBTK_LLVM_NEED_AUTORECONF + bool diff --git a/toolchain/llvm/llvm/llvm.mk b/toolchain/llvm/llvm/llvm.mk new file mode 100644 index 0000000..12f0fbc --- /dev/null +++ b/toolchain/llvm/llvm/llvm.mk @@ -0,0 +1,88 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012 Abdoulaye Walsimou GAYE . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################ +# +# \file llvm.mk +# \brief llvm.mk of Embtoolkit +# \author Abdoulaye Walsimou GAYE +# \date October 2012 +################################################################################ + +LLVM_NAME := llvm +LLVM_VERSION := $(call embtk_get_pkgversion,llvm) +LLVM_SITE := http://llvm.org/releases/$(LLVM_VERSION) +#LLVM_GIT_SITE := http://llvm.org/git/llvm.git +LLVM_GIT_SITE := git://www.embtoolkit.org/llvm.git +LLVM_PACKAGE := llvm-$(LLVM_VERSION).src.tar.gz +LLVM_SRC_DIR := $(embtk_toolsb)/llvm-$(LLVM_VERSION).src +LLVM_BUILD_DIR := $(embtk_toolsb)/llvm-build + +LLVM_DEPS := binutils_install clang_install + +LLVM_WITH_HASHSTYLE := $(if $(CONFIG_EMBTK_CLIB_UCLIBC),--with-default-hash-style=sysv) + +__embtk_binutils_inc := $(call __embtk_pkg_srcdir,binutils)/include + +LLVM_CONFIGURE_OPTS := --target=$(STRICT_GNU_TARGET) +LLVM_CONFIGURE_OPTS += --enable-targets=$(LINUX_ARCH),x86 +LLVM_CONFIGURE_OPTS += $(LLVM_WITH_CPU) $(LLVM_WITH_ABI) +LLVM_CONFIGURE_OPTS += $(LLVM_WITH_FLOAT) $(LLVM_WITH_FPU) +LLVM_CONFIGURE_OPTS += $(LLVM_WITH_HASHSTYLE) +LLVM_CONFIGURE_OPTS += --with-default-sysroot=$(embtk_sysroot) +LLVM_CONFIGURE_OPTS += --enable-optimized --disable-jit --disable-zlib +LLVM_CONFIGURE_OPTS += --with-bug-report-url=$(EMBTK_BUGURL) +LLVM_CONFIGURE_OPTS += --with-binutils-include=$(__embtk_binutils_inc) + +LLVM_MAKE_OPTS := NO_UNITTESTS=1 +LLVM_MAKE_OPTS += CLANG_VENDOR="EmbToolkit(v$(EMBTK_VERSION))" + +LLVM_PREFIX := $(embtk_tools) + +__embtk_clang_arch := $(firstword $(subst -, ,$(STRICT_GNU_TARGET))) +__embtk_clang_rversion = `ls $(embtk_tools)/lib/clang/` +__embtk_clang_libdir = $(embtk_tools)/lib/clang/$(__embtk_clang_rversion)/lib/linux +__embtk_clang_incdir = $(embtk_tools)/lib/clang/$(__embtk_clang_rversion)/include + +define embtk_install_llvm + $(call __embtk_install_hostpkg,llvm) +endef + +define embtk_beforeinstall_llvm + [ -e $(call __embtk_pkg_srcdir,llvm)/tools/clang ] || \ + ln -sf $(call __embtk_pkg_srcdir,clang) \ + $(call __embtk_pkg_srcdir,llvm)/tools/clang + mkdir -p $(embtk_tools)/bin/clang-scan-build + cp -R $(call __embtk_pkg_srcdir,llvm)/tools/clang/tools/scan-build/* \ + $(embtk_tools)/bin/clang-scan-build + mkdir -p $(embtk_tools)/bin/clang-scan-view + cp -R $(call __embtk_pkg_srcdir,llvm)/tools/clang/tools/scan-view/* \ + $(embtk_tools)/bin/clang-scan-view +endef + +define embtk_postinstallonce_llvm + mkdir -p $(embtk_tools)/lib/bfd-plugins + cd $(embtk_tools)/lib/bfd-plugins; \ + ln -sf ../libLTO.so libLTO.so; \ + ln -sf ../LLVMgold.so LLVMgold.so + mkdir -p $(embtk_tools)/lib/clang/$(__embtk_clang_rversion)/lib + mkdir -p $(embtk_tools)/lib/clang/$(__embtk_clang_rversion)/lib/linux +endef + +define embtk_cleanup_llvm + $(Q)rm -rf $(LLVM_BUILD_DIR) +endef diff --git a/toolchain/toolchain.kconfig b/toolchain/toolchain.kconfig index 72adf3a..d5a58f0 100644 --- a/toolchain/toolchain.kconfig +++ b/toolchain/toolchain.kconfig @@ -84,16 +84,16 @@ if EMBTK_LLVM_ONLY_TOOLCHAIN || EMBTK_GCC_AND_LLVM_TOOLCHAIN comment "------------------------------------------" comment "--- clang/llvm versions" comment "------------------------------------------" -source kconfig/llvm/clang-llvm.kconfig -source kconfig/llvm/llvm.kconfig -source kconfig/llvm/clang.kconfig -source kconfig/llvm/compiler-rt.kconfig +source toolchain/llvm/clang-llvm.kconfig +source toolchain/llvm/llvm/llvm.kconfig +source toolchain/llvm/clang/clang.kconfig +source toolchain/llvm/compiler-rt/compiler-rt.kconfig endif comment "------------------------------------------" comment "--- Additional programming languages" comment "------------------------------------------" -source kconfig/compiler-options.kconfig +source toolchain/compiler-options.kconfig endmenu diff --git a/toolchain/toolchain.mk b/toolchain/toolchain.mk index ad85809..eb52bda 100644 --- a/toolchain/toolchain.mk +++ b/toolchain/toolchain.mk @@ -52,11 +52,11 @@ include toolchain/binutils/binutils.mk include toolchain/gcc/gcc.mk # llvm/clang compiler infrastructure -include mk/llvm/clang.mk -include mk/llvm/llvm.mk -include mk/llvm/compiler-rt/compiler-rt.mk -include mk/libc++/libcxxrt/libcxxrt.mk -include mk/libc++/libc++/libcxx.mk +include toolchain/llvm/clang/clang.mk +include toolchain/llvm/llvm/llvm.mk +include toolchain/llvm/compiler-rt/compiler-rt.mk +include toolchain/libcxxrt/libcxxrt.mk +include toolchain/llvm/libc++/libcxx.mk # linux kernel headers include mk/linux.mk -- cgit v1.2.3