From patchwork Fri Nov 3 17:11:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10040895 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 389E3602D8 for ; Fri, 3 Nov 2017 17:23:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F5212971E for ; Fri, 3 Nov 2017 17:23:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13F892974D; Fri, 3 Nov 2017 17:23:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A48C02971E for ; Fri, 3 Nov 2017 17:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=SCex2aJXLsp50mkpxpVGCBO9m9+BqLql3dEP5Jq82Io=; b=JDWCiiOvEG9fT8+z7c84g8eUJx RdlTeT0HItOxTPPGyRgGaxeUHr+zrjvvYifySO6wFSPbv6nHbX1PMKG8DdmDQxCqTB86eCqKPz2qB JnPlu6KaUkHl3DoZAwKwrQl7n/bFQ4vsMvjIl7ZqyE7LmlVFm6A/Hxteg+UH1rM5wpKsL78r4Ms5A vzybn29Q3ADsoWLiTeI541vMR0KNrt2M8FeKySjjRmRMOArM7Gdc5sM/UkiFduciRA0zBLUm9O/pw AP4G42/zs82IFPXB++KAEyMU5Ht0S7zlXbi8sivZXaT2U7cYdxZFiS2v2SvmuQCiG/+69gkrblAN7 Mu14oDoA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eAfh8-0001rE-RV; Fri, 03 Nov 2017 17:23:50 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eAff6-0007HN-Dq for linux-arm-kernel@bombadil.infradead.org; Fri, 03 Nov 2017 17:21:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=b//fb4fKydF7hr4NvxBAp7IwjG0lbTcPaOydomufYh0=; b=Zz3Jx1sV2jXsEXSXJC4Zi3Q43 75RxN7pgaRQmod3LV4EjdXx+yWCDrfQQ7Wo0CcRnoX6G31enhJZSAV9/IGwHBJdY95gIFJb4hPuGv RYzMGBBTqyzaphYA8jR/aybtqU19uDwFM96m7BX9RpCusttktGm6OtW20P2910ZfcM+bBGYcFCCgx GCn9NXm1oHxmB36++NSCWy4ug3CbhwS4OpPPBTLtU76sN+qNo+Casp7ST/2Nq+F37pyk0vaNEZmw6 os3VLnd8L+mC03qKi4jEu1AKIcrfMlh8xFTDbbSeekCS04HwxvVwLs28/viZUrLxgD5gZM2McSJDa vml35o6xg==; Received: from mail-io0-x243.google.com ([2607:f8b0:4001:c06::243]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eAfWg-0003sJ-CV for linux-arm-kernel@lists.infradead.org; Fri, 03 Nov 2017 17:13:04 +0000 Received: by mail-io0-x243.google.com with SMTP id d66so7758502ioe.5 for ; Fri, 03 Nov 2017 10:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b//fb4fKydF7hr4NvxBAp7IwjG0lbTcPaOydomufYh0=; b=XcwZarjMdQikfjeWZkUxit3FvyTT5OH5h3TPJMp7llBsKvFddgwkbVNCM8oGpeSb8S Q+5s3hFPDl0YTx7StWswLhe16s5QWMyX3ZlxU1RirBkzmtbT0lpxUrAPbh1OoE4XlHji F4e5xHwgEv2CBy+/vVKwHYIFlyJPRKJ1nubube6si4JOgkdSnvUNj2IFWhPbu4CRSUbn S61VzFROQO9ej8AQLzZ11IE6G9ZQHpHCRYGyIXnl+5LOlqMfh11J+EzOB1mgtaiWO6Mq 8OGylhZm6/3Ks1LXLu582g0IZ6i0/yptyyqn3lpgVTZ6T6ej1ny81laSwNZ8a3jW9ZfX BmZQ== 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; bh=b//fb4fKydF7hr4NvxBAp7IwjG0lbTcPaOydomufYh0=; b=V0/jRqUfOnjSI4e9BZ+ntexX4Xql3KQ0oex8qSfkStYHsbPitVzh9sVGrRUDLKyiwx gcim6RteIRltqR6896YuHKLZdokPkfs9Pmo2DzxKbq99s21wgwm6bXNdhAy1upSvZqN4 pehftqj54SpJ0NOKEdW1IjUD/AwHX2be0d5v1U9M/w3/GfOLeLVW7jndPZMgDFhp+sDa KSrEwHvf7OOr2DJ7IfvmpJ/J+oX6MzRqdgIzuuhUUDkCzfny5ZZ29KLxJ7Lr1MulU5Ro rYCrhj+NAka3qwCKivu7g56yAxXm3cyd7lCxGXEb2bAorOcegKHkieFvdVDwpGAPUOfT i8Mg== X-Gm-Message-State: AJaThX4OrVVem7X3zeiAEpvcFDYiDktczFyrn9nRifvLdkPsH9sAJrg2 8c65aodS/KiAKEa+ZOL4JwaPzAPEU+8= X-Google-Smtp-Source: ABhQp+RFBX60Is2SOx5Q0EV1WgPSzwpVdA7m9JPmqF3aK15vJGyWGyz4aYnUskTRXQ78rCI4hFKSLQ== X-Received: by 10.107.198.12 with SMTP id w12mr9717766iof.151.1509729157430; Fri, 03 Nov 2017 10:12:37 -0700 (PDT) Received: from samitolvanen.mtv.corp.google.com ([100.98.112.14]) by smtp.gmail.com with ESMTPSA id d186sm1370787itd.38.2017.11.03.10.12.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Nov 2017 10:12:35 -0700 (PDT) From: Sami Tolvanen To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 01/15] kbuild: add ld-name macro and support for GNU gold Date: Fri, 3 Nov 2017 10:11:45 -0700 Message-Id: <20171103171203.107569-2-samitolvanen@google.com> X-Mailer: git-send-email 2.15.0.403.gc27cc4dac6-goog In-Reply-To: <20171103171203.107569-1-samitolvanen@google.com> References: <20171103171203.107569-1-samitolvanen@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171103_171302_536675_238B6A45 X-CRM114-Status: GOOD ( 10.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sami Tolvanen , Matthias Kaehlcke , Nick Desaulniers , Kees Cook , Greg Hackmann MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP GNU gold may require different flags than GNU ld. Add a macro for detecting the linker and conditionally add gold specific flags from LDFLAGS_GOLD. Signed-off-by: Sami Tolvanen Reviewed-by: Nick Desaulniers --- Makefile | 5 +++++ scripts/Kbuild.include | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 3a8868ee967e..59980d5a03d0 100644 --- a/Makefile +++ b/Makefile @@ -826,6 +826,11 @@ include scripts/Makefile.kasan include scripts/Makefile.extrawarn include scripts/Makefile.ubsan +# Add any flags specific to ld.gold +ifeq ($(ld-name),gold) +LDFLAGS += $(LDFLAGS_GOLD) +endif + # Add any arch overrides and user supplied CPPFLAGS, AFLAGS and CFLAGS as the # last assignments KBUILD_CPPFLAGS += $(ARCH_CPPFLAGS) $(KCPPFLAGS) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 9ffd3dda3889..584d6cecd7c0 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -172,6 +172,10 @@ ld-option = $(call try-run,\ # Important: no spaces around options ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2)) +# ld-name +# Expands to either bfd or gold +ld-name = $(shell $(LD) -v 2>&1 | grep -q "GNU gold" && echo gold || echo bfd) + # ld-version # Note this is mainly for HJ Lu's 3 number binutil versions ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)