Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4879392pjb; Mon, 27 Jul 2020 07:27:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCUGGf5uN9//AzGbtgu2/ekTCi5mI39Wq147p9bfq1Rk/P08Sv1SEUKpck/vO/sac6xih7 X-Received: by 2002:a17:906:3ac4:: with SMTP id z4mr20123236ejd.65.1595860051606; Mon, 27 Jul 2020 07:27:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860051; cv=none; d=google.com; s=arc-20160816; b=YVpmEKvKr8vYOi6PTo3c/Si0Ke2u7+MP4xvoaoChPovE9slUA52qBhz8DVmqo6tZDD 2k8VCUaVk2Xl3py1pJRooxYVkpTEv3pygx25+6OxsxZv02qY7rRpCuEs5/M25bPcrNLW +bQxIcyiWzSfPO0xiVFvgeRLsf8f0A96Fb5nj0ZZL+ugt25FEtkD+6iu8Xy4GbOiigOc i9oZRVauo5IKh9uQRQ8RE04i+xAtvIL1hT7+Rc1pz80y6pFk/2FZYufaJT5yyke6GRC3 ZACeB+FVNGy9d+zNTRueh/5Sulk2xJQQqspC1GMbNVy35MMlF6bR2bYXYKZAOhwJFaYj lalA== 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=ns9Bo7KC5nM+3NupR1JuDIVqE+BTseuS43yt0My5pek=; b=1AIzpVZvbXNUaMqoPPL+PVWrOlDnS0M1qoCEBOe5MAqJEb8XWW9QpYcFyqlQCtu229 qdq9b3aJBa0m+zvX9AYRJJj4r4q/WB6wX33eV2xu7ITPkOkb3l1OnskdTm5UmVQCAsSY Phf2YFZgg5gip1Kd/WNUjoY3cN1TXSIhDoVkko9z+qQ51MCp6N4AwFwLdO6Rio+qNeda Mc4eLG5kO6DQsKunt9PDHK66K2p00ioTPED+XyKC9SJAmiYhIaO//HRxThnNZDez3C6T 5IJpOAm4t5H/CuYHaU3Sb/dDod3Kk++Bz/JWZJ/SB2pUkmmFj4qsseQTikAKv/mZK8qm biBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YMrcSBE6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx8si5516380edb.170.2020.07.27.07.27.09; Mon, 27 Jul 2020 07:27:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YMrcSBE6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731818AbgG0OZ0 (ORCPT + 99 others); Mon, 27 Jul 2020 10:25:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:55318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732389AbgG0OZX (ORCPT ); Mon, 27 Jul 2020 10:25:23 -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 9D9EC20663; Mon, 27 Jul 2020 14:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859923; bh=eu30v+2vd52vuhOIMWCqVsoMKwz6eTSfGkwdDQQMxNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YMrcSBE6I88xXPFpwRocXVbVKMXkL2+RQ+SDpV1BhtjcFvK67d5RPFTS1Qletar9Y VtpClsyXwdGipqZx+cP2nWkDp/Wwy93iQUk8A4DEFHzIoyu1cSJvECAmYs/oJHb0yL QR06OcWibskMm9cFSAin6I82yYPKGiLTh0KRmyOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Fangrui Song , Nick Desaulniers , Masahiro Yamada Subject: [PATCH 5.7 158/179] Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation Date: Mon, 27 Jul 2020 16:05:33 +0200 Message-Id: <20200727134940.369604684@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@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 From: Fangrui Song commit ca9b31f6bb9c6aa9b4e5f0792f39a97bbffb8c51 upstream. When CROSS_COMPILE is set (e.g. aarch64-linux-gnu-), if $(CROSS_COMPILE)elfedit is found at /usr/bin/aarch64-linux-gnu-elfedit, GCC_TOOLCHAIN_DIR will be set to /usr/bin/. --prefix= will be set to /usr/bin/ and Clang as of 11 will search for both $(prefix)aarch64-linux-gnu-$needle and $(prefix)$needle. GCC searchs for $(prefix)aarch64-linux-gnu/$version/$needle, $(prefix)aarch64-linux-gnu/$needle and $(prefix)$needle. In practice, $(prefix)aarch64-linux-gnu/$needle rarely contains executables. To better model how GCC's -B/--prefix takes in effect in practice, newer Clang (since https://github.com/llvm/llvm-project/commit/3452a0d8c17f7166f479706b293caf6ac76ffd90) only searches for $(prefix)$needle. Currently it will find /usr/bin/as instead of /usr/bin/aarch64-linux-gnu-as. Set --prefix= to $(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) (/usr/bin/aarch64-linux-gnu-) so that newer Clang can find the appropriate cross compiling GNU as (when -no-integrated-as is in effect). Cc: stable@vger.kernel.org Reported-by: Nathan Chancellor Signed-off-by: Fangrui Song Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Tested-by: Nick Desaulniers Link: https://github.com/ClangBuiltLinux/linux/issues/1099 Reviewed-by: Nick Desaulniers Signed-off-by: Masahiro Yamada Signed-off-by: Greg Kroah-Hartman --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/Makefile +++ b/Makefile @@ -549,7 +549,7 @@ ifneq ($(shell $(CC) --version 2>&1 | he ifneq ($(CROSS_COMPILE),) CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) -CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) +CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) endif ifneq ($(GCC_TOOLCHAIN),)