From patchwork Mon Feb 11 19:30:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 10806725 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 106B817E0 for ; Mon, 11 Feb 2019 19:30:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01BD32B093 for ; Mon, 11 Feb 2019 19:30:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E97CD2B0A8; Mon, 11 Feb 2019 19:30:47 +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 DE35D2B0A4 for ; Mon, 11 Feb 2019 19:30:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388263AbfBKTaq (ORCPT ); Mon, 11 Feb 2019 14:30:46 -0500 Received: from mail-it1-f201.google.com ([209.85.166.201]:56347 "EHLO mail-it1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388262AbfBKTap (ORCPT ); Mon, 11 Feb 2019 14:30:45 -0500 Received: by mail-it1-f201.google.com with SMTP id 135so91989itb.6 for ; Mon, 11 Feb 2019 11:30:45 -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=A+p5CcPbc67CNJ+HtkbKBMLEqE5iK/BxBkcy0srR2f4=; b=EUfDjdobRLMV2Tk3lGBtNvj9QujsHoJi9ZqtEcH+YVtBCw0t/FCOOKOLjYPLz2olUE +TKRIo6Qkhd4/yl5EoeB93P6IDHZzfNjrzFK7iELdrQbe/FgB6/rqt0ScvP0xuzVt8hB z3fEBdPiKZndqh/aWqmvhVbI4J2B7eYEVxxuxU9Axu+akFPva/9Qj60M9PMrdYG72vSq Gubv63+gi2EzkY3wnIv2NYmvI/aEm0HnzTlhgrrxsVzTrjldQ24LgR14yr2G4DK4e8hr yPFkN2CogT0A25zsQf9ZCs9OjpRlwz3HR/KZ4hDpMclFW4EC5h+L1Va45mhPLcZKJY2J lLGw== 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=A+p5CcPbc67CNJ+HtkbKBMLEqE5iK/BxBkcy0srR2f4=; b=tkuojd/e/URoPVyO5ahw5YTqpVlc6n4ygWx1iDwD2L0SDHOIyLJgro5iHO7VzDr4JT XnZwfWrgRcXn3NBw5yLe50ct+jg7EzIFb7PGo6Bai2DgDaa9JLM4FAw1XImOox4WycLw lUHGvwUMl3tCmYc+/Xamj2WepbeC0LYKr8q7MUiYWxRnLkaspPcTsIkJvEj/kiwrhYLf zXdNT6wA4gBaXv3ShKy9tGAyCkCsevgpQbu/4x1uPtyg551EI2dHCcBs5HyA4nu4YqgW Vj/zLk8aIr/MHFGgbs0rl2VWFKX0/qoVM6zQpsjGPVSRFGstMa0kz/VgPoeSQ7N2jVYM F1XQ== X-Gm-Message-State: AHQUAuYmYptxlmE1EVreUhQtDKa8JaRJhTM5xU2xAUmcJu1vemqRpWYw l4bNuiDy69c+aFpFUtvINMuXHGhSdEigyZ4bDbw= X-Google-Smtp-Source: AHgI3IYF+PQlndRP+6W1b1+rJPutoAPanw6IRHwvLut+f1J4HrBcdzpQTR7g4ywG2Ll0njjvZe7wN/kSkeOVBeIn3MA= X-Received: by 2002:a24:d82:: with SMTP id 124mr794567itx.10.1549913443054; Mon, 11 Feb 2019 11:30:43 -0800 (PST) Date: Mon, 11 Feb 2019 11:30:05 -0800 In-Reply-To: <20190211193008.24101-1-ndesaulniers@google.com> Message-Id: <20190211193008.24101-3-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190211193008.24101-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.20.1.791.gb4d0f1c61a-goog Subject: [PATCH v2 3/4] Makefile: lld: tell clang to use lld 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 This is needed because clang doesn't select which linker to use based on $LD but rather -fuse-ld=lld. 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 Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Changes V1->V2: * add reviewed and tested by tags. * move this addition up 2 statments so that it's properly added to KBUILD_*FLAGS as per Nathan. Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index d3b65e96d183..00e8e01d23fc 100644 --- a/Makefile +++ b/Makefile @@ -500,6 +500,9 @@ ifneq ($(GCC_TOOLCHAIN),) CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN) endif CLANG_FLAGS += -no-integrated-as +ifneq ($(shell $(LD) --version 2>&1 | head -n 1 | grep LLD),) +CLANG_FLAGS += -fuse-ld=lld +endif KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_AFLAGS += $(CLANG_FLAGS) export CLANG_FLAGS