From patchwork Wed Nov 29 23:44:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10083927 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 A8AEE6020B for ; Wed, 29 Nov 2017 23:46:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A29A29C84 for ; Wed, 29 Nov 2017 23:46:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8EF0B29D55; Wed, 29 Nov 2017 23:46:03 +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 14F9E29C84 for ; Wed, 29 Nov 2017 23:46:03 +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=+vEgBy7/WF3shIVZpyZhiGdoUxjlacdr++auzA562ys=; b=WIfW7Vcu5FyjVtKbVPaM11GYXk 6C/2b4M84dzX5USjXwrVn6Y3UeMrjJ3pYi9zK8P/RXxLBBggFGOzgdrAe4UK8HCBM0JpxF4zvgG3V sHd4gHGjcmpj42mUxZQ+Om/L1MS7hwNAgprMCROYEAzi5Rum0Mz7DknpbXLZwnI3iFhZ6mG/Fz7Fm f5fVPY403W0m7a+hqQH4ACf3mkCaKpyRrxD7X6lJ3az+4s/8o34slyEEgj4hUicM3/r7UggJM4ViA N9ROlGtSzvJ5+gItue9PQc6pG3GWtW2zEWPoFWXE99UdRlvowyCsSfmWGnyS5EtlSiQUD/9Cfzf/i Tiw1fLZQ==; 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 1eKC3E-0005Zf-Jc; Wed, 29 Nov 2017 23:46:00 +0000 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eKC2U-0003Yg-67 for linux-arm-kernel@lists.infradead.org; Wed, 29 Nov 2017 23:45:20 +0000 Received: by mail-pl0-x243.google.com with SMTP id g2so3077948pli.8 for ; Wed, 29 Nov 2017 15:44:54 -0800 (PST) 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=SlYvTcgCKJS3q6n8QM2qaI3UJ2v/g8LRNVG+cO2Gckg=; b=COuw69veuRya8rA9VtbDCSIYvwP2K2pb7D+qsZ/a/M10BZHIfrawR4HL9hgd5YvA+D Biy1S4UIVDaMwfHRxRTKMT8Zi4zc7mbWf5rg4XGRowcLqIhDZvXQMwrBNM2jgFvgRKHv mlc8937FX5sPytbBx/4tGzQnumAx/UsWyjXlF2LxYK4npgzw8rtncj5JIT9Gn+i3mEZ7 cJDYOz6yjUSPD2RvoR+BShJ3zfWPlq9N7GMtuSU4b8nxkYC39S1NumWJjDaropMMklaL cB1Aizm1t24d0t8IGZ47d424klDoURDRWUtBTLR5mvQdkJcXuTd4qVO5+WHRV7ReYqw/ wpuQ== 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=SlYvTcgCKJS3q6n8QM2qaI3UJ2v/g8LRNVG+cO2Gckg=; b=gI6U5FzqCK+wAxPP+nbq9iedud3+35hoDqITcVYLRtvOix9qPebXZowxNna4Py49OC bNs6C1eFfhaNENf/NeVYFl60NcuYyvuvQantsmCLdCnS8DXuyP5i3TvByoF3kTNhI2Qg SGhDHFYa2xF3DpZQtkRHhZ1bJp3OejEbK5m8cEUVXs7Te61EY+D5k76FLBb2R9c0ehdj QgGOi7+vOwyDWrUgh6G/umUIbLbUnyfahm2cRWOct8qZjtG6+GDY/LyeU9/x+FcIW2/F JGlCr9as+5mnYWHeoYB2J5IawMDSax5cCEsDTrmsPuwl0ITHtxb0VpWRmYGCI7ewx9OB CeLg== X-Gm-Message-State: AJaThX5zWtCvmOUBAUiPwG14Zv+7crUDOy/ntwNOD7UIuBosPe/CGpvA 3E7A8BFs55DjMJ9vEnDsVJdgfg== X-Google-Smtp-Source: AGs4zMYGzaRJW5r30QoI47KOQ9YDQeOR8JvckwvbRl2nwitALe152BTcTkweXSNLMJEtudEp2psbvA== X-Received: by 10.159.207.149 with SMTP id z21mr157894plo.68.1511999093245; Wed, 29 Nov 2017 15:44:53 -0800 (PST) Received: from samitolvanen.mtv.corp.google.com ([100.98.112.14]) by smtp.gmail.com with ESMTPSA id s14sm5326948pfe.36.2017.11.29.15.44.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Nov 2017 15:44:49 -0800 (PST) From: Sami Tolvanen To: Alex Matveev , Andi Kleen , Ard Biesheuvel , Greg Hackmann , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Rutland , Masahiro Yamada , Maxim Kuvyrkov , Michal Marek , Nick Desaulniers , Yury Norov , Matthias Kaehlcke , Nicholas Piggin Subject: [PATCH 1/7] kbuild: add ld-name macro and support for GNU gold Date: Wed, 29 Nov 2017 15:44:36 -0800 Message-Id: <20171129234442.655-2-samitolvanen@google.com> X-Mailer: git-send-email 2.15.0.531.g2ccb3012c9-goog In-Reply-To: <20171129234442.655-1-samitolvanen@google.com> References: <20171129234442.655-1-samitolvanen@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171129_154514_294210_C81ECE3E X-CRM114-Status: UNSURE ( 9.25 ) X-CRM114-Notice: Please train this message. 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 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 f761bf475ba5..a16c98d6e3ba 100644 --- a/Makefile +++ b/Makefile @@ -814,6 +814,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 b6d7d347b203..a7c7843c2cf1 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -277,6 +277,10 @@ ld-option = $(call try-run-cached,\ # Important: no spaces around options ar-option = $(call try-run-cached, $(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 = $(call shell-cached,$(LD) --version | $(srctree)/scripts/ld-version.sh)