From patchwork Wed May 1 19:40:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 1093808 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rockwellcollins.com Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44vTK42nTZz9sB8 for ; Thu, 2 May 2019 05:40:56 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 902D43019D; Wed, 1 May 2019 19:40:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PeZVt6TDd9e2; Wed, 1 May 2019 19:40:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 5D68F22797; Wed, 1 May 2019 19:40:41 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 20A3F1BF2EA for ; Wed, 1 May 2019 19:40:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 1E01287EB2 for ; Wed, 1 May 2019 19:40:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VcxaRV9LxeR3 for ; Wed, 1 May 2019 19:40:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from secvs01.rockwellcollins.com (secvs01.rockwellcollins.com [205.175.225.240]) by hemlock.osuosl.org (Postfix) with ESMTPS id 20EF287EBB for ; Wed, 1 May 2019 19:40:35 +0000 (UTC) Received: from ofwgwc03.rockwellcollins.com (HELO ciulimr01.rockwellcollins.com) ([205.175.225.12]) by secvs01.rockwellcollins.com with ESMTP; 01 May 2019 14:40:33 -0500 X-Received: from biscuits.rockwellcollins.lab (biscuits.rockwellcollins.lab [10.36.117.10]) by ciulimr01.rockwellcollins.com (Postfix) with ESMTP id 645E6600D5; Wed, 1 May 2019 14:40:33 -0500 (CDT) From: Matt Weber To: buildroot@buildroot.org Date: Wed, 1 May 2019 14:40:31 -0500 Message-Id: <20190501194032.765-5-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190501194032.765-1-matthew.weber@rockwellcollins.com> References: <20190501194032.765-1-matthew.weber@rockwellcollins.com> Subject: [Buildroot] [PATCH v7 4/5] package/compiler-rt: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Romain Naour , Ricardo Martincoski , Valentin Korenblit MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch adds support for the compiler-rt (CLANG runtime) library. It builds a set of static libraries and installs them into the CLANG/LLVM toolchain resource folder. Signed-off-by: Matthew Weber Cc: Romain Naour Cc: Ricardo Martincoski Cc: Valentin Korenblit --- Changes v1 -> v2 [Romain - Removed unnecessary host-cmake dependency v2 -> v3 [Romain - Update to use COMPILER_RT_INSTALL_PATH for library install [Ricardo - Fixed check-package extra line - Spelling in commit message v3 -> v4 [Valentin - Pointed out that non-glibc libraries won't build. Further investigation shows that the lib asan support in compiler-rt doesn't have the libc checks yet to support multiple libraries. (https://patchwork.ozlabs.org/patch/339938/ was the best example I could find and it doesn't look like anything has changed in the recent codebase) v4 -> v5 [Thomas P - Revisited staging install step and found a cleaner way to use the default and then a hook to setup the runtime library path v6 - Bumped to 7.0.1 to match current LLVM/Clang version v7 - Rebased on master for 8.0 LLVM/Clang version - Added comment about bumping verions of LLVM/Clang and Compiler-rt together [Romain - Disabled test cases (-DCOMPILER_RT_INCLUDE_TESTS=OFF) --- DEVELOPERS | 1 + package/Config.in | 1 + package/clang/clang.mk | 2 +- package/compiler-rt/Config.in | 14 +++++++++++ package/compiler-rt/compiler-rt.hash | 3 +++ package/compiler-rt/compiler-rt.mk | 36 ++++++++++++++++++++++++++++ package/llvm/llvm.mk | 2 +- 7 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 package/compiler-rt/Config.in create mode 100644 package/compiler-rt/compiler-rt.hash create mode 100644 package/compiler-rt/compiler-rt.mk diff --git a/DEVELOPERS b/DEVELOPERS index 6ccb0afaf6..72a635a81a 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1467,6 +1467,7 @@ F: package/bridge-utils/ F: package/checkpolicy/ F: package/checksec/ F: package/cgroupfs-mount/ +F: package/compiler-rt/ F: package/crda/ F: package/cunit/ F: package/dacapo/ diff --git a/package/Config.in b/package/Config.in index f592e74a99..99fcf49a63 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1652,6 +1652,7 @@ menu "Other" source "package/clapack/Config.in" source "package/classpath/Config.in" source "package/cmocka/Config.in" + source "package/compiler-rt/Config.in" source "package/cppcms/Config.in" source "package/cracklib/Config.in" source "package/dawgdic/Config.in" diff --git a/package/clang/clang.mk b/package/clang/clang.mk index 07e7fced2a..87a80ab258 100644 --- a/package/clang/clang.mk +++ b/package/clang/clang.mk @@ -4,7 +4,7 @@ # ################################################################################ -# LLVM and Clang should be version bumped together +# LLVM, Compiler-rt and Clang should be version bumped together CLANG_VERSION = 8.0.0 CLANG_SITE = http://llvm.org/releases/$(CLANG_VERSION) CLANG_SOURCE = cfe-$(CLANG_VERSION).src.tar.xz diff --git a/package/compiler-rt/Config.in b/package/compiler-rt/Config.in new file mode 100644 index 0000000000..9afc0d9d60 --- /dev/null +++ b/package/compiler-rt/Config.in @@ -0,0 +1,14 @@ +config BR2_PACKAGE_COMPILER_RT + bool "compiler-rt" + depends on BR2_PACKAGE_LLVM + depends on BR2_TOOLCHAIN_USES_GLIBC # asan lib requires + help + A collection of runtime libraries primarily used by clang and + llvm to provide builtins, sanitizer runtimes, and profiling + at runtime. + + https://compiler-rt.llvm.org/ + +comment "compiler-rt requires llvm to be enabled and a glibc toolchain" + depends on !BR2_PACKAGE_LLVM + depends on !BR2_TOOLCHAIN_USES_GLIBC diff --git a/package/compiler-rt/compiler-rt.hash b/package/compiler-rt/compiler-rt.hash new file mode 100644 index 0000000000..4b6bd1a75e --- /dev/null +++ b/package/compiler-rt/compiler-rt.hash @@ -0,0 +1,3 @@ +# Locally computed: +sha256 782edfc119ee172f169c91dd79f2c964fb6b248bd9b73523149030ed505bbe18 compiler-rt-7.0.1.src.tar.xz +sha256 417541d990edb3f96327ac03cb67e52eac80fc5c3e7afc69213cd04d7c3b9b27 LICENSE.TXT diff --git a/package/compiler-rt/compiler-rt.mk b/package/compiler-rt/compiler-rt.mk new file mode 100644 index 0000000000..7eda3bc4fe --- /dev/null +++ b/package/compiler-rt/compiler-rt.mk @@ -0,0 +1,36 @@ +################################################################################ +# +# compiler-rt +# +################################################################################ + +# Compiler-RT should be bumped together with LLVM and Clang as the run-time is +# tied to the version of those tools +COMPILER_RT_VERSION = 8.0.0 +COMPILER_RT_SOURCE = compiler-rt-$(COMPILER_RT_VERSION).src.tar.xz +COMPILER_RT_SITE = http://llvm.org/releases/$(COMPILER_RT_VERSION) +COMPILER_RT_LICENSE = NCSA MIT +COMPILER_RT_LICENSE_FILES = LICENSE.TXT +COMPILER_RT_DEPENDENCIES = host-clang llvm + +COMPILER_RT_INSTALL_STAGING = YES +COMPILER_RT_INSTALL_TARGET = NO + +COMPILER_RT_CONF_OPTS=-DCOMPILER_RT_STANDALONE_BUILD=OFF \ + -DCOMPILER_RT_STANDALONE_BUILD=ON \ + -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=$(GNU_TARGET_NAME) \ + -DLLVM_CONFIG_PATH=$(HOST_DIR)/usr/bin/llvm-config + +# The installation of the target runtime libraries defaults to DESTDIR, however +# host-clang resources directory needs a link so Clang can find the runtime +# libraries in the same location they would be if built as part of the Clang +# build. The "resources" directory is loosely documented and seems to be +# assumed, as compiler-rt is usually build at the same time as Clang and not +# standalone. +define COMPILER_RT_SETUP_RUNTIME_LIBS + mkdir -p $(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/lib + ln -sf ../../../../$(GNU_TARGET_NAME)/sysroot/usr/lib/linux $(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/lib/linux +endef +COMPILER_RT_POST_INSTALL_STAGING_HOOKS += COMPILER_RT_SETUP_RUNTIME_LIBS + +$(eval $(cmake-package)) diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk index 9d276c5190..cd07860068 100644 --- a/package/llvm/llvm.mk +++ b/package/llvm/llvm.mk @@ -4,7 +4,7 @@ # ################################################################################ -# LLVM and Clang should be version bumped together +# LLVM, Compiler-rt and Clang should be version bumped together LLVM_VERSION = 8.0.0 LLVM_SITE = http://llvm.org/releases/$(LLVM_VERSION) LLVM_SOURCE = llvm-$(LLVM_VERSION).src.tar.xz