Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1646167ybh; Fri, 13 Mar 2020 05:02:55 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuttVYwXMvbw67nQFvmhzErgItXdWRSDLdW16uE/R4h2QZJioW9EM4US2LaL0ZCftw33uOg X-Received: by 2002:aca:4183:: with SMTP id o125mr6318410oia.125.1584100975510; Fri, 13 Mar 2020 05:02:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584100975; cv=none; d=google.com; s=arc-20160816; b=XB9O2aWvYRNIRzI3IjUfpA5JEHO4RQ04mzWI3KJO7KKxiB6Q22i2uoP1MKu8ImO/t/ /yAv4t8p5zm/vBNMpuu5iSsoTlg+F/6ggmMw3jiz5iYWFSRzBxUoQkqRPoEY2CMuZlv5 bBRqlzDZ4XdxZpC9Y7kE1Kx0OPVp1rzZNc6kj+kkKWd/ZuRAu1MVu4OI50OX6TaUbRl8 I/ls2SNkyIzsauDP8EeDTRt3nFIPSta5dpmNcMB+UL8h8bOUoEqzH3IxJxFvbcn8vYEP x/xVh7+zNuJUDksiYa3h1kSYW4oK+OX8F9jISxlJHRN74IqgJXmOr8ku2MwtLoGDnLn9 xneQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=sn009KW6vaJx5uNobpDN0crsdDijHN94IWie47dcmvs=; b=I60zIVasDsIiSBC3xT9UxLVwrV6Fn7UOTEO9VQGLNAQ0jdWEE01B5TGP5uvP+KHQhO R9uL6n7BMcmNdgMNngUCL/vZiHCJ891txKOXtGyKM+VGqPC9gWvi1WFkNwANVrHESzd7 WnITl0MeHkxiP1zhyVfbWUFmcj0SzctZdaHLGbEZ7o3nY6F72P70vSr3pMPasn1SsUfQ h3syh4WB9qYZbccwxOC1yZfRK0+ePtqdMKD6qBhWGGaggNRFvxOxSdlQJdPQWH4F0tPp +JyuvHyGdjLj1RO7wC4XdcXO5Ld08o7H8q0U789ukXwDhZR7NJYXTpB61PV2G0CoFJRn 9IsA== ARC-Authentication-Results: i=1; mx.google.com; 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 b184si3596386oif.102.2020.03.13.05.02.42; Fri, 13 Mar 2020 05:02:55 -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; 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 S1726681AbgCMMBg (ORCPT + 99 others); Fri, 13 Mar 2020 08:01:36 -0400 Received: from foss.arm.com ([217.140.110.172]:53730 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726636AbgCMMBg (ORCPT ); Fri, 13 Mar 2020 08:01:36 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D6AEFFEC; Fri, 13 Mar 2020 05:01:35 -0700 (PDT) Received: from [10.37.12.218] (unknown [10.37.12.218]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D9F7A3F534; Fri, 13 Mar 2020 05:01:31 -0700 (PDT) Subject: Re: [PATCH v2 20/20] arm64: vdso32: Enable Clang Compilation To: Nathan Chancellor Cc: linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, clang-built-linux@googlegroups.com, x86@kernel.org, Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Paul Burton , Thomas Gleixner , Andy Lutomirski , Ingo Molnar , Borislav Petkov , Stephen Boyd , Mark Salyzyn , Kees Cook , Peter Collingbourne , Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Nick Desaulniers , Will Deacon References: <20200306133242.26279-1-vincenzo.frascino@arm.com> <20200306133242.26279-21-vincenzo.frascino@arm.com> <20200310014039.GA12211@ubuntu-m2-xlarge-x86> From: Vincenzo Frascino Message-ID: Date: Fri, 13 Mar 2020 12:01:57 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200310014039.GA12211@ubuntu-m2-xlarge-x86> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/10/20 1:40 AM, Nathan Chancellor wrote: > On Fri, Mar 06, 2020 at 01:32:42PM +0000, Vincenzo Frascino wrote: >> Enable Clang Compilation for the vdso32 library. >> >> Cc: Catalin Marinas >> Cc: Will Deacon >> Signed-off-by: Vincenzo Frascino >> --- >> arch/arm64/kernel/vdso32/Makefile | 13 ++++++++++++- >> 1 file changed, 12 insertions(+), 1 deletion(-) >> >> diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile >> index 04df57b43cb1..650cfc5757eb 100644 >> --- a/arch/arm64/kernel/vdso32/Makefile >> +++ b/arch/arm64/kernel/vdso32/Makefile >> @@ -10,7 +10,18 @@ include $(srctree)/lib/vdso/Makefile >> >> # Same as cc-*option, but using CC_COMPAT instead of CC >> ifeq ($(CONFIG_CC_IS_CLANG), y) >> -CC_COMPAT ?= $(CC) >> +COMPAT_GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE_COMPAT)elfedit)) >> +COMPAT_GCC_TOOLCHAIN := $(realpath $(COMPAT_GCC_TOOLCHAIN_DIR)/..) >> + >> +CLANG_CC_COMPAT := $(CC) >> +CLANG_CC_COMPAT += --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%)) >> +CLANG_CC_COMPAT += --prefix=$(COMPAT_GCC_TOOLCHAIN_DIR) >> +CLANG_CC_COMPAT += -no-integrated-as -Qunused-arguments >> +ifneq ($(COMPAT_GCC_TOOLCHAIN),) >> +CLANG_CC_COMPAT += --gcc-toolchain=$(COMPAT_GCC_TOOLCHAIN) >> +endif >> + >> +CC_COMPAT ?= $(CLANG_CC_COMPAT) >> else >> CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc >> endif >> -- >> 2.25.1 >> > If CC_COMPAT is ever specified on the command line as clang (maybe by > some unsuspecting user), we'd loose all of the above flags. Maybe it > would be better to build a set of COMPAT_CLANG_FLAGS and append them to > CC_COMPAT, maybe like below? > Fine by me. > Regardless, the current approach works in my testing with clang 9.0.1 > and master (clang 11.0.0). This patch specifically is: > Good to hear. I will add your tags to the patch. > Reviewed-by: Nathan Chancellor > Tested-by: Nathan Chancellor # build > > ================================================================================== > > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile > index 650cfc5757eb..df5145fab287 100644 > --- a/arch/arm64/kernel/vdso32/Makefile > +++ b/arch/arm64/kernel/vdso32/Makefile > @@ -13,15 +13,16 @@ ifeq ($(CONFIG_CC_IS_CLANG), y) > COMPAT_GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE_COMPAT)elfedit)) > COMPAT_GCC_TOOLCHAIN := $(realpath $(COMPAT_GCC_TOOLCHAIN_DIR)/..) > > -CLANG_CC_COMPAT := $(CC) > -CLANG_CC_COMPAT += --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%)) > -CLANG_CC_COMPAT += --prefix=$(COMPAT_GCC_TOOLCHAIN_DIR) > -CLANG_CC_COMPAT += -no-integrated-as -Qunused-arguments > +COMPAT_CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%)) > +COMPAT_CLANG_FLAGS += --prefix=$(COMPAT_GCC_TOOLCHAIN_DIR) > +COMPAT_CLANG_FLAGS += -no-integrated-as -Qunused-arguments > ifneq ($(COMPAT_GCC_TOOLCHAIN),) > -CLANG_CC_COMPAT += --gcc-toolchain=$(COMPAT_GCC_TOOLCHAIN) > +COMPAT_CLANG_FLAGS += --gcc-toolchain=$(COMPAT_GCC_TOOLCHAIN) > endif > > -CC_COMPAT ?= $(CLANG_CC_COMPAT) > +CC_COMPAT ?= $(CC) > +CC_COMPAT += $(COMPAT_CLANG_FLAGS) > + > else > CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc > endif > -- Regards, Vincenzo