Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2522040yba; Mon, 15 Apr 2019 13:30:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzU0Qz+c9RWVWO+WNbJG0nSNsU38IjO99vmi1EQgA/naqebg1qwI8guMD2r7LkyRWJ4GOgk X-Received: by 2002:a63:c302:: with SMTP id c2mr73196076pgd.235.1555360211285; Mon, 15 Apr 2019 13:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555360211; cv=none; d=google.com; s=arc-20160816; b=jcZ6JXadR4EowUW/aWFb/VR1TQNFs+THmLj/E/4VyxiZivKmp6nl7EG2q46BlwQs9i EQGPexfR9BT+lAgZI82el00WFCHE+eolDUcTbHxlYYGRSFiGXAm0mLyb6eagrebRrMVc rf24Wn/e/NIvyOkSAlqguwbTS3611kD00l/b63d2UNQ5XkxhMwJg9Vs5vmUYLWv5f0NJ YMqYY7JF6YW9es36mDekJqXojVcbkCWZY6aZUaJ6fLfV345HIzthmAZJWWwo5Og6ZA+D 96VppMCjm4ORYx6uPsb2YwpskzxHwd9T4i4yOGDKU8j92GNeSCwmpO8Ic+n314ZPTYdf GIZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pKhgtid1pZ+X7ZEDSn1GmLgAz7K5RubU2XH5K3wpnL4=; b=yTfuF68brAMhxV/CZbb8HE7+dIKS2Uj+oLXeSBNqtNTi3joruapNPCFafimwm/st/5 YNJLKvpeYjH3sKjgDbgwuxEtZMmL+SY+gGcT9IunlXIsfqPhzP0P6PgJ5PAOiWOSdt9A t1ke6ikOUaiCKPPLEHfT5mHWTuL4kiNpKYO01v6Gggyeydqh/Wk/z1PgWe1/qCN83Q1y RCk5jZM0LgUH+DW/GMYtcN6Ay3ugS7T+JFmlYT2DyARDr7Z4HgfTHv3xppSq5QB8xgsv g4KtgX15lJo8eo+EwVuwGunx3xHhMrvLz+ANG6mPIAyAPAeLXxxxg50ovaSqzGxu1AOH hrXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wJGTCMMG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f18si46285266pgj.188.2019.04.15.13.29.55; Mon, 15 Apr 2019 13:30:11 -0700 (PDT) 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=@kernel.org header.s=default header.b=wJGTCMMG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730104AbfDOTHL (ORCPT + 99 others); Mon, 15 Apr 2019 15:07:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:41808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730091AbfDOTHH (ORCPT ); Mon, 15 Apr 2019 15:07:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8752C2087C; Mon, 15 Apr 2019 19:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555355227; bh=lxC8+yuu3crnRi+Gft1xk/XP3S1Sm8ISoYy5GjkXD34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wJGTCMMGnnTnEP+cHTfdVpmth5ijqlu07yp7zWELZ4+x1CMOzP5apzsgJD/It5fB3 1S24o83LcY72mQY1stMtXtgRCTpyx69AUrkVUWexhAuJipdf4eTmpsUZBMGLfIRMjy Ja72asdH/0aOWB/BSt2y7IMtBC06ihEK9wJibs+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Masahiro Yamada , Sasha Levin Subject: [PATCH 4.19 038/101] kbuild: clang: choose GCC_TOOLCHAIN_DIR not on LD Date: Mon, 15 Apr 2019 20:58:36 +0200 Message-Id: <20190415183742.470154291@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183740.341577907@linuxfoundation.org> References: <20190415183740.341577907@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit ad15006cc78459d059af56729c4d9bed7c7fd860 upstream. 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: 785f11aa595b ("kbuild: Add better clang cross build support") Link: https://github.com/ClangBuiltLinux/linux/issues/341 Suggested-by: Nathan Chancellor Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers Signed-off-by: Masahiro Yamada Signed-off-by: Nathan Chancellor Signed-off-by: Sasha Levin --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8fdfe0af5862..c07f25e2e11b 100644 --- a/Makefile +++ b/Makefile @@ -483,7 +483,7 @@ endif ifeq ($(cc-name),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 -- 2.19.1