From patchwork Thu Feb 7 22:01:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 157782 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1200739jaa; Thu, 7 Feb 2019 14:02:33 -0800 (PST) X-Google-Smtp-Source: AHgI3IZQa8+/FzIGr/m5whrLZ2IJ5cBNWZk8ZtjPGLwarksWis8ho+/9jg8YoITNQ5rF/btz7OMg X-Received: by 2002:a17:902:8ec8:: with SMTP id x8mr19032715plo.210.1549576953176; Thu, 07 Feb 2019 14:02:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549576953; cv=none; d=google.com; s=arc-20160816; b=vdgj2EbzQ54lpNlazt0hdtfwS1c03YansehK36DseOnzx7JeCJjmQtMqQ0iflAaVx6 qtMkOiCJeGu++y44vFIS2AJajz9rNyPMXNIv5JU9JtRUY/7Rvo18Kql9i8DMOTKep1Qb Opg2sSXHVNWps4zBLAQWoIw6eXAXWgsgx/p6Tx4We7seGL3fLl778XTH64eAlE6M7koL oK8wKDxQ9hd+AxnVAc9c97D9+QkR1v/C/URPF4oAryyaSj2iLeGiKSYX8PEWfVi9LLyP l23J54ywgdhB4T/V6uJW9RjK/nhl/BgrwT8gc3+NgFSQ7naY//KayjKHGsk9lUC/d3qK SmYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=MqLuibBHajEelET2gmxRQFU5+ervUm+M6PMMM0jIz+k=; b=Qe0FVok3wN16knfRSokFRsYGyIghBxXAkejKnZsDNcMZ/oM000YcUeinqB/PcFnBH1 RkfZe4Rl11oMw2s5a5Qvq3kc9EmK2yUbXcBa3VHvdYSKv3QwYY9oMOMerKKSpT92Uq2U yi3MuGY+v++f/gEY7gmalL/XXyTXvTOVskhwieN9C9RqEKJtQLIJRozTNzoh+SoRPVn6 TFH+10E37Y67+OfIrlU6j+ODpFPpRHmpP95b9RZXBEP3j+Y9OruaYZzMFYn6qaFHP3YT yPQxhkQek2PFVL/hnHZT370XosxIENZCLGzKU58S0EQsrM5QFtorLyg5cm8Q2ly6X96b bCqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NjzqXAPv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5si165606pgr.33.2019.02.07.14.02.32; Thu, 07 Feb 2019 14:02:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NjzqXAPv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727083AbfBGWCb (ORCPT + 31 others); Thu, 7 Feb 2019 17:02:31 -0500 Received: from mail-it1-f202.google.com ([209.85.166.202]:41080 "EHLO mail-it1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbfBGWCa (ORCPT ); Thu, 7 Feb 2019 17:02:30 -0500 Received: by mail-it1-f202.google.com with SMTP id 71so2301150ita.6 for ; Thu, 07 Feb 2019 14:02:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=MqLuibBHajEelET2gmxRQFU5+ervUm+M6PMMM0jIz+k=; b=NjzqXAPv2Gw8MbNmaKl8Irqy4dtdTyhJaKdWzaw4RP1C7HT2CI16fy8ualj7GapIKe xUFEeAmjG0112J8IFKsNdet7r3fKZ0/bKmkZJHuesmNFEmJbrRdmF5gK4Gn3ciG/rDEP ZWZ2JVO7WQqtuTlFrvinw01+LGNXX2gGOvPmc5TDylF1MGJNGuX8jVtQt9NbjtztdFGX uBhO1DP9kUuWcl7gGnTRZH9wV0K0p7K6Q2GgsBnlsS2NMW8P/+Wpk+PbF2ld1SxoojoB fX9y4ed58VzKk/6+uFwRM5nsRpzZAJ5V5vQB2Bs9C+nm8a//QWSJ+dqZRKHF4Wc3jB34 yM0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=MqLuibBHajEelET2gmxRQFU5+ervUm+M6PMMM0jIz+k=; b=VqC6P0XE2H7WL2XaBV7BvOSdyXLuW1EuGJqJKjPJRGsVYad5YsWi2gZv5vNXnvI4Tl lN88DXSeI4q/9zPiy3DOh436DhjK/wRaw9mkc5iOUTFTJXPCKrLew85tHrqxFJbjJmS6 rcFTVtHdjv5x5zMKyHCtxRCRoiYA/CTMzsyw8THuFKWVl/xAGbPfZtzNiuyRTmkoxaOq EjBS4kdZeR6ceB+Jz63PVAp7wjEpSuzMIuTiDIO/lFfK7NkDS1chUf4aQbARXec49IQx IoRhrO4y0dOEitBm8ukbEPk7hvVHSLYjgMJu5A4Gy9YqhdsCam3GCq6lpKXvTKDkiYjd wDRQ== X-Gm-Message-State: AHQUAubhyl2WiKqakY1cG+sD74C6eHWB/21UeD2hTOynoNc0x21D7hxt wFxmAPjdt1EXQMm8iKNEvUIvDM/VRFTGJkVD6P0= X-Received: by 2002:a24:5e90:: with SMTP id h138mr7648078itb.27.1549576950026; Thu, 07 Feb 2019 14:02:30 -0800 (PST) Date: Thu, 7 Feb 2019 14:01:49 -0800 Message-Id: <20190207220155.81351-1-ndesaulniers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.20.1.791.gb4d0f1c61a-goog Subject: [PATCH 1/4] init/Kconfig: add config support for detecting linker From: ndesaulniers@google.com To: yamada.masahiro@socionext.com Cc: Nick Desaulniers , Nathan Chancellor , Sami Tolvanen , Andrew Morton , "Peter Zijlstra (Intel)" , Johannes Weiner , Kees Cook , Dominik Brodowski , Nicholas Piggin , Mathieu Desnoyers , Vasily Gorbik , Adrian Reber , Richard Guy Briggs , linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Similar to how we differentiate between CONFIG_CC_IS_GCC and CONFIG_CC_IS_CLANG, add CONFIG_LD_IS_BFD, CONFIG_LD_IS_GOLD, and CONFIG_LD_IS_LLD. This simiplifies patches to Makefiles that need to do different things for different linkers. Cc: Nathan Chancellor Cc: Sami Tolvanen Signed-off-by: Nick Desaulniers --- init/Kconfig | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.20.1.791.gb4d0f1c61a-goog Reviewed-by: Kees Cook Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor diff --git a/init/Kconfig b/init/Kconfig index c9386a365eea..b6046dcf7794 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -26,6 +26,15 @@ config CLANG_VERSION config CC_HAS_ASM_GOTO def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC)) +config LD_IS_BFD + def_bool $(success,$(LD) --version | head -n 1 | grep -q 'GNU ld') + +config LD_IS_GOLD + def_bool $(success,$(LD) --version | head -n 1 | grep -q 'GNU gold') + +config LD_IS_LLD + def_bool $(success,$(LD) --version | head -n 1 | grep -q 'LLD') + config CONSTRUCTORS bool depends on !UML From patchwork Thu Feb 7 22:01:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 157783 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1200897jaa; Thu, 7 Feb 2019 14:02:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IaRnAm9Wf+GgmS3yG6BssR6n9V2B0NsLoaTqVrIlD+6forRih7fzrZEuT8penXZS3x1eJWk X-Received: by 2002:a17:902:8686:: with SMTP id g6mr16727193plo.149.1549576962528; Thu, 07 Feb 2019 14:02:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549576962; cv=none; d=google.com; s=arc-20160816; b=h9pWi0l5X4ss/+G+0E40HJf4Lnpyfoq7cUkoLSpckNZQ4sMcWW0sR7A2/1JYpOYZFH EmjM/w7n2msUH9t9HOtG81J78EAh1XjW0GvaUOcGN0LllUPmlRugj1sQuYx+Iz+XpmRI clFliGaLCScJCBCHreHrGY0egQ8Z5mdWoKIx+LIwV1jErF76jFGvBfIre1EC6iqhATIM nTnbWh5k4LdAVO4DuJ5YfFGKU5WvOVF1aFlMa/pFiEFXxoDaacgQEk89pvLGdkACDDPu X1r3Eo7okiKL55cPg6cWRhyOObBweb/T6puFAwpEnmPF67bY8DMlg1m3sdHQ1ea+5nvX HXLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=K0M49omsRwIKeW5zWET20jPe2lVNAfQ5m7GbqMaJYbE=; b=XOjf7XnQcb0Vt+c6fu50Sd+ptcsNWt71a0FLjQom6nSeuVVFuk9bK7ECNxWQLlRWRy YPRbNtcBSD3DufCIteh48x51pyvOSCA41jLI0ivn+8CZg1kdRTPoIJuE15Lkvl1P+Eiv 1P+6ZeKcZxCAvjEKm9sIViVVkdmBj45b+zudZ3VNKHzp3oc8adRm8vfJZwzzVYZ0ajfS lYTxWc3wO+eWr4VWu+cgEjqigqzydBFYf9wbifQSEm1Wce6ZYkhsIrWSvuUsPMnYmQ5L S3AL2Wb+9LyyKs3vhNYZxXbnRoUaQOLAB5HaaWAQBIGIt7cKS1trjw0aOU7F+4PEeKVv NfHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hoBwgSPC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g63si185486pfc.60.2019.02.07.14.02.42; Thu, 07 Feb 2019 14:02:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hoBwgSPC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727120AbfBGWCk (ORCPT + 31 others); Thu, 7 Feb 2019 17:02:40 -0500 Received: from mail-it1-f201.google.com ([209.85.166.201]:55447 "EHLO mail-it1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727085AbfBGWCj (ORCPT ); Thu, 7 Feb 2019 17:02:39 -0500 Received: by mail-it1-f201.google.com with SMTP id j3so2441961itf.5 for ; Thu, 07 Feb 2019 14:02:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=K0M49omsRwIKeW5zWET20jPe2lVNAfQ5m7GbqMaJYbE=; b=hoBwgSPC4iUGIYLp/p9AbVZY/vdXNqM0t+kVb0+ZzI9CXouraAjcLv2JerIIQj8+Vj djaCunPvOWlH/OoZy9uRACSwhgsh3qzqazg1KqsteXq52nVsSbqOp9OfgCZz3y/ADaR5 BDSu3oYzWzcr+L5xhPhhaPa/OE9Lo/PbeHijtn7Pp470SZKoVIyPzFxy11y95Q5FTWeC FFJ8iIMJLX5FfaZ/l0bk9X8DYMSTvIEOjraQnqq9q9HHT2pMmm4JJTnS1Q3Ds9n43JiD /vfFJz/9zEO1quFrZz2p32oAT3tjf3T/uI33mUoVXIEEoCt+jcRIckLEFz+/kbgHO97P mgbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=K0M49omsRwIKeW5zWET20jPe2lVNAfQ5m7GbqMaJYbE=; b=QiON6AxjlT+KMJgLRFHmtJHLlKbukAS5QEK4dKxtf1reJowPV/9z/3AcpMfuaJ0qln mIsAanBOqNyrV/ju7ndhUEp072dsKnP8mT5accSBHxBDBcU5kQMgs3AUGCr8cTqU8iT5 iTDTdH1mpou3FUiuZpSe2Xwy0fVhhBp66EmCkNEY7Uku2t3v4wU34bbiVL3FY22vI1I/ EFSNCexRFjbezpMzB+KIVvpKLqTKHuqfOBn5KbP+jD/sfaZOkFYujrIgbVcRYIvhdAds AA70chuFjVcR0Bc1cmYxWQwfwUh7hPuFlLCpFfqmW88fnEJoFzUiNTmeMr1divsAjwDO LJ9g== X-Gm-Message-State: AHQUAuZiIz3cfuh11EkOoCju3vsimXoEhgHPrZbiqWUoGrIpMWZusAGX a+GY/G8Jsmhq9y4edk/PBjn4Ytcwit8pBrPtGSU= X-Received: by 2002:a24:3653:: with SMTP id l80mr7872820itl.3.1549576958955; Thu, 07 Feb 2019 14:02:38 -0800 (PST) Date: Thu, 7 Feb 2019 14:01:50 -0800 In-Reply-To: <20190207220155.81351-1-ndesaulniers@google.com> Message-Id: <20190207220155.81351-2-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190207220155.81351-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.20.1.791.gb4d0f1c61a-goog Subject: [PATCH 2/4] Makefile: clang: choose GCC_TOOLCHAIN_DIR not on LD From: ndesaulniers@google.com To: yamada.masahiro@socionext.com Cc: Nick Desaulniers , Nathan Chancellor , Michal Marek , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This causes an issue when trying to build with `make LD=ld.lld` if ld.lld and the rest of your cross tools aren't in the same directory (ex. /usr/local/bin) (as is the case for Android's build system), as the GCC_TOOLCHAIN_DIR then gets set based on `which $(LD)` which will point where LLVM tools are, not GCC/binutils tools are located. Instead, select the GCC_TOOLCHAIN_DIR based on another tool provided by binutils for which LLVM does not provide a substitute for, such as elfedit. Fixes commit 785f11aa595b ("kbuild: Add better clang cross build support") Link: https://github.com/ClangBuiltLinux/linux/issues/341 Suggested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1.791.gb4d0f1c61a-goog Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor diff --git a/Makefile b/Makefile index 3142e67d03f1..0eae4277206e 100644 --- a/Makefile +++ b/Makefile @@ -492,7 +492,7 @@ endif ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) ifneq ($(CROSS_COMPILE),) CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) -GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) +GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) endif From patchwork Thu Feb 7 22:01:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 157784 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201003jaa; Thu, 7 Feb 2019 14:02:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IZki8vFYWUc0izp24GobsSrXBkba4SFKXdGNwrwMkeEzqozzqVxPSgokoryOFFLjufDm236 X-Received: by 2002:a17:902:a5c3:: with SMTP id t3mr18657410plq.117.1549576969411; Thu, 07 Feb 2019 14:02:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549576969; cv=none; d=google.com; s=arc-20160816; b=0HXBcXSEI9E6rWQ0l+DkKoLLbdJEowEJCCzhB3qcEsFWnyDLWVqXC/2vVLoeKZw6XU w74GnDTzZn4kkN+JXgCmMhwD0zJnKQY9OneWbD7DBn0+E3Nz+Kb/FJjbaQrstj1z/Zql v6mwNZMS8T+2zOxmZqjlbLTD3+K3fdgfoO3H4L+kMGoBzlyhF77AYAkzry+W89lJRnVF iebxuQajecb8vqW3qhuJv0a30M1t2r/33voYfrmoU/24ZmBNNgyFxH5orgb9g5jTON0r 32Jngu7dTWih0UMqoKfaC3UVcyJonDK6lf62IagNgJsDdXV15zYhK9AFqiRjuDSzr0Oe Ibyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=eegGQ+TDUvyP04r1vddWpgDCV6euPHpHx7dZx3qsf9g=; b=X6aRYtdQxSYbM0zJsstML88BUEwhWZOGyGBdETdwG4IXWzOWdCNYa+QbJA4zmtaPrP z5QbnV/7EeMxeAOAG1FW07Og+HvSgmTDPqBo/K0Bu7EY8MRTW9en24pna/5ChQgxJFeU 94Kkur19FxZ5BjgyUkoWpBJ/Fttv/WuWlg3EEqZZsMpClqiZJNvZ+1YTC63R1n/j16a2 kyhiMGjNK9unYijj9QaD5EI7x6NyZiL4Vs69oNWp4iQIjeatKJltT7Ha7HbV/h2DlvJO dmhoPEmHkLDoARVkj0muh/d+/v7smsaQpsdUToncaufUiPz7MClZ8CTagK79y53pa8RP bVOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=r70SoXyb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si186044pgv.24.2019.02.07.14.02.49; Thu, 07 Feb 2019 14:02:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=r70SoXyb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727141AbfBGWCr (ORCPT + 31 others); Thu, 7 Feb 2019 17:02:47 -0500 Received: from mail-it1-f202.google.com ([209.85.166.202]:59703 "EHLO mail-it1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727085AbfBGWCq (ORCPT ); Thu, 7 Feb 2019 17:02:46 -0500 Received: by mail-it1-f202.google.com with SMTP id t143so2386708itc.9 for ; Thu, 07 Feb 2019 14:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=eegGQ+TDUvyP04r1vddWpgDCV6euPHpHx7dZx3qsf9g=; b=r70SoXybzoOCIkWu2j8mHZU8g0T5YQAGdrIRivO7Fturw9VJMugfsd1neIGkdH7Er1 dyAjuZyQputIMHrZBXJ29KnbhRagGBiey30mdOvY4OMmAuZMQvjYODVqZeO8iF48xIzG rBhUba+pAiojFj7gUgxP41P3WBpF/SfwrlP+RksQ0LyoidZEBUZQApvdpSMGATUEtewi B65bDNa5b53iEYCsysInHQAOb6b2bDc9Pong9Gm1o6rFjz/K1yWrV+98YVsTsRkTs3Dl jYASom8/BBGx3ldWHLZOPusu71rPUZrStAB4tVtTsAEP9rZW8oOcA4et2Jp8YpV3DUjh XNQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=eegGQ+TDUvyP04r1vddWpgDCV6euPHpHx7dZx3qsf9g=; b=rPd1k3eFXxb0gwE2BDuets0GyHXC6B067L4EHprnqZHU2emdwl+q4YyfPTR9Z34ndD xV/FSEf1ipcZdpheorcTXioTQAQnE5oOL1hS5eKkCxKGrCQGBkh5ocsdhZCHcFkANc9z MF9yPgwB1cmY8/a1aFpXIk/opKvMceP4yHBqHPME4p40i0U48c3gl8qtMcyJuG7ml81b zwQ/bJxvT3Wz4GI4uBprLP2INywc+9m4ONGgmuNMvIAMV9gVzmu38XHzHkoV6tFi1ypl s+lkq8Ydt+b4RvLiSJ5ZTgoNNT2d5Xa2GHAHE6jMChoMaY0wcnQAh5TGgFlZ3rxHBDXk 0fBA== X-Gm-Message-State: AHQUAuYXhAY5596ICKWS15/uhVldGp69bMfQSrbpY4mH3actZVDIOp2k 7mmWGcvCO4XPAHRl+w3YjBz4RdTerz3UTosQh/8= X-Received: by 2002:a24:248d:: with SMTP id f135mr7815646ita.36.1549576965962; Thu, 07 Feb 2019 14:02:45 -0800 (PST) Date: Thu, 7 Feb 2019 14:01:51 -0800 In-Reply-To: <20190207220155.81351-1-ndesaulniers@google.com> Message-Id: <20190207220155.81351-3-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190207220155.81351-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.20.1.791.gb4d0f1c61a-goog Subject: [PATCH 3/4] Makefile: lld: tell clang to use lld From: ndesaulniers@google.com To: yamada.masahiro@socionext.com Cc: Nick Desaulniers , Nathan Chancellor , Michal Marek , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is needed because clang doesn't select which linker to use based on $LD but rather -fuse-ld=$(LD). This is problematic especially for cc-ldoption, which checks for linker flag support via invoking the compiler, rather than the linker. Link: https://github.com/ClangBuiltLinux/linux/issues/342 Suggested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Makefile | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.1.791.gb4d0f1c61a-goog Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor diff --git a/Makefile b/Makefile index 0eae4277206e..6307c17259ea 100644 --- a/Makefile +++ b/Makefile @@ -502,6 +502,9 @@ endif CLANG_FLAGS += -no-integrated-as KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_AFLAGS += $(CLANG_FLAGS) +ifneq ($(shell $(LD) --version 2>&1 | head -n 1 | grep LLD),) +CLANG_FLAGS += -fuse-ld=lld +endif export CLANG_FLAGS endif From patchwork Thu Feb 7 22:01:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 157785 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201166jaa; Thu, 7 Feb 2019 14:02:57 -0800 (PST) X-Google-Smtp-Source: AHgI3IbUhRZ/tbYAWD94hIMiH/zOOsvuJxaRLTye7A/7oSSnMHfqHolUE+ky1grjiDNYL6ydyggC X-Received: by 2002:a63:2d46:: with SMTP id t67mr17339529pgt.140.1549576977326; Thu, 07 Feb 2019 14:02:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549576977; cv=none; d=google.com; s=arc-20160816; b=qnEgwU/cneWSiguir5YwCbjgTWtCGmFj+aUu4YhIj/FJzkRfL3Bfz2Oqy5wcKk/FH0 vs8pzOBZ0ojedL8yAuQMQmMRm8K5QCrwVcC39O3+UlKe5IbTZqWZv9pcWYvf3XCX1htN RfzWzkSsb70bux6hOQOCehscgczmZMEB5zeX6W5UzDsJdHqU1MmDLWiIIdxq3A116d8L D1QcTNKc/05dTbFdUfwhFc6bDjmtMz/aikjZE9YYKQZK1PLkPBqyf9QIcPDxsDOxJWjZ J7FjnstseAw+r4HqDIu6Dj4jhU7yUZoWjR6Xe168ALkm/g93d2A76Q2NRCS2zjljYHjI 9R+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=o+AJ8QXrg2DBnZGy5ZK6HlHEP2OPjBoRWVCrnuFEEho=; b=VkzJXo5fO37kCdkq1xWORu18ASBDFDqed0z8vw3ZTHT7C0FEv1iQ09UbyEubHHbwsW Z4jG3KUDyM6q9ZFUaX2OturarV56K4Xc3n0xGYLrq0/Iok0ckmf4RjJuU6hrWTL6SjNm a4S1WkuwVN/1m5Jk4aoHj4YrRKKz6+K54glhDj4OKE+hwYI5bq9KRAvq4G89U5sRvzDq 5wdKorWVFqjvr4zmc55HnBgBLaaljskuXUJFyOFi6tTOVC674OKCCpMtaNs1WJrwmECE yzJT6lHSO+VOfvh1bi15pX0+bB+2dnJF9EsXC4Ac2viK/BAzAnhA07lA61Lw4a6kpMXG ljtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hT0sOTj7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z67si153559pfb.268.2019.02.07.14.02.57; Thu, 07 Feb 2019 14:02:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hT0sOTj7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727191AbfBGWCz (ORCPT + 31 others); Thu, 7 Feb 2019 17:02:55 -0500 Received: from mail-qk1-f201.google.com ([209.85.222.201]:43184 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727174AbfBGWCy (ORCPT ); Thu, 7 Feb 2019 17:02:54 -0500 Received: by mail-qk1-f201.google.com with SMTP id z126so1388603qka.10 for ; Thu, 07 Feb 2019 14:02:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=o+AJ8QXrg2DBnZGy5ZK6HlHEP2OPjBoRWVCrnuFEEho=; b=hT0sOTj7b3PLD8UwlhjluEWCgaUqFcwBupSFo+rIsarXYKEEWRH8u5FdyH7Xyl9LMI BzEnQsTHoKZJRQxb6hXGp7lQh0jmZm3p0FYgvxRFytFo6ty1cwfFm3I+I4L4j+PNQH3a gz33UvMVgKqYwpyW7oeYb8bcxcbe+sOBeFgWf5nnPwdONZq/izCL3HqA4tP4mhgnqGAq se5QlTXVg+Jfy5sonuqLJR4zqRK768Pt6ayAIESLzTLDpKkHDCxl1BGzCjwCOHsVcQfN RR8BQfIeBGdlTq30stNQ0Oi8PfTYdErpUaW/zDoFT+nFtJGLGkHwP73oPrd4SRZzqhLI dKWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=o+AJ8QXrg2DBnZGy5ZK6HlHEP2OPjBoRWVCrnuFEEho=; b=qstcMYN0NtGEHUTffHYmohaPqcgZntJPo8T755339nlkMsC5WrpXJJWy7Pba8xf7rp HKkyV+p1IN/vrNKqM2a5klX64Re17YeN8UIWK1tYlBCrlnabTAdN/hGiTtLoVPnuvgr2 W+gJsQbZsAt1JG40o2mHTQdqU6jtTm4laX9OgxR9p/2uFG6YBV6pBmu2kdZZb3fWwCUe 0Qd3izQSCH7+m0qZDoa7hDkWiPgjYu7/ZnOwudR+56zCwqz5gSmY+if++BfZfunu9CZp IUl0FvdYv7cd8CNsZJaLMY7pYNyouT+c6YMdmagouROq/xkh0q01FBIScgZhdsbYM20T 2iPw== X-Gm-Message-State: AHQUAuZfljyP4f15rkaFB7UP9Np6DWGxorw+Bw1z6FXKrHUIZISYxa05 5rNsZmeGR6WE8d5xPi8Nc4lSZHmSzzou2+N3iJw= X-Received: by 2002:a0c:b0b6:: with SMTP id o51mr10787701qvc.40.1549576972858; Thu, 07 Feb 2019 14:02:52 -0800 (PST) Date: Thu, 7 Feb 2019 14:01:52 -0800 In-Reply-To: <20190207220155.81351-1-ndesaulniers@google.com> Message-Id: <20190207220155.81351-4-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190207220155.81351-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.20.1.791.gb4d0f1c61a-goog Subject: [PATCH 4/4] Makefile: lld: set -O2 linker flag when linking with LLD From: ndesaulniers@google.com To: yamada.masahiro@socionext.com Cc: Nick Desaulniers , Rui Ueyama , Nathan Chancellor , Michal Marek , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org -O2 enables tail merging of string table strings. For arm64: 0.34% size improvement with lld -O2 over lld for vmlinux. 3.30% size improvement with lld -O2 over lld for Image.lz4-dtb. Link: https://github.com/ClangBuiltLinux/linux/issues/343 Suggested-by: Rui Ueyama Suggested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) -- 2.20.1.791.gb4d0f1c61a-goog Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor diff --git a/Makefile b/Makefile index 6307c17259ea..c07208ec49d4 100644 --- a/Makefile +++ b/Makefile @@ -718,6 +718,10 @@ else KBUILD_CFLAGS += -Wno-unused-but-set-variable endif +ifdef CONFIG_LD_IS_LLD +KBUILD_LDFLAGS += -O2 +endif + KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls