Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4700282imm; Mon, 17 Sep 2018 20:07:33 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZMJ/cbo2rPMOvkbN3np/ACNUstxMJGXA1ZI8YYAfxPGYRpRV6Yr+phqKsucqmnXr3rnenh X-Received: by 2002:a63:4b1f:: with SMTP id y31-v6mr25620361pga.14.1537240053226; Mon, 17 Sep 2018 20:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537240053; cv=none; d=google.com; s=arc-20160816; b=YDfAiTozO69Le6/OJI/7gx2qI8xpOdum2+yHax8VVDVva+qgVe45Cm15m3I+F64Oic spDNkpI+guvAdSXott4+KzfwiuWBdlH35dH6Ej8CjeIEIRr9iWkDnZCKUWe5QPuFADFW N6pCIrffDUTj0HoR5ubDNknFX23NpjUGdPztoL4PyoeQDEfMo4BipnHuLFgZzw2NA4SX uf1zIlF/WtehxzI44MM/90eDwXcDbWCbk5l8IYXjmY3nkmAJVt/yAPPvLSBi/R4wlZ93 pM4CvZPSbbNeYZOPcDtmSJYuSObYfCajYL/Ulk2XT8tmeJ6NEXVRfKyxsKJYCTj/22Cr QVuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-filter; bh=+mnSl0m0bDbdb7Ptk6Kg527ArnVUDSRmtXc979Uqjak=; b=PkM8n1j4zNobaWPhZZIVLsySv0lLjQ2uedMbGbiZSJjDCDJod9eVlAE+AQm/JrXNPF sSzOGgbtIJMoEYaFuu7PHUHbIMvA+6EMk1dViwJUFTq0BSyxitK5L3a1fnwvT3YrgliI YenHGoj/5ROd/jwfWIfRwJMAx9cOWxpNfaTI0+PJ0MVgghqKOKDZVxqh57nfHX2oyvyt zhc0MIw4fd6s3/PAZZoc/0g4FuBqXIRuqmz7RaJAc0+OHCZHaOTKRPKcesvCR2JY7Qvx w/1rDG0jHETQK0T7iwTkXZe9zQukgqGH80Hdu0wK4OiJUre+x5lW+FZzN4OiiBlAynFL LjFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=IoUhYm8Q; 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 u134-v6si18654789pfc.244.2018.09.17.20.07.15; Mon, 17 Sep 2018 20:07:33 -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=@nifty.com header.s=dec2015msa header.b=IoUhYm8Q; 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 S1727270AbeIRIhi (ORCPT + 99 others); Tue, 18 Sep 2018 04:37:38 -0400 Received: from conssluserg-06.nifty.com ([210.131.2.91]:51684 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726267AbeIRIhi (ORCPT ); Tue, 18 Sep 2018 04:37:38 -0400 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (authenticated) by conssluserg-06.nifty.com with ESMTP id w8I36hT2012637; Tue, 18 Sep 2018 12:06:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com w8I36hT2012637 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1537240004; bh=+mnSl0m0bDbdb7Ptk6Kg527ArnVUDSRmtXc979Uqjak=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=IoUhYm8Qdp4AcxE5E0+e8IEc6CuCLuC24o3UF+Dzg4NEF0FEo3hBdO6G4KGeYiRFs LYWiGgty2+oMuZUtGy8YEnNTwojH094JXTfa+17bf5kUnW0lto4oyK4a0GRw8SF14m Sy8sckQokHCnWUsLLLoUxyGvfPNkYNvYC0RrMbpiJUqQFvIJqfrVN7gVrEY3evnc9T byow+pNXOg0w1CU2rNl7GDGrCW5M7Mg065wbKNxmoEMo2yoVCFWX0dTFwa07+dyKJh d69eCzG20vtLLn76vhFl6TmAt42kczTfG8HlTpmP+2gvOHjKYOculDzVH+EO7OPssV BpOsDyik85nRg== X-Nifty-SrcIP: [209.85.217.47] Received: by mail-vs1-f47.google.com with SMTP id y11-v6so146757vso.5; Mon, 17 Sep 2018 20:06:43 -0700 (PDT) X-Gm-Message-State: APzg51A4FcHKRq4uWmlrE5a5Bcvs6Q7B3k/5vLQtKfohUI+EzQ7TPRK/ G7zDF68FSMXScN/UzbFKfYglqPYfRK7wIq2n+Mo= X-Received: by 2002:a67:4441:: with SMTP id r62-v6mr8635821vsa.38.1537240002354; Mon, 17 Sep 2018 20:06:42 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:7111:0:0:0:0:0 with HTTP; Mon, 17 Sep 2018 20:06:01 -0700 (PDT) In-Reply-To: <20180918023157.23951-1-stefan@agner.ch> References: <20180918023157.23951-1-stefan@agner.ch> From: Masahiro Yamada Date: Tue, 18 Sep 2018 12:06:01 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: allow to use GCC toolchain not in Clang search path To: Stefan Agner Cc: Michal Marek , Nick Desaulniers , Arnd Bergmann , Linux Kbuild mailing list , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stefan, 2018-09-18 11:31 GMT+09:00 Stefan Agner : > 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. The current code passes the absolute path of toolchains to --gcc-toolchain option. In my understanding, this is enough for Clang to find the proper linker and the assembler. Why is the --prefix option also needed ? Am I missing something? > 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 > --- > Nick, I removed your Reviewed-by since I had to change variable > assignment slightly... > > Makefile | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/Makefile b/Makefile > index 4d5c883a98e5..d5de2db4b549 100644 > --- a/Makefile > +++ b/Makefile > @@ -495,13 +495,15 @@ endif > 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 > -- > 2.19.0 > -- Best Regards Masahiro Yamada