Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1736318pxv; Fri, 2 Jul 2021 10:51:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQHVZSqyQ4onqbntlNvL0CmuxZ0iT9dHLkHMGerc3hAvIHoDcA8PKzuOJK0XMdU0LKQXDW X-Received: by 2002:a17:907:1b1b:: with SMTP id mp27mr940537ejc.538.1625248317118; Fri, 02 Jul 2021 10:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625248317; cv=none; d=google.com; s=arc-20160816; b=Ike4R2NxJ4k/IffwhnrppP381GCcFxYhIyRAKmrP7saxvPvrKkUH+OPOait5CR66V3 J6Igm+lKyNxEHXCmW1qLHbQ3IR030QL0QNLUKnqaVexIfvDMFe+yaFiwXg94qyfvrC6B o/pqk2kcO+3m/jPndWsE4iq/JCKBif43yOIXDEf/M2bZNa1gPCa8FALpGEbBCi/3gYZN X66pgWQ4wwTUu9HIE/k0/NCewdztoFMC7IolNHcejhym/8IwH77HK2VZlpwvEqpOkA7L i4F99GzjgdKBzQWYA8FTkmEqnQG5jXuQmEx7U//qc1nxdMbQVyWvHNqcCUxMn+n/SxTG mjBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zR51Y6h156fP4t9AhpZig8/jxWVXQ+2FTjT81KZ0jSA=; b=iOiSQ1jmcnwAmIXMFcujliQQtq8KiLb1V1XBYK+7elGHJXNo0JZiW8w3//Nb8S7qpa qVsGQINChQzLHgFQEY9gHh3w95ttFKOvP5Xa1XqElbW77lZkA99Mit2c+QfEikjgcORh PsIOA6F/mwgFxqehUT9cDkIl6rC6B1eS/7p89AwmmC9+ZYTddsd1JlWOtqZ49l3k/768 hsq0BEaYtHvbhLRQP7QHl3cbUanBBpbllBtEWLA4hKJ6RkZbQiGTHj6W+uPNW4TQHlBK yfL1WBpPhai6ESOeOGVcC7uQC3qxeUNmPBejdsY1Rz1C654gyc7DAXkyxGLl1s8Y2l4J M08g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=g49VPuys; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id em20si4048962ejc.0.2021.07.02.10.51.30; Fri, 02 Jul 2021 10:51:57 -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=@google.com header.s=20161025 header.b=g49VPuys; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230050AbhGBRxN (ORCPT + 99 others); Fri, 2 Jul 2021 13:53:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbhGBRxM (ORCPT ); Fri, 2 Jul 2021 13:53:12 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 410C2C061762 for ; Fri, 2 Jul 2021 10:50:40 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id n14so19488271lfu.8 for ; Fri, 02 Jul 2021 10:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zR51Y6h156fP4t9AhpZig8/jxWVXQ+2FTjT81KZ0jSA=; b=g49VPuys7EfuGjk1eCwTXbUhJJcFFvyUx8xiIMf7j9ljZsVsOblhEm4eiMsysTdr9M 6YM4p/q3Zz7OogZTfu6sAcKZ/ecdzJfuncl2Syhg8geFftCt0aixmYwd0FoFFIWiVSRL vo65eLuW7s6vQcVTfXrphsislc5+gPSFtU2Zb6mb2Pjq/Z2bgeTjjd7UhODa42hJhSnt o4BwnoH0/CoouVK2fX33CK8aHIUQIKtsWJVpHUEXcAGilj2cqSgZNVjUwyauo3GMbY+z 1hmkx+f6/L6Eb9PZkKuSG2kjI7Aa6qrJa4dPgbSsF1YlPr9fN8G1O7En0Uml3YSUa0Dn iqyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zR51Y6h156fP4t9AhpZig8/jxWVXQ+2FTjT81KZ0jSA=; b=t+LLu3DtWKx43PnhUzG3XQVpzvi7QLlUhpTMSE7flP5alJvQ+vewPrDTcXGlLnutcW W0RiyRkRNvPcgKQ/fe/jEBW3ebua9B3sYwEBzNzmdCjiNPfpLjui1lsJB0T4bZypOrGN RPEN9oiHX2jYIqzx8cPhVO1VuiVuKkD7/BSsW3B88NWXlmEOng/USlbhgMG8X2AgzsIf 24ZhbcH+Y0M0KQ+GFRem62UD5VqV/0r9EaOTdSy4uLedFQ5Ahy968rijAoRTj4Ca4tIK GWxG6Hdh4jwGZXzzCluEh/nyh/gJqfoFLrmAN2D7xP7FxFs6erTKAO7shHjxD+qI2oOx Y4xw== X-Gm-Message-State: AOAM5303j2vTZnNMEeQTm3mkjZddEUhSDe41l82GnyoRripQEnyfSFbi MLdUXUJGrbBLPUfqXKWloN45haEtQLGJSuFow74aBA== X-Received: by 2002:a05:6512:3884:: with SMTP id n4mr577583lft.547.1625248238229; Fri, 02 Jul 2021 10:50:38 -0700 (PDT) MIME-Version: 1.0 References: <20210701235505.1792711-1-ndesaulniers@google.com> <20210702112210.GA11084@willie-the-truck> In-Reply-To: <20210702112210.GA11084@willie-the-truck> From: Nick Desaulniers Date: Fri, 2 Jul 2021 10:50:27 -0700 Message-ID: Subject: Re: [PATCH] arm64: drop CROSS_COMPILE for LLVM=1 LLVM_IAS=1 To: Will Deacon Cc: Catalin Marinas , Masahiro Yamada , Arnd Bergmann , Fangrui Song , Nathan Chancellor , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 2, 2021 at 4:22 AM Will Deacon wrote: > > On Thu, Jul 01, 2021 at 04:55:05PM -0700, Nick Desaulniers wrote: > > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > > index 7bc37d0a1b68..016873fddcc3 100644 > > --- a/arch/arm64/Makefile > > +++ b/arch/arm64/Makefile > > @@ -34,6 +34,17 @@ $(warning LSE atomics not supported by binutils) > > endif > > endif > > > > +ifneq ($(LLVM),) > > +ifneq ($(LLVM_IAS),) > > +ifeq ($(CROSS_COMPILE),) > > +CLANG_TARGET :=--target=aarch64-linux > > +CLANG_FLAGS += $(CLANG_TARGET) > > +KBUILD_CFLAGS += $(CLANG_TARGET) > > +KBUILD_AFLAGS += $(CLANG_TARGET) > > Do we need to do anything extra for the linker here? I can't see how we > avoid picking up the host copy. That's handled by the top level Makefile when LLVM=1 is set. There is $KBUILD_LDFLAGS, but we don't do anything with it at the moment in terms of which linker we select; $LD controls which linker we use. LLD can figure out the target based on the object files it's given as input, so it doesn't need any `--target=` flag. When clang is invoked as the compiler or assembler, it does need --target. > Have you tested the compat vDSO with this change? I think we'll just end > up passing two --target options, which is hopefully ok, but thought I'd > better check. Good catch. We don't reuse KBUILD_CFLAGS or KBUILD_AFLAGS for the compat vdso for this very reason. In arch/arm64/kernel/vdso32/Makefile you'll see no references to KBUILD_CFLAGS or KBUILD_AFLAGS; instead we use VDSO_CFLAGS and VDSO_AFLAGS in their stead. But, we could (and should) make this same change for the compat vdso, and drop the need for CROSS_COMPILE_COMPAT for LLVM. Let me play around with the changes Arnd suggested and see if I can get that working. I'm a bit nervous about making this depend on something from the top level Makefile on initial glance; these changes start to become tree wide rather than isolated per arch/, but let's see. Maybe at that point we carry a series in the kbuild tree with acks for the arch/ specific changes from the respective maintainers? Either way, I'll send a v2 that nixes CROSS_COMPILE_COMPAT for LLVM. -- Thanks, ~Nick Desaulniers