From patchwork Tue Nov 13 23:02:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 997419 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.138; helo=whitealder.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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42vjnx61LLz9s9G for ; Wed, 14 Nov 2018 10:02:45 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id BBA34876F1; Tue, 13 Nov 2018 23:02:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FxNV0F5wSXqa; Tue, 13 Nov 2018 23:02:37 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id B79EB876FB; Tue, 13 Nov 2018 23:02:36 +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 0BE061BF2F7 for ; Tue, 13 Nov 2018 23:02:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 097BC88020 for ; Tue, 13 Nov 2018 23:02:32 +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 MOF5zTLrx0BD for ; Tue, 13 Nov 2018 23:02:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ch3vs04.rockwellcollins.com (ch3vs04.rockwellcollins.com [205.175.226.52]) by hemlock.osuosl.org (Postfix) with ESMTPS id 59EAF87AC6 for ; Tue, 13 Nov 2018 23:02:30 +0000 (UTC) Received: from ofwch3n02.rockwellcollins.com (HELO ciulimr02.rockwellcollins.com) ([205.175.226.14]) by ch3vs04.rockwellcollins.com with ESMTP; 13 Nov 2018 17:02:29 -0600 X-Received: from largo.rockwellcollins.com (unknown [192.168.140.76]) by ciulimr02.rockwellcollins.com (Postfix) with ESMTP id 8A4F620079; Tue, 13 Nov 2018 17:02:29 -0600 (CST) From: Matt Weber To: buildroot@buildroot.org Date: Tue, 13 Nov 2018 17:02:22 -0600 Message-Id: <1542150146-12188-1-git-send-email-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 1.9.1 Subject: [Buildroot] [PATCH 1/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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch adds support for the compiler-rt (CLANG runtime) libary. It builds a set of static libraries and installs them into the CLANG/LLVM toolchain resource folder. Signed-off-by: Matthew Weber --- DEVELOPERS | 1 + package/Config.in | 1 + package/compiler-rt/Config.in | 12 ++++++++++++ package/compiler-rt/compiler-rt.hash | 3 +++ package/compiler-rt/compiler-rt.mk | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 52 insertions(+) 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 53467da..e78d649 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1360,6 +1360,7 @@ F: package/bridge-utils/ F: package/checkpolicy/ F: package/checksec/ F: package/cgroupfs-mount/ +F: package/compiler-rt/ F: package/crda/ F: package/devmem2/ F: package/dnsmasq/ diff --git a/package/Config.in b/package/Config.in index b60e770..73ddc2d 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1602,6 +1602,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/compiler-rt/Config.in b/package/compiler-rt/Config.in new file mode 100644 index 0000000..e15d3aa --- /dev/null +++ b/package/compiler-rt/Config.in @@ -0,0 +1,12 @@ +config BR2_PACKAGE_COMPILER_RT + bool "compiler-rt" + depends on BR2_PACKAGE_LLVM + 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" + depends on !BR2_PACKAGE_LLVM diff --git a/package/compiler-rt/compiler-rt.hash b/package/compiler-rt/compiler-rt.hash new file mode 100644 index 0000000..df6ed19 --- /dev/null +++ b/package/compiler-rt/compiler-rt.hash @@ -0,0 +1,3 @@ +# Locally computed: +sha256 bdec7fe3cf2c85f55656c07dfb0bd93ae46f2b3dd8f33ff3ad6e7586f4c670d6 compiler-rt-7.0.0.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 0000000..3f44639 --- /dev/null +++ b/package/compiler-rt/compiler-rt.mk @@ -0,0 +1,35 @@ +################################################################################ +# +# 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 = 7.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-cmake host-clang llvm + +COMPILER_RT_INSTALL_STAGING = YES +COMPILER_RT_INSTALL_TARGET = NO + + +# -DCMAKE_INSTALL_PREFIX="" allows the COMPILER_RT_INSTALL_STAGING_CMDS to +# provide the complete path to compilier-rt for installation of the runtime +# libraries into the host-{clang,llvm} resources directory. The "resources" +# directory is loosely document at this point and will probably need revisited +# when making the llvm/clang tools SDK relocatable. +COMPILER_RT_CONF_OPTS=-DCOMPILER_RT_INCLUDE_TESTS=ON \ + -DCOMPILER_RT_STANDALONE_BUILD=ON \ + -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=$(GNU_TARGET_NAME) \ + -DLLVM_CONFIG_PATH=$(HOST_DIR)/usr/bin/llvm-config \ + -DCMAKE_INSTALL_PREFIX="" + +define COMPILER_RT_INSTALL_STAGING_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/ install/fast +endef + +$(eval $(cmake-package)) From patchwork Tue Nov 13 23:02:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 997416 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.138; helo=whitealder.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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42vjnm4jJhz9s9G for ; Wed, 14 Nov 2018 10:02:36 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2FE63876B3; Tue, 13 Nov 2018 23:02:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tPUZHdColiVi; Tue, 13 Nov 2018 23:02:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id B898987614; Tue, 13 Nov 2018 23:02:32 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 4D3F41BF2F7 for ; Tue, 13 Nov 2018 23:02:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4A4FE865E0 for ; Tue, 13 Nov 2018 23:02:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7T_ZXT8JBlPS for ; Tue, 13 Nov 2018 23:02:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from da1vs04.rockwellcollins.com (da1vs04.rockwellcollins.com [205.175.227.52]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 8806A865D4 for ; Tue, 13 Nov 2018 23:02:30 +0000 (UTC) Received: from ofwda1n02.rockwellcollins.com (HELO ciulimr02.rockwellcollins.com) ([205.175.227.14]) by da1vs04.rockwellcollins.com with ESMTP; 13 Nov 2018 17:02:30 -0600 X-Received: from largo.rockwellcollins.com (unknown [192.168.140.76]) by ciulimr02.rockwellcollins.com (Postfix) with ESMTP id 97E2D20082; Tue, 13 Nov 2018 17:02:29 -0600 (CST) From: Matt Weber To: buildroot@buildroot.org Date: Tue, 13 Nov 2018 17:02:23 -0600 Message-Id: <1542150146-12188-2-git-send-email-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1542150146-12188-1-git-send-email-matthew.weber@rockwellcollins.com> References: <1542150146-12188-1-git-send-email-matthew.weber@rockwellcollins.com> Subject: [Buildroot] [PATCH 2/5] package/llvm: install target binary/debug tools 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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The compiler-rt fuzzer and address sanitizer tools require additional LLVM binary tools installed to allow stack trace decoding actively during executable analysis. https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack Signed-off-by: Matthew Weber Reviewed-by: Romain Naour --- package/llvm/llvm.mk | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk index 1f9bd44..79477f0 100644 --- a/package/llvm/llvm.mk +++ b/package/llvm/llvm.mk @@ -197,8 +197,17 @@ HOST_LLVM_CONF_OPTS += \ # We need to activate LLVM_INCLUDE_TOOLS, otherwise it does not generate # libLLVM.so LLVM_CONF_OPTS += \ - -DLLVM_INCLUDE_TOOLS=ON \ + -DLLVM_INCLUDE_TOOLS=ON + +# The llvm-symbolizer binary is used by the Compiler-RT Fuzzer +# and AddressSanitizer tools for stack traces. +ifeq ($(BR2_PACKAGE_COMPILER_RT),y) +LLVM_CONF_OPTS += \ + -DLLVM_BUILD_TOOLS=ON +else +LLVM_CONF_OPTS += \ -DLLVM_BUILD_TOOLS=OFF +endif # Compiler-rt not in the source tree. # llvm runtime libraries are not in the source tree. From patchwork Tue Nov 13 23:02:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 997418 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 42vjnq5HT9z9rxp for ; Wed, 14 Nov 2018 10:02:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 3C8EF2ECE3; Tue, 13 Nov 2018 23:02:38 +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 DUC17QUkCVl5; Tue, 13 Nov 2018 23:02:35 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id D828F2EB0C; Tue, 13 Nov 2018 23:02:34 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id ACAB51C2A57 for ; Tue, 13 Nov 2018 23:02:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A902A228A4 for ; Tue, 13 Nov 2018 23:02:31 +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 B5Crp0Zom2C0 for ; Tue, 13 Nov 2018 23:02:31 +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 silver.osuosl.org (Postfix) with ESMTPS id CF4B22078B for ; Tue, 13 Nov 2018 23:02:30 +0000 (UTC) Received: from ofwgwc03.rockwellcollins.com (HELO ciulimr02.rockwellcollins.com) ([205.175.225.12]) by secvs01.rockwellcollins.com with ESMTP; 13 Nov 2018 17:02:27 -0600 X-Received: from largo.rockwellcollins.com (unknown [192.168.140.76]) by ciulimr02.rockwellcollins.com (Postfix) with ESMTP id A645A20084; Tue, 13 Nov 2018 17:02:29 -0600 (CST) From: Matt Weber To: buildroot@buildroot.org Date: Tue, 13 Nov 2018 17:02:24 -0600 Message-Id: <1542150146-12188-3-git-send-email-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1542150146-12188-1-git-send-email-matthew.weber@rockwellcollins.com> References: <1542150146-12188-1-git-send-email-matthew.weber@rockwellcollins.com> Subject: [Buildroot] [PATCH 3/5] support/testing/infra/emulator.py: support aarch64 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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" - Add the condition under the -kernel assignment for aarch64 - Tested with a defconfig simliar to qemu_aarch64_virt_defconfig Signed-off-by: Matthew Weber --- support/testing/infra/emulator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py index 802e89d..8e5a7e9 100644 --- a/support/testing/infra/emulator.py +++ b/support/testing/infra/emulator.py @@ -62,7 +62,9 @@ class Emulator(object): kernel = infra.download(self.downloaddir, "kernel-versatile") qemu_cmd += ["-M", "versatilepb"] - + elif arch == "aarch64": + kernel_cmdline.append("console=ttyAMA0") + qemu_cmd += ["-M", "virt", "-cpu", "cortex-a53"] qemu_cmd += ["-kernel", kernel] if kernel_cmdline: From patchwork Tue Nov 13 23:02:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 997417 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.137; helo=fraxinus.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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42vjnn35Zzz9rxp for ; Wed, 14 Nov 2018 10:02:37 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 70E2586868; Tue, 13 Nov 2018 23:02:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FbwiBIiHdqnD; Tue, 13 Nov 2018 23:02:34 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 46A3086709; Tue, 13 Nov 2018 23:02:34 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id A94501C29B9 for ; Tue, 13 Nov 2018 23:02:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A4BBA8768D for ; Tue, 13 Nov 2018 23:02:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 52OVyvFqD0j4 for ; Tue, 13 Nov 2018 23:02:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ch3vs03.rockwellcollins.com (ch3vs03.rockwellcollins.com [205.175.226.47]) by whitealder.osuosl.org (Postfix) with ESMTPS id 848B587683 for ; Tue, 13 Nov 2018 23:02:30 +0000 (UTC) Received: from ofwch3n02.rockwellcollins.com (HELO ciulimr02.rockwellcollins.com) ([205.175.226.14]) by ch3vs03.rockwellcollins.com with ESMTP; 13 Nov 2018 17:02:30 -0600 X-Received: from largo.rockwellcollins.com (unknown [192.168.140.76]) by ciulimr02.rockwellcollins.com (Postfix) with ESMTP id B615D2007E; Tue, 13 Nov 2018 17:02:29 -0600 (CST) From: Matt Weber To: buildroot@buildroot.org Date: Tue, 13 Nov 2018 17:02:25 -0600 Message-Id: <1542150146-12188-4-git-send-email-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1542150146-12188-1-git-send-email-matthew.weber@rockwellcollins.com> References: <1542150146-12188-1-git-send-email-matthew.weber@rockwellcollins.com> Subject: [Buildroot] [PATCH 4/5] support/testing/tests: CLANG compiler-rt runtime test 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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch adds a test case that 1) Builds the complete LLVM and CLANG set of host tools 2) Cross-compiles the compiler-rt runtime using CLANG 3) Builds a cross-compiled application using CLANG and the libfuzzer compiler-rt library. 4) Executes the fuzz application on target and checkes expected output Credit to the fuzzer test suite for the tutorial example used as the fuzz test application. https://github.com/google/fuzzer-test-suite Signed-off-by: Matthew Weber --- support/testing/tests/package/test_clang.py | 93 +++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 support/testing/tests/package/test_clang.py diff --git a/support/testing/tests/package/test_clang.py b/support/testing/tests/package/test_clang.py new file mode 100644 index 0000000..9c42c0d --- /dev/null +++ b/support/testing/tests/package/test_clang.py @@ -0,0 +1,93 @@ +import os +import tempfile +import subprocess +import shutil + +import infra.basetest + +FUZZ_TIMEOUT = 120 + + +class TestClangBase(infra.basetest.BRTest): + + def login(self): + img = os.path.join(self.builddir, "images", "rootfs.cpio.gz") + kern = os.path.join(self.builddir, "images", "Image") + # Sanitizers overallocate memory and the minimum that seemed to work was 512MB + self.emulator.boot(arch="aarch64", + kernel=kern, + options=["-m", "512", "-initrd", img]) + self.emulator.login() + + def build_test_prog(self): + hostdir = os.path.join(self.builddir, 'host') + linkerdir = os.path.join(hostdir, 'opt', 'ext-toolchain') + stagingdir = os.path.join(self.builddir, 'staging') + env = os.environ.copy() + env["PATH"] = "{}:".format(os.path.join(hostdir, 'bin')) + env["PATH"] + clangcpp = os.path.join(hostdir, 'bin', 'clang++') + workdir = os.path.join(tempfile.mkdtemp(suffix='-br2-testing-compiler-rt')) + fuzz_src = os.path.join(workdir, 'fuzz_me.cc') + fuzz_bin = os.path.join(workdir, 'fuzz_me') + with open(fuzz_src, 'w+') as source_file: + source_file.write('#include \n') + source_file.write('#include \n') + source_file.write('bool FuzzMe(const uint8_t *Data, size_t DataSize) {\n') + source_file.write(' return DataSize >= 3 &&\n') + source_file.write(' Data[0] == \'F\' &&\n') + source_file.write(' Data[1] == \'U\' &&\n') + source_file.write(' Data[2] == \'Z\' &&\n') + source_file.write(' Data[3] == \'Z\';\n') + source_file.write('}\n') + source_file.write('extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n') + source_file.write(' FuzzMe(Data, Size);\n') + source_file.write(' return 0;\n') + source_file.write('}\n') + + cmd = [clangcpp, + '-mcpu=cortex-a53', + '--sysroot', stagingdir, + '-B', linkerdir, + '-fsanitize=address,fuzzer', + fuzz_src, + '-o', fuzz_bin] + ret = subprocess.call(cmd, + stdout=self.b.logfile, + stderr=self.b.logfile, + env=env) + if ret != 0: + raise SystemError("Clang build process launch failed") + + shutil.copy(fuzz_bin, os.path.join(self.builddir, 'target', 'usr', 'bin')) + self.b.build() + shutil.rmtree(workdir) + + +class TestClangCompilerRT(TestClangBase): + config = \ + """ + BR2_aarch64=y + BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0" + BR2_TOOLCHAIN_EXTERNAL=y + BR2_LINUX_KERNEL=y + BR2_LINUX_KERNEL_CUSTOM_VERSION=y + BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.16.7" + BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y + BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config" + BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y + BR2_TARGET_ROOTFS_CPIO=y + BR2_TARGET_ROOTFS_CPIO_GZIP=y + # BR2_TARGET_ROOTFS_TAR is not set + BR2_PACKAGE_COMPILER_RT=y + BR2_PACKAGE_LLVM=y + """ + + def test_run(self): + self.build_test_prog() + self.login() + + # The test case verifies both that the application executes and that + # the symbolizer is working to decode the stack trace + cmd = "fuzz_me 2>&1 | grep _M_replace" + _, exit_code = self.emulator.run(cmd, FUZZ_TIMEOUT) + self.assertEqual(exit_code, 0) From patchwork Tue Nov 13 23:02:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 997415 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 42vjnl60CNz9rxp for ; Wed, 14 Nov 2018 10:02:35 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 605D724C85; Tue, 13 Nov 2018 23:02:34 +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 uKiTd7p0GLZZ; Tue, 13 Nov 2018 23:02:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 9AB4F227B5; Tue, 13 Nov 2018 23:02:33 +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 A18191BF2F7 for ; Tue, 13 Nov 2018 23:02:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 9EF6088020 for ; Tue, 13 Nov 2018 23:02:31 +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 SwHaDJy5rlOQ for ; Tue, 13 Nov 2018 23:02:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from da1vs01.rockwellcollins.com (da1vs01.rockwellcollins.com [205.175.227.27]) by hemlock.osuosl.org (Postfix) with ESMTPS id 9F2FC87AF3 for ; Tue, 13 Nov 2018 23:02:30 +0000 (UTC) Received: from ofwda1n02.rockwellcollins.com (HELO ciulimr02.rockwellcollins.com) ([205.175.227.14]) by da1vs01.rockwellcollins.com with ESMTP; 13 Nov 2018 17:02:29 -0600 X-Received: from largo.rockwellcollins.com (unknown [192.168.140.76]) by ciulimr02.rockwellcollins.com (Postfix) with ESMTP id C3B8220070; Tue, 13 Nov 2018 17:02:29 -0600 (CST) From: Matt Weber To: buildroot@buildroot.org Date: Tue, 13 Nov 2018 17:02:26 -0600 Message-Id: <1542150146-12188-5-git-send-email-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1542150146-12188-1-git-send-email-matthew.weber@rockwellcollins.com> References: <1542150146-12188-1-git-send-email-matthew.weber@rockwellcollins.com> Subject: [Buildroot] [PATCH 5/5] llvm/clang: add note about version bumping together 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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Matthew Weber Acked-by: Romain Naour --- package/clang/clang.mk | 1 + package/llvm/llvm.mk | 1 + 2 files changed, 2 insertions(+) diff --git a/package/clang/clang.mk b/package/clang/clang.mk index f9d4ae3..16f93ee 100644 --- a/package/clang/clang.mk +++ b/package/clang/clang.mk @@ -4,6 +4,7 @@ # ################################################################################ +# LLVM and Clang should be version bumped together CLANG_VERSION = 7.0.0 CLANG_SITE = http://llvm.org/releases/$(CLANG_VERSION) CLANG_SOURCE = cfe-$(CLANG_VERSION).src.tar.xz diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk index 79477f0..56f6ed9 100644 --- a/package/llvm/llvm.mk +++ b/package/llvm/llvm.mk @@ -4,6 +4,7 @@ # ################################################################################ +# LLVM and Clang should be version bumped together LLVM_VERSION = 7.0.0 LLVM_SITE = http://llvm.org/releases/$(LLVM_VERSION) LLVM_SOURCE = llvm-$(LLVM_VERSION).src.tar.xz