From patchwork Fri Sep 6 09:09:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1158890 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=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="F1b8Psdo"; dkim-atps=neutral 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 46PsG45bJbz9sDB for ; Fri, 6 Sep 2019 19:10:04 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C1174855FE; Fri, 6 Sep 2019 09:10:01 +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 iRpx5fBnjyD9; Fri, 6 Sep 2019 09:09:59 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 27BEB854DB; Fri, 6 Sep 2019 09:09:59 +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 076091BF2E3 for ; Fri, 6 Sep 2019 09:09:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 045EA20343 for ; Fri, 6 Sep 2019 09:09:58 +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 91AU+ZF1qFhZ for ; Fri, 6 Sep 2019 09:09:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by silver.osuosl.org (Postfix) with ESMTPS id 377C82033D for ; Fri, 6 Sep 2019 09:09:56 +0000 (UTC) Received: by mail-wr1-f44.google.com with SMTP id h7so5734209wrt.13 for ; Fri, 06 Sep 2019 02:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Awondix1XoRsidClA3CSOyfkyZgEmufT4O/89xh6LnA=; b=F1b8PsdoayomJriKZU3SpePiqDUWU6Y7umS59URFEkDMUqRb3JhPgN742C8QFA5/JR kHaWhG3JNtLe+TWKs9R0CYn5NYNgvyRXyGFIHoBe3jay4vaXaajFtzAXVPzzkA26GpWa Pn0nazZ7SESgFvYKOqje9ePw/hMEMdA3/ArvXnw8nCt/pSEKzaI2NraJfJZ/kDu367R/ lVFeeJ8J13KsSS+81z5acLI7Qg/NssEBJmchFmugVWulR/oNZomlGkLShhuvvVKNUTkZ N29eAocRDbbgm7eJGAPKS0eUAp2D+VNuse8YpMUy6XY3p7JdTzY/BKYRvqd0ntu6el3f wwqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Awondix1XoRsidClA3CSOyfkyZgEmufT4O/89xh6LnA=; b=rN80LM5mHRK/Uoj/sh4PK0APKp9JXdsgV+wrJPV0A93aCCelGqetyG5gwILjXfdp8X 7O8cFa0/UNoylQMmrH17WiRwmaBVIpehVwboN5dUQncVJXZQy/vK8vBMSCk4boeuhRCT VouOS4SDwSrHg3zyXMCeYGxmiE7TXwGeR5fiYDO0wsXwvYkTzcEmqIBDV0kaQPkYYQRz HP3+X63/Grt98PLmofoWUerlhGglRXubE1m54U7WYmMR0LCVngY53V2CW0+k4a6h1NBx V7dL0ZtP4G3M22nzUn6PuyBM8vUreuq623ckjCyszuDRRN6G3HCKACt9VR3bA+HAbj0A X/WQ== X-Gm-Message-State: APjAAAXZnhUc4Weoy/0qHbb/Y+PiaA4qWnqNDZKF3fcAshCryXhh5nUM ypkQQBtQuDH6UamJfzNCLf7e5OICUc4= X-Google-Smtp-Source: APXvYqwu5AMlprazicmtca28uJDFg6Ap2fn7VzA4zu8u9xzZUzkA8+1fwm6khuof13YRh6pArUTWmw== X-Received: by 2002:a5d:4247:: with SMTP id s7mr6167614wrr.110.1567760994237; Fri, 06 Sep 2019 02:09:54 -0700 (PDT) Received: from P-ASN-Evian.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id u6sm4582924wrr.26.2019.09.06.02.09.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 02:09:53 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Fri, 6 Sep 2019 11:09:37 +0200 Message-Id: <20190906090947.5476-2-romain.naour@smile.fr> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190906090947.5476-1-romain.naour@smile.fr> References: <20190906090947.5476-1-romain.naour@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 01/11] package/clang: help host-clang to find our external toolchain 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 , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" To build libfuzzer package Matthew Weber noticed that (host) clang doesn't run on the host without "-B $(HOST_DIR)/opt/ext-toolchain" option. This option add a new search path for binaries and object files used implicitly. Without -B clang fail to link due to missing crtbeging.o file and libgcc: output/host/bin/aarch64-linux-gnu-ld: cannot find crtbegin.o: No such file or directory output/host/bin/aarch64-linux-gnu-ld: cannot find -lgcc Indeed, clang search path doesn't include the dafault cross-gcc's search paths: $ output/host/bin/clang -print-search-dirs programs: = output/host/bin:output/host/bin:/..//bin libraries: = output/host/lib/clang/8.0.0: output/host/bin/../lib64: /lib/../lib64: /usr/lib/../lib64: output/host/bin/../lib: /lib:/usr/lib Here is the same command for cross-gcc: $ output/host/bin/aarch64-linux-gnu-gcc -print-search-dirs install: output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/ programs: = output/host/opt/ext-toolchain/bin/../libexec/gcc/aarch64-linux-gnu/8.3.0/: output/host/opt/ext-toolchain/bin/../libexec/gcc/: output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/bin/aarch64-linux-gnu/8.3.0/: output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/bin/ libraries: = output/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/: output/host/opt/ext-toolchain/bin/../lib/gcc/: output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/aarch64-linux-gnu/8.3.0/: output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/../lib64/: output/host/aarch64-buildroot-linux-gnu/sysroot/lib/aarch64-linux-gnu/8.3.0/: output/host/aarch64-buildroot-linux-gnu/sysroot/lib/../lib64/: output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/aarch64-linux-gnu/8.3.0/: output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/: output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/: output/host/aarch64-buildroot-linux-gnu/sysroot/lib/: output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/ We can see that gcc default search path contains "output/host/opt/ext-toolchain" directory where the external toolchain has been extracted. Since we want to use clang without additional option like -B, patch clang in order to use GCC_INSTALL_PREFIX instead of using automatic detection (which doesn't work for Buildroot). We eventually want to relocate the Buildroot SDK containing the clang cross-compiler, so we provide a relative path to GCC_INSTALL_PREFIX in order to avoid to hardcode the path to the GCC toolchain. Also the path between clang and the GCC external toolchain is not always the same, we have the following case: * Toolchain to be downloaded and installed The toolchain is extracted into $(HOST_DIR)/opt/ext-toolchain, so the path is "../opt/ext-toolchain". * Pre-installed toolchain The toolchain is localed somewhere in the host filesystem and defined by the user using BR2_TOOLCHAIN_EXTERNAL_PATH. So, set GCC_INSTALL_PREFIX using realpath: -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)` When we use a Buildroot's internal toolchain, clang will find theses crt*.o files and libgcc. http://lists.busybox.net/pipermail/buildroot/2019-August/256204.html Signed-off-by: Romain Naour Cc: Matthew Weber Cc: Valentin Korenblit --- v2: don't hack the external toolchain infra. patch clang and provide GCC_INSTALL_PREFIX --- ...hains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch | 76 +++++++++++++++++++ package/clang/clang.mk | 7 ++ 2 files changed, 83 insertions(+) create mode 100644 package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch diff --git a/package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch b/package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch new file mode 100644 index 0000000000..63ddbaf35f --- /dev/null +++ b/package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch @@ -0,0 +1,76 @@ +From fe21cede3939a435d62efbd5799547fab6af1b0a Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Mon, 5 Aug 2019 16:06:48 +0200 +Subject: [PATCH] lib/Driver/ToolChains/Gnu: Use GCC_INSTALL_PREFIX in the set + of prefixes for searching the gcc toolchain + +By default, the Gnu Toolchains driver is looking at the parent +directory while looking for the gcc toolchain when clang is installed +at "D.InstalledDir" + +But this doesn't work with Buildroot since the external +toolchain is installed in host/opt/ext-toolchain and the sysroot is +moved to host/-buildroot-linux-gnu/sysroot/ directory. + +We tried by setting GCC_INSTALL_PREFIX in clang.mk for host-clang +but it doesn't work since we already provide a sysroot [1]. + +Help the Gnu Toolchains driver by using GCC_INSTALL_PREFIX path. + +Since we want to be able to relocate the clang toolchain, +allow to use a relative path with GCC_INSTALL_PREFIX. + +Buildroot will provide such relative path by using: +HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)` + +Doing so allow to use clang without providing additional search +paths with -B option on the clang's command line. + +[1] https://reviews.llvm.org/D49244 +[2] http://lists.busybox.net/pipermail/buildroot/2019-August/256204.html + +Signed-off-by: Romain Naour +--- +This issue needs to be reported and discussed with upstream. +--- + lib/Driver/ToolChains/Gnu.cpp | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp +index 2ad45097dc..90d6b5b748 100644 +--- a/lib/Driver/ToolChains/Gnu.cpp ++++ b/lib/Driver/ToolChains/Gnu.cpp +@@ -1725,6 +1725,8 @@ void Generic_GCC::GCCInstallationDetector::init( + + Prefixes.push_back(GCCToolchainDir); + } else { ++ StringRef GccIinstallPrefix = GCC_INSTALL_PREFIX; ++ + // If we have a SysRoot, try that first. + if (!D.SysRoot.empty()) { + Prefixes.push_back(D.SysRoot); +@@ -1734,6 +1736,21 @@ void Generic_GCC::GCCInstallationDetector::init( + // Then look for gcc installed alongside clang. + Prefixes.push_back(D.InstalledDir + "/.."); + ++ // Use GCC_INSTALL_PREFIX if provided by the buildsystem. ++ if (!GccIinstallPrefix.empty()) ++ { ++ if (llvm::sys::path::is_relative(GccIinstallPrefix)) ++ { ++ // Use a relative path to gcc from clang install path. ++ Prefixes.push_back(D.InstalledDir + "/" + GccIinstallPrefix.str()); ++ } ++ else ++ { ++ // Hardcode the absolute path provided by GCC_INSTALL_PREFIX. ++ Prefixes.push_back(GCC_INSTALL_PREFIX); ++ } ++ } ++ + // Next, look for prefix(es) that correspond to distribution-supplied gcc + // installations. + if (D.SysRoot.empty()) { +-- +2.20.1 + diff --git a/package/clang/clang.mk b/package/clang/clang.mk index 3796ca8605..ed6f9bf90e 100644 --- a/package/clang/clang.mk +++ b/package/clang/clang.mk @@ -102,5 +102,12 @@ CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON HOST_CLANG_CONF_OPTS += -DLLVM_DYLIB_COMPONENTS=all CLANG_CONF_OPTS += -DLLVM_DYLIB_COMPONENTS=all +# Help host-clang to find our external toolchain, use a relative path from the clang +# installation directory to the external toolchain installation directory in order to +# not hardcode the toolchain absolute path. +ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) +HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)` +endif + $(eval $(cmake-package)) $(eval $(host-cmake-package)) From patchwork Fri Sep 6 09:09:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1158895 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=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="NqVW9qmy"; dkim-atps=neutral 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 46PsGC5BFZz9s3Z for ; Fri, 6 Sep 2019 19:10:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 96260869BC; Fri, 6 Sep 2019 09:10:06 +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 m-nHITJBQRzG; Fri, 6 Sep 2019 09:10:04 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id BFC1D8578C; Fri, 6 Sep 2019 09:10:04 +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 E2DFA1BF2E3 for ; Fri, 6 Sep 2019 09:10:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id E01F58523B for ; Fri, 6 Sep 2019 09:10:00 +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 5kYwiiaJGZ2R for ; Fri, 6 Sep 2019 09:09:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by fraxinus.osuosl.org (Postfix) with ESMTPS id ED6C585143 for ; Fri, 6 Sep 2019 09:09:57 +0000 (UTC) Received: by mail-wm1-f42.google.com with SMTP id t9so6165592wmi.5 for ; Fri, 06 Sep 2019 02:09:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YwDgkqzUu84ey/JwrFa6v9eqfKbQVwHD3Tu1Fcmp/4Y=; b=NqVW9qmynLSrYbuVB5o7tzE0sa5vztlmoB/fyC7p0WGRjmFl8Dx4rshLxzGGzX6d1i MQEHxS2ynPiaqaZZ2H03g6lsvYgCWYnHuyu4niJoFww6I1hRNA1sqzW0WBq4pnAbNKgF 3evj5ThGAg1RGjACqzdHF1GBMyZjuLS9v6ASfViZAycq4poJw+BiezljHTi8aP9ZWvM7 5RwC38O0OptcVDDsGZ3GKzoqqowT0AOQCn3W2h7eismbzXPnXvF50jEGaCLLw23sFQAN Vlk9IzvrK9Rh3xB59sL8y074ZAhi/MgyhbfHtDuSydE3YVFE2N38TCt1EDa1IPuDUdOw FMzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YwDgkqzUu84ey/JwrFa6v9eqfKbQVwHD3Tu1Fcmp/4Y=; b=kdKqRRZghRTNHTNF5RQT6P5wOJmRvxX2h+Gv5EfoQ1eXeNXcgc7a+gbm1yi9C0neHf pY0ckmxViJ1CNDQsTr/EjQJ1anbnCTB+UnktGTB9L6qshHQfwRrhRdyk74YpgllVWCjw WMxVntptX9Yf/K70nAWsEBQLGw7L/QtKdK+xXVbty92iJDzjLFmbxdBOtUqqrGf0L1DC jH5IxowFeWz63XOZVWR61MaM9LKYF5Qf/ZueUyDzqer3AsA4+gY2j3TnTDI9AnuRWMJh Ip3VPuPO6GHqSSEvRC6EWJCRdr9e8HARauW7z6127lBoPPvGzqxqR7Z/oze/d6kn2EWM wEqw== X-Gm-Message-State: APjAAAVLfsZVX/cyqE2FXGKJwth8feKQGwahHf+7ddx1Ov54Ku+g1P6m fFQhfv7d3MvQGkO2Takrz8rfY9NOlME= X-Google-Smtp-Source: APXvYqzsEyNn3IiBjPWs/uzADH3FWdrx9TUGl3swWe07L7zWIxQmWriuDj9hia3Ro7VJ0WEtRRQn7w== X-Received: by 2002:a1c:3bd6:: with SMTP id i205mr6172104wma.135.1567760995231; Fri, 06 Sep 2019 02:09:55 -0700 (PDT) Received: from P-ASN-Evian.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id u6sm4582924wrr.26.2019.09.06.02.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 02:09:54 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Fri, 6 Sep 2019 11:09:38 +0200 Message-Id: <20190906090947.5476-3-romain.naour@smile.fr> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190906090947.5476-1-romain.naour@smile.fr> References: <20190906090947.5476-1-romain.naour@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 02/11] package/llvm: add the version major variable 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 , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Romain Naour Cc: Matt Weber Cc: Valentin Korenblit --- package/llvm/llvm.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk index f14b537d94..e885c63f98 100644 --- a/package/llvm/llvm.mk +++ b/package/llvm/llvm.mk @@ -5,7 +5,8 @@ ################################################################################ # LLVM and Clang should be version bumped together -LLVM_VERSION = 8.0.1 +LLVM_VERSION_MAJOR = 8 +LLVM_VERSION = $(LLVM_VERSION_MAJOR).0.1 LLVM_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LLVM_VERSION) LLVM_SOURCE = llvm-$(LLVM_VERSION).src.tar.xz LLVM_LICENSE = NCSA From patchwork Fri Sep 6 09:09:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1158892 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=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="LOrf2RRo"; dkim-atps=neutral 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 46PsG61GWCz9sNT for ; Fri, 6 Sep 2019 19:10:05 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1AFB6854DB; Fri, 6 Sep 2019 09:10:03 +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 R7A98L5vFedx; Fri, 6 Sep 2019 09:10:02 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id E1B138561E; Fri, 6 Sep 2019 09:10:01 +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 522981BF2E3 for ; Fri, 6 Sep 2019 09:09:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4F1DF85531 for ; Fri, 6 Sep 2019 09:09:59 +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 qzq0yyif0u9k for ; Fri, 6 Sep 2019 09:09:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by fraxinus.osuosl.org (Postfix) with ESMTPS id EE7378517E for ; Fri, 6 Sep 2019 09:09:57 +0000 (UTC) Received: by mail-wr1-f54.google.com with SMTP id w13so5740111wru.7 for ; Fri, 06 Sep 2019 02:09:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g9YAYil2KXJqRYXboBA3FTl6zwQaxHUljuvtljhybjY=; b=LOrf2RRo1vBbHuYcVZxFrBz/TMUrGKHEzlAPfK7UlbPF+2kGNNaEvBMfpSS4rOEKEW v9UW5DGaP/8ddljRrpFoYWu7m8XeNP18j6IwTpDM2ksJE8ebj0iGBMhws55fK8Xge8We QQJAcKm3NScyWIkG3r85X4WxubLRnEPhl35uU1c9iw1GZasSj4BmQYa4LOoH1Cqb7ebu cIWFsIWF+ivudKAMD8SKvCYueLD6daSyKMBPwQBZgFsswbhsgh3mHha1ywN6m6cRw9cN 1Kj1UOZdMLgq7UwzUVSB3sHjyeRj+7/TdfRGU41Wq5RvGDnq2gUGsg0GQkevPpXaKgUG ZWwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g9YAYil2KXJqRYXboBA3FTl6zwQaxHUljuvtljhybjY=; b=skB4GFlaCB7Hg506YIopUfIXCyoKAYoVmIXxY2E9HYqAAo5naUTeYaFSP4l8vPZg+0 d3QzQDDKXGlvPv2rD6RhLzF0rU6sDAjhCFzkKLi5SN5ENh+57DKXtPFMQ4d5TeJcyBBj qftCdA7yL7LgEpLYckNalH0QPh+H3B30KIoAxzxqmR9EJztYMAOxR9CdtYcpACd/Qput jVmMCVFNn2+NyCVATTTvPvbog+ep37YTFgkAILPMLC6TQBE9XboSBxeuYXNp8tSTyg5c 0XPV15Y8KACISRA9/ON5uUfOYc3LXvXNSrqNtngtFghSERgaFahdgrYIk/8IfN/RV+qS 5ocw== X-Gm-Message-State: APjAAAU8Mnwg/VQYuLtCMWkaZT8XXXqfdthWI6W75e9MdL5ZDj77xeer HYhdk7VWTjioW3VYbmDoJCkjZ198DQs= X-Google-Smtp-Source: APXvYqyu5smETGxByTKjCbOKBylZfsOPF7KH1dZm/eo4uXinpGrn1winAtdC9c9M5jm/qcMVU62lQQ== X-Received: by 2002:adf:84c6:: with SMTP id 64mr6088650wrg.287.1567760996002; Fri, 06 Sep 2019 02:09:56 -0700 (PDT) Received: from P-ASN-Evian.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id u6sm4582924wrr.26.2019.09.06.02.09.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 02:09:55 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Fri, 6 Sep 2019 11:09:39 +0200 Message-Id: <20190906090947.5476-4-romain.naour@smile.fr> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190906090947.5476-1-romain.naour@smile.fr> References: <20190906090947.5476-1-romain.naour@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 03/11] package/clang: add the version major variable 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 , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" CLANG_VERSION_MAJOR will be used in a followup patch to install the toolchain-wrapper for clang cross-compiler and it's symlinks. Signed-off-by: Romain Naour Cc: Matt Weber Cc: Valentin Korenblit --- package/clang/clang.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/clang/clang.mk b/package/clang/clang.mk index ed6f9bf90e..857ec148ac 100644 --- a/package/clang/clang.mk +++ b/package/clang/clang.mk @@ -5,7 +5,8 @@ ################################################################################ # LLVM and Clang should be version bumped together -CLANG_VERSION = 8.0.1 +CLANG_VERSION_MAJOR = 8 +CLANG_VERSION = $(CLANG_VERSION_MAJOR).0.1 CLANG_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(CLANG_VERSION) CLANG_SOURCE = cfe-$(CLANG_VERSION).src.tar.xz CLANG_LICENSE = NCSA From patchwork Fri Sep 6 09:09:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1158893 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.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="aHgHaW+k"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46PsGB5lk8z9sDB for ; Fri, 6 Sep 2019 19:10:10 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6CB0387E13; Fri, 6 Sep 2019 09:10:06 +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 YKQ0KaZZMvdQ; Fri, 6 Sep 2019 09:10:04 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id ECA1E87D0E; Fri, 6 Sep 2019 09:10:03 +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 6AFEB1BF2E3 for ; Fri, 6 Sep 2019 09:10:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6771B87DCE for ; Fri, 6 Sep 2019 09:10:00 +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 2+EVOUzkW8cK for ; Fri, 6 Sep 2019 09:09:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by hemlock.osuosl.org (Postfix) with ESMTPS id 0CCAE87B20 for ; Fri, 6 Sep 2019 09:09:59 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id r195so6194638wme.2 for ; Fri, 06 Sep 2019 02:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zp+FDGC+8hxW2qA4RB22zv9FOPiCEqp/KqjTZDHxhME=; b=aHgHaW+kQjCv+JtEjU4RQ21en/RIlNTwwbSTR0VbPOBdKYJNagwRLeA9DSojZFVrpj 0NfMIwQL6m2kJitwv1ZqoEUCGauqzwSpNdjCEcfnPZlO/FX4xqoQVA+/HzzwHRn6xFQ1 loUHiJa1gZFOKLIpLItlrLzAcIl83aW6FQ1O3p6FugsmdJT6AquloMeSzOJHbbO4gwNs lsx95A0DC5EnSjvRoHAYSSHC/fC9vqa9UZfzB0Y6UeJz7U+fP1dh7uJtVtbNUG3M6lVc qvnpd296yvl/HRCqAvum37ibGI/ELG8PGQflqjP1r8jIrh3ZR71LJyOSzuT5ShepNdua wgiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zp+FDGC+8hxW2qA4RB22zv9FOPiCEqp/KqjTZDHxhME=; b=K/3qgVkFnzS+8AY38ZTofdwbr9oH+RsNk6mUZgXOc3cW2xG7mfzuiF0GwNQHNWB46u BN1M1Xs8+ombAXvZqvESn95tQaauXUHLBk7QugI5fOQLatNKMe6fKFbapG6lUAGaHgDd vZDyClYIt77nonvajatyQ4uF9tBu/b+UYX752ilARyZzH0jxwNmoltqDKxjk3EoUZXzB Enz8j7Jazn4SEXV9TrySrKDYTb+JgsEMcGWxMuEOTU0vtJfHxlck/Qy9nurDZ456qkMw /9X4oJgfxCoamksufMhRCxGmCE3HKJQBspzx6frhZnPBTiCxLNiMsHjaYdozBIElbEl4 yoPw== X-Gm-Message-State: APjAAAWMwPM+1M0UrT4/S2lREFaNCd8c/NYqYxRoNm3j4t9iz+aB3l+1 thenR+jxaY6gU72RKTNkiuKicYOUFCg= X-Google-Smtp-Source: APXvYqyjTi/h0IWYK10pSt9zql2c+N4fOd6h3jBALyP7uXURaW26Nx3MAVw6lSWk3UQfUx7CwznwDw== X-Received: by 2002:a7b:cf35:: with SMTP id m21mr6724781wmg.38.1567760997153; Fri, 06 Sep 2019 02:09:57 -0700 (PDT) Received: from P-ASN-Evian.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id u6sm4582924wrr.26.2019.09.06.02.09.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 02:09:56 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Fri, 6 Sep 2019 11:09:40 +0200 Message-Id: <20190906090947.5476-5-romain.naour@smile.fr> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190906090947.5476-1-romain.naour@smile.fr> References: <20190906090947.5476-1-romain.naour@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 04/11] package/clang: install a toolchain-wrapper for the host clang cross-compiler 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 , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" In order to use clang as a host cross-compiler for Buildroot, we need to provide at least the path to the sysroot (using --sysroot) and some other compiler flags. Hoppefully, we can reuse the toolchain wrapper for gcc since clang support most of the gcc flags used in the Buildroot's toolchain wrapper. Only the flag -mfused-madd (deprecated since gcc 4.6) for mips is not supported by clang. Since Clang require gcc >= 5.x this flag can never be used. Since host-clang is always build by Buildroot as an internal toolchain, we have to use a second toolchain-wrapper called toolchain-wrapper-clang when an external toolchain is used. Inded, the two wrapper use a different path BR_CROSS_PATH_SUFFIX in this case. After building the clang toolchain wrapper, create the symlinks needed to force package infrastructure to use clang througt the wrapper. Initially clang install the clang-8 binary and create all other symlinks: # clang -> clang-8 # clang++ -> clang # clang-8 # clang-cl -> clang # clang-cpp -> clang Use a post install hook to rename the clang-8 binary to clang-8.br_real and recreate all symlinks: # clang -> toolchain-wrapper-clang # clang++ -> toolchain-wrapper-clang # clang-8 -> toolchain-wrapper-clang # clang-8.br_real # clang++.br_real -> clang-8.br_real # clang.br_real -> clang-8.br_real # clang-cl -> toolchain-wrapper-clang # clang-cl.br_real -> clang-8.br_real # clang-cpp -> toolchain-wrapper-clang # clang-cpp.br_real -> clang-8.br_real Use the previously introduced CLANG_VERSION_MAJOR variable to create theses symlinks. Set BR_CROSS_PATH_SUFFIX to ".br_real" as for the Buildroot's internal GCC toolchain backend to find the "real" clang binary installed in $(HOST_DIR)/bin. Borrow TOOLCHAIN_WRAPPER_BUILD and TOOLCHAIN_WRAPPER_INSTALL to build and install the specific clang toolchain wrapper. Signed-off-by: Romain Naour Cc: Matt Weber Cc: Valentin Korenblit --- package/clang/clang.mk | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/package/clang/clang.mk b/package/clang/clang.mk index 857ec148ac..148df8e611 100644 --- a/package/clang/clang.mk +++ b/package/clang/clang.mk @@ -110,5 +110,39 @@ ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)` endif +define HOST_CLANG_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS + $(Q)cd $(HOST_DIR)/bin; \ + for i in clang clang-$(CLANG_VERSION_MAJOR) clang++ clang-cl clang-cpp; do \ + case "$$i" in \ + *clang-$(CLANG_VERSION_MAJOR)) \ + rm -f $$i.br_real; \ + mv $$i $$i.br_real; \ + ln -sf toolchain-wrapper-clang $$i; \ + ;; \ + *) \ + ln -snf toolchain-wrapper-clang $$i; \ + ln -snf clang-$(CLANG_VERSION_MAJOR).br_real $$i.br_real; \ + ;; \ + esac; \ + done +endef + +define HOST_CLANG_TOOLCHAIN_WRAPPER_BUILD + $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \ + -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \ + toolchain/toolchain-wrapper.c \ + -o $(@D)/toolchain-wrapper-clang +endef + +define HOST_CLANG_TOOLCHAIN_WRAPPER_INSTALL + $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper-clang \ + $(HOST_DIR)/bin/toolchain-wrapper-clang +endef + +HOST_CLANG_TOOLCHAIN_WRAPPER_ARGS += -DBR_CROSS_PATH_SUFFIX='".br_real"' +HOST_CLANG_POST_BUILD_HOOKS += HOST_CLANG_TOOLCHAIN_WRAPPER_BUILD +HOST_CLANG_POST_INSTALL_HOOKS += HOST_CLANG_TOOLCHAIN_WRAPPER_INSTALL +HOST_CLANG_POST_INSTALL_HOOKS += HOST_CLANG_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS + $(eval $(cmake-package)) $(eval $(host-cmake-package)) From patchwork Fri Sep 6 09:09:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1158894 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.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="PH0E4iae"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46PsGC1W3bz9sNf for ; Fri, 6 Sep 2019 19:10:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8704887D0E; Fri, 6 Sep 2019 09:10:06 +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 WJ8tEZE2sIf6; Fri, 6 Sep 2019 09:10:06 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id F2B7287E5B; Fri, 6 Sep 2019 09:10:05 +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 0C5E41BF2E3 for ; Fri, 6 Sep 2019 09:10:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 08E8387B20 for ; Fri, 6 Sep 2019 09:10:01 +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 2Kv9JR4wzyvO for ; Fri, 6 Sep 2019 09:10:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by hemlock.osuosl.org (Postfix) with ESMTPS id D80C787D0E for ; Fri, 6 Sep 2019 09:09:59 +0000 (UTC) Received: by mail-wm1-f53.google.com with SMTP id n10so6191450wmj.0 for ; Fri, 06 Sep 2019 02:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D/9zoX0TQcuL1uNfcSxOWa71cfOez9ZiUtHKQnaqDqg=; b=PH0E4iae7PRv4Sg2GOU0i3xMCkVTEjzDN61dQMZ4EfmbQgfeYZdHJkaXBmwFQ8iyo3 CcIyBzpLc8kWrKXuGtR5jY+SxGVkniOv/SBs/iGsALgHsuf9sU/b+dAIXCiI43pDlNQs aeF72xWSNBiFMSo+YdKn9fzteG+Q9L3F0XhEaM/Efi4qviWxjlH+ytJQ2t8gUpX6I/Wr uir6qZI7lNGJOKx00/pqEtlNz0pjuDdJiw9ZDCoWF6UOfMQo4JTUufN6zB7ZC3qTZR0y 7MUbnFTZ4YRI7OgXaHObxNRwQYUA26nmUKkHTcxBJmiemFL8aqfJ+rBW2Lr4RT6CAky3 ejtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D/9zoX0TQcuL1uNfcSxOWa71cfOez9ZiUtHKQnaqDqg=; b=j7i0ljWhv6LD9JIxW5GX6lT0Q8uR7cFB4BFJ9vkatGyy8XUAseDmIKwh2vJP7YXgUY NxD85QULu0erm88Aumzkg50n4anmSsdHyU/WSjMdLXeSs4KVwR03S6UbSQ6t7bk3B8Gr mVWHT6jukGIc9GcWucaDNVloaYpyud13UZhxwWeddXozg6q0EUrUKGVJyiWoW8pYi9GA Bazxy6klEHf1XlYpy/mZ+CTq108J3aLgPm3kUqHbKiOVahYgMi+hMp9+xabZc8KtGgMb nRzCbPC6TR84xUpxw5aP5eNfJX7PfmJ9ycGgRXCzU3WdgZZXKohCxY7tUyzEC3SZKHbD UBIA== X-Gm-Message-State: APjAAAV0lsvK4Ov/nAtF+t9dWH5WSQ3rkBZr0wXketITOGLqYnb78dcA 8yPAKZII33nj3DFxGl+sV087a4Nn3Qw= X-Google-Smtp-Source: APXvYqxEAa1xQQP0lTpsqjFF/vgMbGIa58dVpPQmn8za4jX001qHTI1y14ZEOJTZJ4q0+0AcKHeK9A== X-Received: by 2002:a05:600c:285:: with SMTP id 5mr6950249wmk.161.1567760998246; Fri, 06 Sep 2019 02:09:58 -0700 (PDT) Received: from P-ASN-Evian.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id u6sm4582924wrr.26.2019.09.06.02.09.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 02:09:57 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Fri, 6 Sep 2019 11:09:41 +0200 Message-Id: <20190906090947.5476-6-romain.naour@smile.fr> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190906090947.5476-1-romain.naour@smile.fr> References: <20190906090947.5476-1-romain.naour@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 05/11] linux: override CC for the case CC is not GCC 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 , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Until now we provided only CROSS_COMPILE to the kernel buildsystem to use our GCC cross-compiler. Internally, the buildsystem defined CC=$(CROSS_COMPILE)gcc. Since Clang can now be used as cross-compiler, Buildroot may define in the future TARGET_CC to use clang instead of GCC. In order to build the kernel with the selected compiler, make sure to define CC=$(TARGET_CC) in LINUX_MAKE_FLAGS. Signed-off-by: Romain Naour Cc: Matt Weber Cc: Valentin Korenblit --- linux/linux.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/linux/linux.mk b/linux/linux.mk index 29d2f0ee69..d381c96d85 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -128,6 +128,7 @@ LINUX_MAKE_FLAGS = \ ARCH=$(KERNEL_ARCH) \ INSTALL_MOD_PATH=$(TARGET_DIR) \ CROSS_COMPILE="$(TARGET_CROSS)" \ + CC="$(TARGET_CC)" \ DEPMOD=$(HOST_DIR)/sbin/depmod ifeq ($(BR2_REPRODUCIBLE),y) From patchwork Fri Sep 6 09:09:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1158897 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=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="OeTfVZDj"; dkim-atps=neutral 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 46PsGH118nz9sDB for ; Fri, 6 Sep 2019 19:10:14 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 0EB0D2033D; Fri, 6 Sep 2019 09:10:11 +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 Qyt9AaShquXc; Fri, 6 Sep 2019 09:10:08 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 0F37320343; Fri, 6 Sep 2019 09:10:08 +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 43C311BF2E3 for ; Fri, 6 Sep 2019 09:10:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 416D220343 for ; Fri, 6 Sep 2019 09:10:02 +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 yzOr0w8knAhf for ; Fri, 6 Sep 2019 09:10:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by silver.osuosl.org (Postfix) with ESMTPS id DD4D42033D for ; Fri, 6 Sep 2019 09:10:00 +0000 (UTC) Received: by mail-wr1-f42.google.com with SMTP id t16so5739669wra.6 for ; Fri, 06 Sep 2019 02:10:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y2/ebNt1Hdha86y+aeP9vNjazbDPWjrM7Myn0OfWZeo=; b=OeTfVZDjt7eiRIeEfU2q86/UiRbjjDlj9tJml/kNuKU8lCsadbiFXiDEvSQxWt4Id6 +DQ4kgf1x/2f2RkHSyvR/j4dkJCQzdPupsjaOKjNfdC4v/MpjYytXBvqdiMx5myAnFqD LRfdRaLyJgIlCNoJqMxNYSGxjJNyoAOzY/NrczZDXe4rTsRLmZ1CI8L+biLHN6tExX0a ScXXNEvuLt4teNpTsBPzsEJenDHIW52Q//Lx0tvd+E3KlWT65fK5Zkdw+3fUmcSKA8TV vLxWZvM0s17Qva8x3eNXeD+zz3IUthF+MxJIwHQHeMhGLuHMQqcM2E2c0W6n1l6itnDl 0wUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y2/ebNt1Hdha86y+aeP9vNjazbDPWjrM7Myn0OfWZeo=; b=rqMovTnIDHugrT4z9g4yHHdOLFRL81zvqcHIbaNVXHKQAXtfx9StMgMv4LVLnu4sqH ODyDbXyMJyLGGrncsjwaoeeNijED1kAbe23pen3Y8IT3sTVMwRoTwRXQEg60XCt6c+Y2 xWir3d+E7vfWlWqq9BLuqtq7+warfkB81cgkmC19I41CFSM23tFNS0l78KLVMkYG0qzR YJt4UZyZkDBnmoTvrcJenl0rV80/hpbdAU6Z90ZOLDlPamJSYrV92uO34aq6WmUnf3Gp N9tP5VcnfzWqRcAKlXlE7dRR38ExyhHeRS7Hu+gOIfy/TMyGgp6itxb6KnFZ4irPcwgF UW0Q== X-Gm-Message-State: APjAAAU9cy6Hxi+uoj/Ae6iU2y3Z0fAzopVzd64cOtSF4xjdSq+ZSdJ5 uYBGh6rvB3qgaXkzaqEb2FF8m9AHb2U= X-Google-Smtp-Source: APXvYqwVUt8l8dEcy/TsxsU2DPaqTPrjsAKEy7q9AQ+T6+hmohcXm2016p/lhHtGfQppnyfbXLsF0Q== X-Received: by 2002:a5d:4081:: with SMTP id o1mr3080800wrp.41.1567760999185; Fri, 06 Sep 2019 02:09:59 -0700 (PDT) Received: from P-ASN-Evian.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id u6sm4582924wrr.26.2019.09.06.02.09.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 02:09:58 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Fri, 6 Sep 2019 11:09:42 +0200 Message-Id: <20190906090947.5476-7-romain.naour@smile.fr> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190906090947.5476-1-romain.naour@smile.fr> References: <20190906090947.5476-1-romain.naour@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 06/11] package/meson: use TARGET_{CC, CXX} instead of TARGET_CROSS 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 , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Using TARGET_CROSS expect using GCC compiler, instead use TARGET_CC and TARGET_CXX for the case where Clang is used as cross-compiler. Signed-off-by: Romain Naour Cc: Matt Weber Cc: Valentin Korenblit --- package/meson/cross-compilation.conf.in | 4 ++-- package/meson/meson.mk | 3 ++- package/pkg-meson.mk | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in index fc8e27f7eb..86347e9e4e 100644 --- a/package/meson/cross-compilation.conf.in +++ b/package/meson/cross-compilation.conf.in @@ -4,8 +4,8 @@ # - Buildroot's 'target' is Meson's 'host' [binaries] -c = '@TARGET_CROSS@gcc' -cpp = '@TARGET_CROSS@g++' +c = '@TARGET_CC@' +cpp = '@TARGET_CXX@' ar = '@TARGET_CROSS@ar' strip = '@TARGET_CROSS@strip' pkgconfig = '@HOST_DIR@/usr/bin/pkg-config' diff --git a/package/meson/meson.mk b/package/meson/meson.mk index 3267581fc6..1f836ef070 100644 --- a/package/meson/meson.mk +++ b/package/meson/meson.mk @@ -54,7 +54,8 @@ HOST_MESON_SED_CXXFLAGS = $(if $(strip $(TARGET_CXXFLAGS)),`printf '"%s"$(comma) # own flags if they need to. define HOST_MESON_INSTALL_CROSS_CONF mkdir -p $(HOST_DIR)/etc/meson - sed -e "s%@TARGET_CROSS@%$(TARGET_CROSS)%g" \ + sed -e "s%@TARGET_CC@%$(TARGET_CC)%g" \ + -e "s%@TARGET_CXX@%$(TARGET_CXX)%g" \ -e "s%@TARGET_ARCH@%$(HOST_MESON_TARGET_CPU_FAMILY)%g" \ -e "s%@TARGET_CPU@%$(HOST_MESON_TARGET_CPU)%g" \ -e "s%@TARGET_ENDIAN@%$(HOST_MESON_TARGET_ENDIAN)%g" \ diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index 0b811d1cc0..9821636c28 100644 --- a/package/pkg-meson.mk +++ b/package/pkg-meson.mk @@ -71,7 +71,8 @@ $(2)_MESON_SED_CXXFLAGS = $$(if $$(strip $$($(2)_CXXFLAGS)),`printf '"%s"$$(comm define $(2)_CONFIGURE_CMDS rm -rf $$($$(PKG)_SRCDIR)/build mkdir -p $$($$(PKG)_SRCDIR)/build - sed -e "s%@TARGET_CROSS@%$$(TARGET_CROSS)%g" \ + sed -e "s%@TARGET_CC@%$(TARGET_CC)%g" \ + -e "s%@TARGET_CXX@%$(TARGET_CXX)%g" \ -e "s%@TARGET_ARCH@%$$(HOST_MESON_TARGET_CPU_FAMILY)%g" \ -e "s%@TARGET_CPU@%$$(GCC_TARGET_CPU)%g" \ -e "s%@TARGET_ENDIAN@%$$(call LOWERCASE,$$(BR2_ENDIAN))%g" \ From patchwork Fri Sep 6 09:09:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1158901 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=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="KpqeTkNW"; dkim-atps=neutral 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 46PsGg3Ynhz9s3Z for ; Fri, 6 Sep 2019 19:10:35 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id ADD268765D; Fri, 6 Sep 2019 09:10:33 +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 5x-5-1HXvr4D; Fri, 6 Sep 2019 09:10:29 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id AD87187677; Fri, 6 Sep 2019 09:10:09 +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 4F0361BF9BF for ; Fri, 6 Sep 2019 09:10:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4C1798697E for ; Fri, 6 Sep 2019 09:10:05 +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 Y8jmrq29I8qH for ; Fri, 6 Sep 2019 09:10:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by fraxinus.osuosl.org (Postfix) with ESMTPS id ECACE85650 for ; Fri, 6 Sep 2019 09:10:01 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id q14so5724244wrm.9 for ; Fri, 06 Sep 2019 02:10:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x4S40M8tAuJhekZswjdehjjEqkc4pVqvlfjViTcHWUU=; b=KpqeTkNWOSMgNb1AMbep7bDa45Xtb/7MCt6CLpZp4laPXm9PtnziARN0AXK2AuMiLm oFcmTzhkhv1uCdCEUsRgz1Md1JPzwBjzhUkRzOuYA4x5MncaBuadMw6Qc5zC0sQNx05A PcZP6upbKKtRcmIjs8Uhs8Sxndk+ToPZuRMLoaGm1U92+O3qxfXjGTEXW8ueGOhBRcTh 3hW3TTtd8HTcU/P8uVWS184aGdpzO0ib76Hv3k/arZW75WoGR6FrGfDD/G3EZQciraGi Ah7CSBifiWPsArRM8qU61l+PCxMLFB47kvfwUXI68xmnjh3ArzjbCQwBe6hYbnc8T3XR s/fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x4S40M8tAuJhekZswjdehjjEqkc4pVqvlfjViTcHWUU=; b=gDVT3ASzIfaclU97RGsHtHMXhntBSRJZ8+HddaEHxb6suOvI0f3Wu/SRPtU1nJk5Dd Wzg8tzAbVbR6OnjTL7wFiSNoyMz1qpTNfMKRjInbqwcEl1mSPtdoV0lBdRNXnK/EJ7oy LAHSwwEDmbkn9YUoG+/FShiQewq5IrkTQDL6J6AqnQNdBXN0+naj1e6aez+P3ju7Jusj uqDVTs52UjZdMrRgwt3uaPEdxyT4/3l5hFL9xYUnr4scqVtfA7M7zDeeXN4OBhqrnP9P 55d1bOkVQLeoh7bFG5ARatk20q7WeuIhJ26o3Q83Uk7C54zo7WaCcIGDkbfrIUEoUTzL 3n5w== X-Gm-Message-State: APjAAAU6V3gC4ofw7PznLBzocrfLpudxxptBKoIvTFWQbSgmK0ba7Hoq xrTs6y39qJEBUav9pwuP2X8bc5vQ/Yc= X-Google-Smtp-Source: APXvYqwmhRp9y/vBldeWyUkm/k64vKtTkfs0d2DPs+hAbRNbsRoZOGy+9o/fxROF2k8itxl9p4XYJg== X-Received: by 2002:adf:ee4a:: with SMTP id w10mr6160218wro.138.1567761000181; Fri, 06 Sep 2019 02:10:00 -0700 (PDT) Received: from P-ASN-Evian.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id u6sm4582924wrr.26.2019.09.06.02.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 02:09:59 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Fri, 6 Sep 2019 11:09:43 +0200 Message-Id: <20190906090947.5476-8-romain.naour@smile.fr> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190906090947.5476-1-romain.naour@smile.fr> References: <20190906090947.5476-1-romain.naour@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 07/11] package/busybox: fix applets runtime issue when building with clang cross-compiler 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: Luis Marques , Romain Naour , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Apply a patch contributed by Luis Marques on the Busybox mailing list [1] fixing a runtime issue (segfault) when busybox is compiled by Clang. The patch disable the compiler optimizations for Clang/LLVM only. Without this patch, busybox segfault with several applets (login on aarch64 using Clang 8.0.1, init on x86_64 using Clang 9.0.0rc3) [1] http://lists.busybox.net/pipermail/busybox/2019-June/087337.html Signed-off-by: Romain Naour Cc: Luis Marques Cc: Matt Weber Cc: Valentin Korenblit --- Note: The Luis Marques's SoB line in the Busybox patch is missing. The patch is still under review to avoid disabling optimizations. --- ...use-BB_GLOBAL_CONST-where-applicable.patch | 173 ++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 package/busybox/0003-use-BB_GLOBAL_CONST-where-applicable.patch diff --git a/package/busybox/0003-use-BB_GLOBAL_CONST-where-applicable.patch b/package/busybox/0003-use-BB_GLOBAL_CONST-where-applicable.patch new file mode 100644 index 0000000000..738a15b0de --- /dev/null +++ b/package/busybox/0003-use-BB_GLOBAL_CONST-where-applicable.patch @@ -0,0 +1,173 @@ +From 6f53fa8303edff685aee3cc16a6c8967fae869db Mon Sep 17 00:00:00 2001 +From: Luis Marques +Date: Wed, 4 Sep 2019 17:48:39 +0200 +Subject: [PATCH] use BB_GLOBAL_CONST where applicable + +Signed-off-by: Romain Naour +--- + coreutils/test.c | 3 +-- + coreutils/test_ptr_hack.c | 2 +- + include/libbb.h | 27 +++++++++++++++++++++++++-- + libbb/lineedit.c | 3 +-- + libbb/lineedit_ptr_hack.c | 2 +- + libbb/ptr_to_globals.c | 2 +- + shell/ash.c | 13 ------------- + shell/ash_ptr_hack.c | 6 +++--- + 8 files changed, 33 insertions(+), 25 deletions(-) + +diff --git a/coreutils/test.c b/coreutils/test.c +index 8d7dac025..e1d440106 100644 +--- a/coreutils/test.c ++++ b/coreutils/test.c +@@ -400,8 +400,7 @@ struct test_statics { + jmp_buf leaving; + }; + +-/* See test_ptr_hack.c */ +-extern struct test_statics *const test_ptr_to_statics; ++extern struct test_statics *BB_GLOBAL_CONST test_ptr_to_statics; + + #define S (*test_ptr_to_statics) + #define args (S.args ) +diff --git a/coreutils/test_ptr_hack.c b/coreutils/test_ptr_hack.c +index 5ba9dcc68..6759b2144 100644 +--- a/coreutils/test_ptr_hack.c ++++ b/coreutils/test_ptr_hack.c +@@ -18,6 +18,6 @@ struct test_statics *test_ptr_to_statics; + /* gcc -combine will see through and complain */ + /* Using alternative method which is more likely to break + * on weird architectures, compilers, linkers and so on */ +-struct test_statics *const test_ptr_to_statics __attribute__ ((section (".data"))); ++struct test_statics *BB_GLOBAL_CONST test_ptr_to_statics __attribute__ ((section (".data"))); + + #endif +diff --git a/include/libbb.h b/include/libbb.h +index 021100db1..2523fd89c 100644 +--- a/include/libbb.h ++++ b/include/libbb.h +@@ -338,10 +338,33 @@ struct BUG_off_t_size_is_misdetected { + #endif + #endif + ++/* We use a trick to have more optimized code (fewer pointer reloads). E.g.: ++ * ash.c: extern struct globals *const ash_ptr_to_globals; ++ * ash_ptr_hack.c: struct globals *ash_ptr_to_globals; ++ * This way, compiler in ash.c knows the pointer cannot change. ++ * ++ * However, this relies on C undefined behavior, so we whitelist compilers ++ * where we know this isn't problematic, by using the the BB_GLOBAL_CONST ++ * preprocessor definition. ++ * If you are sure this trick also works with your toolchain you can add ++ * "-DBB_GLOBAL_CONST='const'" to CONFIG_EXTRA_CFLAGS or add your compiler to ++ * the whitelist below. ++ */ ++ ++#ifndef BB_GLOBAL_CONST ++# if defined(__clang__) ++# define BB_GLOBAL_CONST ++# elif defined(__GNUC__) ++# define BB_GLOBAL_CONST const ++# else ++# define BB_GLOBAL_CONST ++# endif ++#endif ++ + #if defined(__GLIBC__) + /* glibc uses __errno_location() to get a ptr to errno */ + /* We can just memorize it once - no multithreading in busybox :) */ +-extern int *const bb_errno; ++extern int *BB_GLOBAL_CONST bb_errno; + #undef errno + #define errno (*bb_errno) + #endif +@@ -2109,7 +2132,7 @@ struct globals; + /* '*const' ptr makes gcc optimize code much better. + * Magic prevents ptr_to_globals from going into rodata. + * If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */ +-extern struct globals *const ptr_to_globals; ++extern struct globals *BB_GLOBAL_CONST ptr_to_globals; + /* At least gcc 3.4.6 on mipsel system needs optimization barrier */ + #define barrier() __asm__ __volatile__("":::"memory") + #define SET_PTR_TO_GLOBALS(x) do { \ +diff --git a/libbb/lineedit.c b/libbb/lineedit.c +index fbabc6c12..b9e9719c5 100644 +--- a/libbb/lineedit.c ++++ b/libbb/lineedit.c +@@ -180,8 +180,7 @@ struct lineedit_statics { + #endif + }; + +-/* See lineedit_ptr_hack.c */ +-extern struct lineedit_statics *const lineedit_ptr_to_statics; ++extern struct lineedit_statics *BB_GLOBAL_CONST lineedit_ptr_to_statics; + + #define S (*lineedit_ptr_to_statics) + #define state (S.state ) +diff --git a/libbb/lineedit_ptr_hack.c b/libbb/lineedit_ptr_hack.c +index dc45855d5..ac33bd409 100644 +--- a/libbb/lineedit_ptr_hack.c ++++ b/libbb/lineedit_ptr_hack.c +@@ -18,6 +18,6 @@ struct lineedit_statics *lineedit_ptr_to_statics; + /* gcc -combine will see through and complain */ + /* Using alternative method which is more likely to break + * on weird architectures, compilers, linkers and so on */ +-struct lineedit_statics *const lineedit_ptr_to_statics __attribute__ ((section (".data"))); ++struct lineedit_statics *BB_GLOBAL_CONST lineedit_ptr_to_statics __attribute__ ((section (".data"))); + + #endif +diff --git a/libbb/ptr_to_globals.c b/libbb/ptr_to_globals.c +index 8ba9cd154..26d7b2042 100644 +--- a/libbb/ptr_to_globals.c ++++ b/libbb/ptr_to_globals.c +@@ -25,7 +25,7 @@ int *bb_errno; + /* gcc -combine will see through and complain */ + /* Using alternative method which is more likely to break + * on weird architectures, compilers, linkers and so on */ +-struct globals *const ptr_to_globals __attribute__ ((section (".data"))); ++struct globals *BB_GLOBAL_CONST ptr_to_globals __attribute__ ((section (".data"))); + + #ifdef __GLIBC__ + int *const bb_errno __attribute__ ((section (".data"))); +diff --git a/shell/ash.c b/shell/ash.c +index e3bbac9a0..3141f3812 100644 +--- a/shell/ash.c ++++ b/shell/ash.c +@@ -288,19 +288,6 @@ typedef long arith_t; + # error "Do not even bother, ash will not run on NOMMU machine" + #endif + +-/* We use a trick to have more optimized code (fewer pointer reloads): +- * ash.c: extern struct globals *const ash_ptr_to_globals; +- * ash_ptr_hack.c: struct globals *ash_ptr_to_globals; +- * This way, compiler in ash.c knows the pointer can not change. +- * +- * However, this may break on weird arches or toolchains. In this case, +- * set "-DBB_GLOBAL_CONST=''" in CONFIG_EXTRA_CFLAGS to disable +- * this optimization. +- */ +-#ifndef BB_GLOBAL_CONST +-# define BB_GLOBAL_CONST const +-#endif +- + + /* ============ Hash table sizes. Configurable. */ + +diff --git a/shell/ash_ptr_hack.c b/shell/ash_ptr_hack.c +index f69840825..af16cca27 100644 +--- a/shell/ash_ptr_hack.c ++++ b/shell/ash_ptr_hack.c +@@ -22,8 +22,8 @@ struct globals_var *ash_ptr_to_globals_var; + /* gcc -combine will see through and complain */ + /* Using alternative method which is more likely to break + * on weird architectures, compilers, linkers and so on */ +-struct globals_misc *const ash_ptr_to_globals_misc __attribute__ ((section (".data"))); +-struct globals_memstack *const ash_ptr_to_globals_memstack __attribute__ ((section (".data"))); +-struct globals_var *const ash_ptr_to_globals_var __attribute__ ((section (".data"))); ++struct globals_misc *BB_GLOBAL_CONST ash_ptr_to_globals_misc __attribute__ ((section (".data"))); ++struct globals_memstack *BB_GLOBAL_CONST ash_ptr_to_globals_memstack __attribute__ ((section (".data"))); ++struct globals_var *BB_GLOBAL_CONST ash_ptr_to_globals_var __attribute__ ((section (".data"))); + + #endif +-- +2.21.0 + From patchwork Fri Sep 6 09:09:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1158900 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=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="yJiFv2VA"; dkim-atps=neutral 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 46PsGN4z17z9sDB for ; Fri, 6 Sep 2019 19:10:20 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id DCC062034D; Fri, 6 Sep 2019 09:10:18 +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 7V5A1bP530GS; Fri, 6 Sep 2019 09:10:12 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 01FB420361; Fri, 6 Sep 2019 09:10:09 +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 4682F1BF2E3 for ; Fri, 6 Sep 2019 09:10:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 3E6CA87631 for ; Fri, 6 Sep 2019 09:10:05 +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 djMK4TeJwXwQ for ; Fri, 6 Sep 2019 09:10:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by whitealder.osuosl.org (Postfix) with ESMTPS id CC01C87660 for ; Fri, 6 Sep 2019 09:10:02 +0000 (UTC) Received: by mail-wr1-f54.google.com with SMTP id w13so5740388wru.7 for ; Fri, 06 Sep 2019 02:10:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IODERYyyhj1SHhUB7hr/1IjP877u7g5aHyTXigs1KaE=; b=yJiFv2VAcu9qKCW4/YfQAVTZ8QBllDvCg+eMI1nult+hMs/Ty/sboORugNSl8O4Nyo 9cwRZ1LRM901ItIZYpEk4j48ge8BCsCj9gFOPgatdACR8LoXGECDjnL9rQRtAN5pEKlE tiVuj5JQE6Q5E2a+Jz0ZIMFrBvYJKqu+dl0DQw5+jRDk08raZDULvM9xs8bej8/chIz5 5YK8DGyKT5wmALldz5I/Fjsr5Qjb3WJkttgqompqYMbyk7ZtqsxvLCg0/5/ds/n1Y5rR uC7GHyXGML8kpae6LFWs4SDr4DTkuSqrVvVAxww0CRrmUnzkfOLhAufchCbeMSpYsBNc dY4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IODERYyyhj1SHhUB7hr/1IjP877u7g5aHyTXigs1KaE=; b=Ifatkyhk5SPeeLJUBg4TPOXjuZ5gGtAMtRrn3pGY1QcgR+wLKWo0A2hoPeBWNtNA/O 2AepbRqSFJ8e+9HGWSb9QfkTx59RTEpK54y10Kf89SFWuRj9K3BrymorlnasXLkAae+D q4LMLLp2Ori1zd/rUg0DtXDrGsUCqDiY0e962nfr0nTRUMTsfS+wdLH/Lv1LLbQLYnZ2 oJ21bDnDf4DQgxOATiwb0q/4kk7oZT2LKld2yiZI38X66e+1D3xfc74n3qJ1ZVDnfalO yxtaAiw9lYVXcwj4Fpx57LnktX9nJ5RbNOJ5rj2qOVmclWyloO5papvBVvJZPf/bWhJp Mp0g== X-Gm-Message-State: APjAAAWE2SDs3dxwP9P79LNl3vZH21D00ehF3+AwlsRuP8haZa8ij5Xw gglTJOCZnth2TuokkRsY1FzGSWMjcYg= X-Google-Smtp-Source: APXvYqyp9UqMms17LfUFy6a0pfc2LvZ2RGSFj99GdZo8P+DiN0Yrci3ZAHCxqJDt24kqMdmHovCVJg== X-Received: by 2002:adf:f0c7:: with SMTP id x7mr5894735wro.2.1567761001147; Fri, 06 Sep 2019 02:10:01 -0700 (PDT) Received: from P-ASN-Evian.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id u6sm4582924wrr.26.2019.09.06.02.10.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 02:10:00 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Fri, 6 Sep 2019 11:09:44 +0200 Message-Id: <20190906090947.5476-9-romain.naour@smile.fr> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190906090947.5476-1-romain.naour@smile.fr> References: <20190906090947.5476-1-romain.naour@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 08/11] package/clang: add a host entry for clang 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 , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" In order to allow Buildroot's user to select clang as cross-compiler we need first an option to select host-clang package in menuconfig. Signed-off-by: Romain Naour Cc: Matt Weber Cc: Valentin Korenblit --- package/Config.in.host | 1 + package/clang/Config.in.host | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 package/clang/Config.in.host diff --git a/package/Config.in.host b/package/Config.in.host index 93822304e9..182e175a78 100644 --- a/package/Config.in.host +++ b/package/Config.in.host @@ -7,6 +7,7 @@ menu "Host utilities" source "package/cbootimage/Config.in.host" source "package/checkpolicy/Config.in.host" source "package/checksec/Config.in.host" + source "package/clang/Config.in.host" source "package/cmake/Config.in.host" source "package/cramfs/Config.in.host" source "package/cryptsetup/Config.in.host" diff --git a/package/clang/Config.in.host b/package/clang/Config.in.host new file mode 100644 index 0000000000..ca5d7ba678 --- /dev/null +++ b/package/clang/Config.in.host @@ -0,0 +1,19 @@ +config BR2_PACKAGE_HOST_CLANG + bool "clang cross-compiler" + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS + depends on BR2_HOST_GCC_AT_LEAST_4_8 + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_INSTALL_LIBSTDCPP + depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future + depends on !BR2_STATIC_LIBS + depends on BR2_USE_WCHAR # std::wstring + help + Clang is a C/C++, Objective C/C++ and OpenCL C front-end + for the LLVM compiler. + + This option install the clang cross-compiler and it's + libraires. It doesn't mean that's used by Buildroot + infra to build packages. + + http://clang.llvm.org From patchwork Fri Sep 6 09:09:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1158899 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=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="lrO8xi/0"; dkim-atps=neutral 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 46PsGK0SVRz9sDB for ; Fri, 6 Sep 2019 19:10:17 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D502C86A4F; Fri, 6 Sep 2019 09:10:13 +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 sZ-GNJl8mwtp; Fri, 6 Sep 2019 09:10:10 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6481B858B3; Fri, 6 Sep 2019 09:10:10 +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 6CA521BF2E3 for ; Fri, 6 Sep 2019 09:10:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6940E87631 for ; Fri, 6 Sep 2019 09:10:05 +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 xccyxSBO6ZLF for ; Fri, 6 Sep 2019 09:10:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by whitealder.osuosl.org (Postfix) with ESMTPS id BAD4C86DE2 for ; Fri, 6 Sep 2019 09:10:03 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id 30so5711332wrk.11 for ; Fri, 06 Sep 2019 02:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wILq2zUjCDZ64bUNYCO3wHPoxlfgvsqdctgTB39aH9I=; b=lrO8xi/0FYxyDF96rvNw9s9jLyS7X56k1VtlHfdJN9MWWEzvpOGaSA4iRZM0tcwoii nyriQgHflLmGR8Mn1JQTHYdm+kqzkGqi85gC/nkFcK3ltGYywCfK9sSUGsiKHMWqGgiw wony7twsXSCE39AlsHrlP/TrQllo7/HIB8EigpMiknV3ey7PWzFmODEZr0wyNa+BGpGE 3V2JTXKNP8OJEwmtFcPh04OFtoPknh3iv0LZMVdvS3Q3JSVWhS+rsJHL0sWLCJT3l65c Hi04vlU8lyuTxtsyTxDrToOoj1DfW+qYOshh8ul+QS4q52LJxWT99UBzfch3wm6X6pPm Gfng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wILq2zUjCDZ64bUNYCO3wHPoxlfgvsqdctgTB39aH9I=; b=c28mXPf73TwlHgaqO3CmXNpjW+j6Dhkd/nsgGuuJ5MxsH9nKPraFo+3xaM/0MVXsxH sIOndQgYSE8fVNbz1R5jdB2glZktJ9K6CMeZtNgozJDLa4iovEDaoYHqHLWa4qReCtlq Yu2LbhPT5Vncp4QKATjjJAKe0D2LbEqoncP6XhLuRBTh9KO/sVyMZplbYFqY2qxwetQY F7ffD6riErwfjksuNEVi3FEXNNCfu4Y1tKe+mn5sGkncTlNLgYHjuBspK8QfayC3ME0E Lk76JaK3n55q9lDDEgQ/bKD2cEFrO7RiWHRX/QzTj9uAU3Hgj84eNKzycqc6K/tSl+5n mLVg== X-Gm-Message-State: APjAAAWxbNTooC4Ey8CIGlP808Gc29c7dNChbIvrC8qrT07LS1XC8aSs ESjA7w6xl1hfK8nSzog5+jGg6z2S50k= X-Google-Smtp-Source: APXvYqxINoV7CK7gkSXcbnUaHPov52Ml2kFgI0kk8sN/FCpJrUcYYZ8cabjmQxY27kkU1lJrbio6IQ== X-Received: by 2002:adf:f20f:: with SMTP id p15mr6525158wro.17.1567761002060; Fri, 06 Sep 2019 02:10:02 -0700 (PDT) Received: from P-ASN-Evian.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id u6sm4582924wrr.26.2019.09.06.02.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 02:10:01 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Fri, 6 Sep 2019 11:09:45 +0200 Message-Id: <20190906090947.5476-10-romain.naour@smile.fr> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190906090947.5476-1-romain.naour@smile.fr> References: <20190906090947.5476-1-romain.naour@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 09/11] core: allow to use Clang as cross-compiler 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 , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Add this new experimental option into "Advanced" menu since we are expecting some build and runtime issues for number of packages (bootloaders, kernel). Add host-clang as dependency in toolchain-buildroot and toolchain-external virtual in order to be sure that the clang cross-compiler is built before generating Buildroot.cmake file from an TOOLCHAIN_CMAKE_INSTALL_FILES hook (defined in cmake package). For toolchain-external package, we can latter remove the host-clang dependency if we can import Clang with the prebuilt external toolchain. Signed-off-by: Romain Naour Cc: Matt Weber Cc: Valentin Korenblit --- Config.in | 20 +++++++++++++++++++ package/Makefile.in | 13 +++++++++--- package/clang/clang.mk | 5 +++++ .../toolchain-buildroot.mk | 7 +++++++ .../toolchain-external/toolchain-external.mk | 7 +++++++ 5 files changed, 49 insertions(+), 3 deletions(-) diff --git a/Config.in b/Config.in index a6e280b885..6e3a7986bf 100644 --- a/Config.in +++ b/Config.in @@ -711,6 +711,26 @@ config BR2_REPRODUCIBLE This is labeled as an experimental feature, as not all packages behave properly to ensure reproducibility. +config BR2_USER_HOST_CLANG_AS_CROSS_COMPILER + bool "Use Clang as cross-compiler (experimental)" + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS + depends on BR2_HOST_GCC_AT_LEAST_4_8 + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_INSTALL_LIBSTDCPP + depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future + depends on !BR2_STATIC_LIBS + depends on BR2_USE_WCHAR # std::wstring + select BR2_PACKAGE_HOST_CLANG + help + This option will force Buildroot to use Clang as cross-compiler + instead of GCC. A GCC toolchain (internal or external) is still + needed to build with Clang. + + This is labeled as an experimental feature, since we are + expecting some build and runtime issues for number of packages + (bootloaders, kernel). + endmenu comment "Security Hardening Options" diff --git a/package/Makefile.in b/package/Makefile.in index 0a7899c852..aebf4edd1b 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -200,9 +200,6 @@ endif # Define TARGET_xx variables for all common binutils/gcc TARGET_AR = $(TARGET_CROSS)ar TARGET_AS = $(TARGET_CROSS)as -TARGET_CC = $(TARGET_CROSS)gcc -TARGET_CPP = $(TARGET_CROSS)cpp -TARGET_CXX = $(TARGET_CROSS)g++ TARGET_FC = $(TARGET_CROSS)gfortran TARGET_LD = $(TARGET_CROSS)ld TARGET_NM = $(TARGET_CROSS)nm @@ -211,6 +208,16 @@ TARGET_READELF = $(TARGET_CROSS)readelf TARGET_OBJCOPY = $(TARGET_CROSS)objcopy TARGET_OBJDUMP = $(TARGET_CROSS)objdump +ifeq ($(BR2_USER_HOST_CLANG_AS_CROSS_COMPILER),y) +TARGET_CC = $(HOST_DIR)/bin/clang +TARGET_CPP = $(HOST_DIR)/bin/clang-cpp +TARGET_CXX = $(HOST_DIR)/bin/clang++ +else +TARGET_CC = $(TARGET_CROSS)gcc +TARGET_CPP = $(TARGET_CROSS)cpp +TARGET_CXX = $(TARGET_CROSS)g++ +endif + ifeq ($(BR2_STRIP_strip),y) STRIP_STRIP_DEBUG := --strip-debug TARGET_STRIP = $(TARGET_CROSS)strip diff --git a/package/clang/clang.mk b/package/clang/clang.mk index 148df8e611..674dedc746 100644 --- a/package/clang/clang.mk +++ b/package/clang/clang.mk @@ -14,6 +14,11 @@ CLANG_LICENSE_FILES = LICENSE.TXT CLANG_SUPPORTS_IN_SOURCE_BUILD = NO CLANG_INSTALL_STAGING = YES +# Allow host-clang to be build as part of the toolchain +ifeq ($(BR2_USER_HOST_CLANG_AS_CROSS_COMPILER),y) +HOST_CLANG_ADD_TOOLCHAIN_DEPENDENCY = NO +endif + HOST_CLANG_DEPENDENCIES = host-llvm host-libxml2 CLANG_DEPENDENCIES = llvm host-clang diff --git a/toolchain/toolchain-buildroot/toolchain-buildroot.mk b/toolchain/toolchain-buildroot/toolchain-buildroot.mk index b30cc332d2..da10ee2662 100644 --- a/toolchain/toolchain-buildroot/toolchain-buildroot.mk +++ b/toolchain/toolchain-buildroot/toolchain-buildroot.mk @@ -12,6 +12,13 @@ BR_LIBC = $(call qstrip,$(BR2_TOOLCHAIN_BUILDROOT_LIBC)) TOOLCHAIN_BUILDROOT_DEPENDENCIES = host-gcc-final +# Make sure the clang cross-compiler is built before +# generating Buildroot.cmake file from an +# TOOLCHAIN_CMAKE_INSTALL_FILES hook. +ifeq ($(BR2_USER_HOST_CLANG_AS_CROSS_COMPILER),y) +TOOLCHAIN_BUILDROOT_DEPENDENCIES += host-clang +endif + TOOLCHAIN_BUILDROOT_ADD_TOOLCHAIN_DEPENDENCY = NO $(eval $(virtual-package)) diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index dd07884c7e..a7157ce7fe 100644 --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -15,6 +15,13 @@ ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) TOOLCHAIN_EXTERNAL_DEPENDENCIES += musl-compat-headers endif +# Make sure the clang cross-compiler is built before +# generating Buildroot.cmake file from an +# TOOLCHAIN_CMAKE_INSTALL_FILES hook. +ifeq ($(BR2_USER_HOST_CLANG_AS_CROSS_COMPILER),y) +TOOLCHAIN_BUILDROOT_DEPENDENCIES += host-clang +endif + $(eval $(virtual-package)) # Ensure the external-toolchain package has a prefix defined. From patchwork Fri Sep 6 09:09:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1158896 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.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="E+DVWAMI"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46PsGH10btz9s3Z for ; Fri, 6 Sep 2019 19:10:14 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id CAAEF87E5B; Fri, 6 Sep 2019 09:10:11 +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 MUb3uAqhmozP; Fri, 6 Sep 2019 09:10:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 4A5B387E5E; Fri, 6 Sep 2019 09:10:11 +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 D22681BF2E3 for ; Fri, 6 Sep 2019 09:10:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id CB13A87E13 for ; Fri, 6 Sep 2019 09:10:05 +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 4D-ballLam07 for ; Fri, 6 Sep 2019 09:10:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by hemlock.osuosl.org (Postfix) with ESMTPS id 9D33A87E5B for ; Fri, 6 Sep 2019 09:10:04 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id h7so4731942wrw.8 for ; Fri, 06 Sep 2019 02:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O8S0oKXdVEiY6hI2M/LyK+QLl/Mxb85Zx4qgQ//WtyE=; b=E+DVWAMIggLS8tkLlJ6C14YSAr84riIDrrNf+snGCC37iqmHFUjZGf8G1cS2oM3uTm /C5WF4rI3Q+bB7VQbqbUWtQp3nL4OM1zfjscKJTxN5YM4tc/zQZCFBacr+3Add4Wo0nw o6rnEyqcyt9dpt5YYWJmesJZXbhBj9Pdg1q1P7hiFJTAJ8SOVAksXgRZO8p+g8healDH 2wGWozs2lRHA4qLgA0RV2T4399ADt8UR7FZoh0fRNoOD5c4IHx8V5HL1zOfbZBfGjS9J NDM9xKOf4QkzDzuhS2jKg+hcUbz4YUEj5pNOKULU6AnbISff+/QoAsP8CoKMJmSQ4+/5 O6+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O8S0oKXdVEiY6hI2M/LyK+QLl/Mxb85Zx4qgQ//WtyE=; b=SP5jTu99jT+/fMEQGF+y1VS9XnEMrYib71WGtouumZPU8ON89f4O+miOqCvpBOiNjB u+6nrNytav3NSkF/lF5oYpdR1OHpzk3KK6ydSUvFpoiCnV/WVUNBvZ4VT7TULAtwE/wi N/NLQnag55QmIQBVAO+hipXENfy8DhafeV8Qduk1mb3839fWovu2DcIolXbxFeJ5mQEs zo7fitCENZFooQxhdfQjvoJAzLZ2FkfxMv9B6Q2UljDd8dJXua4D1e7bveOpOMw7M1xa RHrB5gTB+gQJtY8reOYRIAJuhRp4GsIQQsW5lDxRGuTEbTSaD2LEw+0hPpxTWCO3nF9v 9xqw== X-Gm-Message-State: APjAAAUKoA41L7VNHwB5Q/yoM+yQ3LDpb7+tt0o5M4k5yCbpCAUGr3H7 IiT7md/cqiy2NrtgT0ZhyEji88UNTEg= X-Google-Smtp-Source: APXvYqyentWy04WEfTTGfocZqt8ykyxHjLSyZU2aFfiYnAPD6ahyZwYumuU4W3ntdRPcY7F+taiIPA== X-Received: by 2002:adf:ed44:: with SMTP id u4mr6334101wro.185.1567761002843; Fri, 06 Sep 2019 02:10:02 -0700 (PDT) Received: from P-ASN-Evian.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id u6sm4582924wrr.26.2019.09.06.02.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 02:10:02 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Fri, 6 Sep 2019 11:09:46 +0200 Message-Id: <20190906090947.5476-11-romain.naour@smile.fr> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190906090947.5476-1-romain.naour@smile.fr> References: <20190906090947.5476-1-romain.naour@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 10/11] toolchain: add a warning when Clang is used as cross-compiler 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 , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Romain Naour Cc: Matt Weber Cc: Valentin Korenblit --- toolchain/Config.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/toolchain/Config.in b/toolchain/Config.in index bd2c547ff1..570f029cac 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -37,6 +37,12 @@ config BR2_TOOLCHAIN_USES_MUSL select BR2_TOOLCHAIN_HAS_UCONTEXT select BR2_TOOLCHAIN_SUPPORTS_PIE if !BR2_STATIC_LIBS +if BR2_USER_HOST_CLANG_AS_CROSS_COMPILER +comment "-------------------------------------------------------" +comment "Clang will be used as C/C++ cross-compiler ! " +comment "-------------------------------------------------------" +endif + choice prompt "Toolchain type" help From patchwork Fri Sep 6 09:09:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1158898 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=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="N5NKIngW"; dkim-atps=neutral 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 46PsGJ4wVNz9s3Z for ; Fri, 6 Sep 2019 19:10:16 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D6DE486A97; Fri, 6 Sep 2019 09:10:13 +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 cLm6rwuJUCC8; Fri, 6 Sep 2019 09:10:13 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4C85186A54; Fri, 6 Sep 2019 09:10:12 +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 407541BF2E3 for ; Fri, 6 Sep 2019 09:10:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 37DF88697E for ; Fri, 6 Sep 2019 09:10:07 +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 A8xIV6c7GphM for ; Fri, 6 Sep 2019 09:10:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 9B9B0869C0 for ; Fri, 6 Sep 2019 09:10:05 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id y19so5762999wrd.3 for ; Fri, 06 Sep 2019 02:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gtz1N110jiyseyZgLv/PyBg6XNusxbGf+DJGACyepPY=; b=N5NKIngWlynzOXw9rxzPmhnccPW96ANNGA8478zYiZju7VTT4jL4nqk1d3KJMeXP2h WJJkB1ePWObUhTp7Qa2o4JBJysEWxrhSjcngn80w5P25gAIbsNVnsAQfm4DhCrg8X1ID v9GE9bzhepMlbJ/Zly+WLlzVczOdXoEjRq7LcF8rvMUk9+vzNctJ4nJR2RCVIGEnu062 qPcHnAHKZ9s30tzPqz9QwUDavF6LhI90ZnnRO4249NRIiHFr3Mtdj1rmLvBLVJhQBkww ssDWdZbI6vQ24YQbo6X36UebirGhwZ5YvHlGSRtpB6CQIubQMfhPHvhDRQXAat+sJpY/ z28g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gtz1N110jiyseyZgLv/PyBg6XNusxbGf+DJGACyepPY=; b=I1vnvG1sUAfs9+uAZAUnQbV34ouIZHUXmoJHDjOoiuz1tc/O9/3PQ39nTEjbTOmTRs n2MH77H8xEJAd5ZPMBNmx5GBgLT78pKKO/ABe7QisiBGot7/ROkllM7FVPf1qa1H0Kgu u7qPwSa5NIlNDUacPLW3+MozXNxH0LisUGlsSE+OzEL4pTtrdzLYKUrvae/wSXt+6N4W vg3qjbQUANAOokf1hm0nF/RrQPIakx4B4kaHprKLU4O9eO3GkmIAonfVK8L1R3vdE6nd 3Ktb/faGnFjC01llJ15t6CsVolFGo97sp5uMZb374wJxq+uTR4jf+4gnFFXHX/le0Tbh ynNA== X-Gm-Message-State: APjAAAWGBCyBn2WUKtblUB+RJkt+0L2UtovAa8aWMLQpND1eaVn0AI8E sSl9ygppmnNVEr/gFnNr5TqgSPv3u88= X-Google-Smtp-Source: APXvYqxe75JmPduyIiU1jlt4FlVK+4rOsdkEEAdBnUP6cSE5ZbRrClMhrwKP9bDCQ3+mReQyNSgwFQ== X-Received: by 2002:a5d:4405:: with SMTP id z5mr6195257wrq.158.1567761003991; Fri, 06 Sep 2019 02:10:03 -0700 (PDT) Received: from P-ASN-Evian.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id u6sm4582924wrr.26.2019.09.06.02.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 02:10:03 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Fri, 6 Sep 2019 11:09:47 +0200 Message-Id: <20190906090947.5476-12-romain.naour@smile.fr> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190906090947.5476-1-romain.naour@smile.fr> References: <20190906090947.5476-1-romain.naour@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 11/11] linux: don't set -Wno-attribute-alias flag when Clang is used as cross-compiler 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 , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Clang stop the build due to -Werror and -Wunknown-warning-option: error: unknown warning option '-Wno-attribute-alias'; did you mean '-Wattributes'? [-Werror,-Wunknown-warning-option] Signed-off-by: Romain Naour Cc: Matt Weber Cc: Valentin Korenblit --- linux/linux.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux/linux.mk b/linux/linux.mk index d381c96d85..93d80d85e6 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -145,7 +145,8 @@ endif # abusing those aliases for system call entry points, in order to # sanitize the arguments passed from user space in registers. # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82435 -ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8),y) +# Clang doesn't support -Wno-attribute-alias +ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8):$(BR2_USER_HOST_CLANG_AS_CROSS_COMPILER),y:) LINUX_MAKE_ENV += KCFLAGS=-Wno-attribute-alias endif