Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5607070imu; Mon, 26 Nov 2018 02:55:58 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uwi/upzQ/ZX2v/Clz9GVcXAH+WIHA8iBwQ2ICG2oJ8Yw8dN+rkIYMpvV2E8Ln+yYMkiRaG X-Received: by 2002:a63:ba19:: with SMTP id k25mr24209657pgf.194.1543229758163; Mon, 26 Nov 2018 02:55:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543229758; cv=none; d=google.com; s=arc-20160816; b=Y9BP1tGvM2LgYFTTfm0dHCmlAYYP8XvJnsPnhyPM50QeKirhCT5M//b0OEiSqc/Slu 6NdQHZV2dinRlQZI9Pu1cUsDbFw/OLpsQBIPfPCEqVnOeeCJlKpYEU1JHRmsfIkflZQc iC1dOP4Ui9kmC0E04woch3Bc5+BQMylmzJrElTy8XaOiTRZo07oC1K5vdpq0QFPdGmXF wXZI4wBAhH2A36PW/Pc55ZeJq/y49HiLUfBjmcxDTa0cZsYduMb4pvL2r1bXwNYza5hQ J4rOcvlejNFIoyE5ZXSxWpf7RmUEszFbSi0g8P9jJCq6nEwIhXYUjlKQkEklLHi2JvmC gnKw== 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=CJH/KKwqmNnL/BYrsAzrj3ox4Ed2LJdc3n/CQ3+NrXA=; b=VeAWHMjqxwj0q/QlwrvnMCZ7nU7XLNqoo/ivusyPAcu5yxiHUGcwxBu8qKNKpe76j/ 5vruJa+QPR9tzvhkskYa/8DHgXFa6cGkWexlNqaeXIiDXhiLmAkOQ+6BZH3fv80Dq0wC AdU05+BpbnfPHrkMU0QxskFI15cbMv7QnFF+JI2eZlLNrXt31l2B6WGvFwRTKS9TSaqP pjb9xdWHul8tqifm+4Rn2pTxrt6V0n6h2Xeu5dFtl+FCo3U6P3OqJoUXdj8OMlDYWz+a 9Z4iFHACf5lPr2PqngL2p1XqGt77b6udWEvYj3YwbvAm6CK+prNy5m3S8A12szYA0GnG ss0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OQC96sZx; 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 g11si57889610pgn.32.2018.11.26.02.55.43; Mon, 26 Nov 2018 02:55:58 -0800 (PST) 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=OQC96sZx; 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 S1727496AbeKZVsP (ORCPT + 99 others); Mon, 26 Nov 2018 16:48:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:56688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727457AbeKZVsP (ORCPT ); Mon, 26 Nov 2018 16:48:15 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 3384221104; Mon, 26 Nov 2018 10:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543229671; bh=OuV3ndr8AfkbRV1w+ypQLTRDJtSvsDUVd8aGhZhKYrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OQC96sZxJjmv8MYSosHqYkLqUr8MIthypLHiC3yDlStrZlQbNq5xUWKqIhFWB/BE6 6IFjTsDgUDv8ROJrf4EQh3mjbv04/w/U+5WMoTCPYtpgRLkNCysy1xlplzv9NIR2Ce tAwGynh65oRCv6ZR+vmYNSbVMhAmOH8/zLWw0ugE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Agner , Masahiro Yamada , Nathan Chancellor Subject: [PATCH 4.4 27/70] kbuild: allow to use GCC toolchain not in Clang search path Date: Mon, 26 Nov 2018 11:50:42 +0100 Message-Id: <20181126105049.428730158@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105046.722096341@linuxfoundation.org> References: <20181126105046.722096341@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Agner commit ef8c4ed9db80261f397f0c0bf723684601ae3b52 upstream. When using a GCC cross toolchain which is not in a compiled in Clang search path, Clang reverts to the system assembler and linker. This leads to assembler or linker errors, depending on which tool is first used for a given architecture. It seems that Clang is not searching $PATH for a matching assembler or linker. Make sure that Clang picks up the correct assembler or linker by passing the cross compilers bin directory as search path. This allows to use Clang provided by distributions with GCC toolchains not in /usr/bin. Link: https://github.com/ClangBuiltLinux/linux/issues/78 Signed-off-by: Stefan Agner Reviewed-and-tested-by: Nick Desaulniers Signed-off-by: Masahiro Yamada [nc: Adjust context] Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/Makefile +++ b/Makefile @@ -610,13 +610,15 @@ all: vmlinux ifeq ($(cc-name),clang) ifneq ($(CROSS_COMPILE),) CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%)) -GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..) +GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) +CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR) +GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) endif ifneq ($(GCC_TOOLCHAIN),) CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) endif -KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) -KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) +KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) +KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) endif