Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2524954yba; Mon, 15 Apr 2019 13:34:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUBympEEQT7o1k7QgrHZlrqt/iWzeubn8mF05joouzKStRcOqb7ygC8lNmsMY0n+lf7kbc X-Received: by 2002:a63:7444:: with SMTP id e4mr73140918pgn.261.1555360449601; Mon, 15 Apr 2019 13:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555360449; cv=none; d=google.com; s=arc-20160816; b=fFr2HSBhzdM88gB8374JKYcZMBQqC2EP40Fr8rG35fui3cqVFf1Z5jk8NMLHE+7Pfw z/1+5Vc9qHR7Sqev1tsu7GIVNL6ynmqJKEZ/QD/3Xlf3wHg71f6JrtnU2+HDldilhTaX DJqTqebvYG7qxTZHgIf3UTOQaaE85BMFOO2odgKPq0V/CbnL77ewUsNihTkckpSP+ydc V2nuIjvnkzGA587AFnEZu8buMCiuqBuWZatTTPZj+mcOuFXTl2gDyNdHGWMFzIDE1dHe l/whyJ59LpRjt43Rjk82RGuoU60hJtpa4uLa1KBis9dTDd+A2Zc7GdtGtjXbpi9Xg75b aXLw== 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=1c/o2BXnbBcJwbsqAcHpJor4qX9hCvA+DugP72dXC2c=; b=nX8ageIptCp2Fnj63IpBon68DBWkq5jzRR1CcjpdROL+JBpilIz/JQOBc62k5sLqvu OZyqkC18laDgBMw3YGUfxhLEE3iN6/vpzkL+5bieO281g1Wj15gAeBaTwFYRu1Crn1kn WjrGlvNvzkxgagQf8ZFAoIKtR1RdQM9ODeGTcM4nph/rImILIprHaB+MYurBYbR5tI0z JOyOmGdmmBIZKIa4yeO2k0GsF69FrjvF3pw2R+BMDj766fpCvVXcF9oiLIkp/rJQ5dxz xfIxpb5mMZxm7ky4IzmJOZsSK7/gPUQharf61K8LBDavYrUpWIoOsGupvRW4ta4O9b2w PBpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CDNHPOYT; 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 e193si42318423pgc.339.2019.04.15.13.33.52; Mon, 15 Apr 2019 13:34:09 -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=CDNHPOYT; 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 S1729497AbfDOT3A (ORCPT + 99 others); Mon, 15 Apr 2019 15:29:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:34138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728826AbfDOTCu (ORCPT ); Mon, 15 Apr 2019 15:02:50 -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 E7F6A2087C; Mon, 15 Apr 2019 19:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555354969; bh=d1Re/ePjGAaSp9vv9bcJ84bHqCinxsG4JsOUER5Sabw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CDNHPOYTILkLX/2dJrvEeZXaZv5bUrX9gyoD+KtQV2TG2YUegUa7RIhdK+MUFhOR9 eo/lhqz6yg28tI2G/OXT8mUwDtivw4b8XVLRNuZHfcSRtfP2MvJmfo1Kf5qsgbxOsq 520loyFCSIbQI6Da88He33BM9o/wZAeJK1nuM93Y= 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.14 08/69] kbuild: clang: choose GCC_TOOLCHAIN_DIR not on LD Date: Mon, 15 Apr 2019 20:58:26 +0200 Message-Id: <20190415183728.495432516@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183726.036654568@linuxfoundation.org> References: <20190415183726.036654568@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 da223c660c9a..85753250984c 100644 --- a/Makefile +++ b/Makefile @@ -480,7 +480,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