From patchwork Mon Feb 11 19:30:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 10806721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 297396C2 for ; Mon, 11 Feb 2019 19:30:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AAE32B093 for ; Mon, 11 Feb 2019 19:30:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BFE72B0A8; Mon, 11 Feb 2019 19:30:36 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA3E22B093 for ; Mon, 11 Feb 2019 19:30:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731515AbfBKTaf (ORCPT ); Mon, 11 Feb 2019 14:30:35 -0500 Received: from mail-vk1-f202.google.com ([209.85.221.202]:39856 "EHLO mail-vk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729872AbfBKTae (ORCPT ); Mon, 11 Feb 2019 14:30:34 -0500 Received: by mail-vk1-f202.google.com with SMTP id k8so30403vke.6 for ; Mon, 11 Feb 2019 11:30:34 -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=yTmTM4lUWy38wNpJAAj82b5/JRtPQPUWiVhvkLc+GmU=; b=IgD0EQVvZuRTW8V34xCcsd5j+kuukE2iC4AfflnsyCWMauneJH9QQAwi3n3dFkIVl1 yQswrFqCX01hxOU9LOZO0jzflZSDdobLsqRH5CHZZS9fyZhRZN6ud1RvJO39OL8fdmbt yLJy++glVR3+LvhqrpbOMBvg79T3MIgcnDdm7OK9ePSvhksVKeSMnZwAsu1RJPhY8pVF UAUdVqmig6Bg1NRh1FsbaVldgBDaN9hsdr5ZXzn4pVerj9lk7g8t8xyKGo6LarW5hRMs Q3HUQFQaraxBEnLMlaCLxHCQs0YFbjOCOpL7Jt8ePKT/VScKQENAsWNu/THSYgipbRiR /zDQ== 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=yTmTM4lUWy38wNpJAAj82b5/JRtPQPUWiVhvkLc+GmU=; b=k7P8QU6j5OS3HfAVG+txquI0oNsq73UPyQ2UrN7HVLDl0uPsnnMtYBHmpJ7AkH5LMB ot1jb4LHhYygSn8vktQErsiZqCiA36aE91FKYBPk0iHZrFJDlJSA5eLdnmvx2TJj2jk6 W5LN7517E6fqvKIbtHY4cMqNY0UR4NRjG9MeMemVn1HIPlKLj5QSHTwBsi0B4x1+3aZL O2WvXFY+yor15DU0xk6JOgqXYiBcpSYiBCbnP15Qu4KFUF7Xr3TiexaQKk4BD+TgUsfc jqzdhaMTzONPXDCNpDDnYumS5/Ly99rCjfStYCpJglOVSMV7a7Lx1SnF+p0Lk2+3U2hZ 6cEQ== X-Gm-Message-State: AHQUAuaALLXOj+XVkySNXo5ECe6MSxndRcNv90Ul7Mnr+SJ3xs6lXgzs u5axXg+DnjKiWNVVv4G9cX6UbFfJCM8nkWf2NhU= X-Google-Smtp-Source: AHgI3IYWVYrxBcjc7ylnGQXBCE4Ft/swEAMJWDf3/5UvXBH/BklzcuSloD6V+Nqifugd/XtXLW3Gdz3KUFbiE1Nntpo= X-Received: by 2002:ab0:4e23:: with SMTP id g35mr23818918uah.0.1549913433804; Mon, 11 Feb 2019 11:30:33 -0800 (PST) Date: Mon, 11 Feb 2019 11:30:03 -0800 Message-Id: <20190211193008.24101-1-ndesaulniers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.20.1.791.gb4d0f1c61a-goog Subject: [PATCH v2 1/4] init/Kconfig: add config support for detecting linker From: ndesaulniers@google.com To: yamada.masahiro@socionext.com Cc: natechancellor@gmail.com, sedat.dilek@gmail.com, keescook@chromium.org, samitolvanen@google.com, michal.lkml@markovi.net, akpm@linux-foundation.org, hannes@cmpxchg.org, peterz@infradead.org, linux@dominikbrodowski.net, npiggin@gmail.com, mathieu.desnoyers@efficios.com, gor@linux.ibm.com, adrian@lisas.de, rgb@redhat.com, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Nick Desaulniers Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: Sami Tolvanen Suggested-by: Sedat Dilek Reviewed-by: Kees Cook Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Changes V1->V2: * Add suggested, reviewed, and tested by tags. init/Kconfig | 9 +++++++++ 1 file changed, 9 insertions(+) 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