Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1762241pxv; Fri, 2 Jul 2021 11:31:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1RKYxIdAxgvdouxwP3e9CXa52V6TutAuoqhMSfTVPJB9t65tjxtaydsAdYbwGhuSeaj7b X-Received: by 2002:a17:906:538c:: with SMTP id g12mr1091145ejo.245.1625250666598; Fri, 02 Jul 2021 11:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625250666; cv=none; d=google.com; s=arc-20160816; b=VLtRnv8i680CB2wmPhKe2QWphzpd2z4x7sLRMCdt31YPnA4mzfctDwZunz/Ojdv/Bu oVxO/9VdoeLQfY+myiAYlyJfthjV2HzfyclIpFbyAcSEWQjohONkRmcX7fD2nVmN4yTV EyO7VANF38dw+ii31f0DDjq3oKD0f3K8Fg1YXuXsdx+1VkXxDxxgTj4tWHKYcSLDRRT+ AOrvRNKnAxKyeqYJAfHEzAmNuF2Rfcm0/h4HW/kINX7rlH0HB2IcxIfs2LP66ixTw/O2 zW18WH5slOXXwhdH2CS6YoZ8Ha3M8syKvU8UAHEg5/nwo/rWYOuSVg2RVr9PEOiRC/SV X9vA== 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=Uke8QP8jDT0ISFCLZ021BNSpKYLqzZN1MQPfd1lmORs=; b=av54vy7tYmYuIhGXa/qCoP0o5Mkabtx5n9lymvN/kWbIsDL2YxSItQYrJZn52e/yHy cSMK19qk0K6DtQ6sYAWOCsmLJ2hxXLyAD3ftcEcPF+sFWQROscokkxwevGGlEHQEODOH QPGq3zJ1o5wnX6YEsvOkyhl3ZSwF0U6/L0GzFSnqXRt5YrQVESloJ9fU4hkTfLWqMurB awi/UOvYD2j3d3nDqL8hUcN+q15bjMbiy8EKr8x6dMo+N4O3iyhZ1Yiqjtmbp7cbpiCc 8OgBtYn0rwGr7vozlSd89cCsLSOVcinfKaX7iFMRkoEHarDfsUNvqyCqZ28etI/RUhC7 jOaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Go8dlU4p; 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 z17si3558878edq.547.2021.07.02.11.30.41; Fri, 02 Jul 2021 11:31:06 -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=Go8dlU4p; 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 S229794AbhGBScR (ORCPT + 99 others); Fri, 2 Jul 2021 14:32:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbhGBScQ (ORCPT ); Fri, 2 Jul 2021 14:32:16 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E179C061762 for ; Fri, 2 Jul 2021 11:29:44 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id u25so14475091ljj.11 for ; Fri, 02 Jul 2021 11:29:44 -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=Uke8QP8jDT0ISFCLZ021BNSpKYLqzZN1MQPfd1lmORs=; b=Go8dlU4pYH27zAulQl0JEeWem+aLHmXx6lAAGJ5RX5Th1L0JIkmbQVShEOdiuVEDNe w5McMXyT7OkESj6bjNOMryjuUhU2GQF+fPvFWY1eHUaIvxmaNLXDsD/pbV7HRZAgw30w y6+fbNTxPudDQKN5uoia56HylE+fS2vPHOr9iOOoKN1rpFYdxoM4U5gNOZ2ze+F3C4v3 9uC36SUCTgF+fD9Pkiz1s1vxUBCuIxF6x87F2z2W3jLZQjRdBrfV+Rw4pt6Tme03aX9E rH8yBm5gt/MbY1wQbj8f3CFMaWe8B6zwgsv7SVQybImoBY3Qtq2/TrhFk/xWza2nK/Mr pQVg== 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=Uke8QP8jDT0ISFCLZ021BNSpKYLqzZN1MQPfd1lmORs=; b=oftC4BgOPJWGwnDWTh8TAjFjQMaTAIlwmI/aTlyzWHfwqadQsliuLmssqSpcu/o1yi u2M6BZAgkpY9f5CerlJmhhvciOFaWvO1gIsje9Ja+5VaI7l7qkJJ6TcwgRpWS5+0meui A4RWcPVCPwlitg7L08qUmFZTrRAEi3EPQVVzp9AJe6mjCyOq6W0NplvL4+9l2chuo8sL QrYTWH9dce5FtB+kickNjIIh6nuhNN0JH7X1veYJdYW6annDqH+3LKjUAWvmMXwc5IGZ Bp9GpxPq6ZAqoRvDDOfrpHx9S0bot3nWkWSSaD/g/pM/Vran4FBSDhM/B9RpJWztReSR xRlg== X-Gm-Message-State: AOAM532j99zo5rA2OSpOaeuCHQpyxPK3wCRLOEOOpHZ3DwztVIh1dtFi vldFB6rdk39JydJkSxwy/Kj5A1+kbyvOt3dpeVoiwQ== X-Received: by 2002:a2e:5c03:: with SMTP id q3mr574881ljb.233.1625250582245; Fri, 02 Jul 2021 11:29:42 -0700 (PDT) MIME-Version: 1.0 References: <20210701235505.1792711-1-ndesaulniers@google.com> In-Reply-To: From: Nick Desaulniers Date: Fri, 2 Jul 2021 11:29:31 -0700 Message-ID: Subject: Re: [PATCH] arm64: drop CROSS_COMPILE for LLVM=1 LLVM_IAS=1 To: Arnd Bergmann , Masahiro Yamada Cc: Catalin Marinas , Will Deacon , Fangrui Song , Nathan Chancellor , Linux ARM , Linux Kernel Mailing List , clang-built-linux 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:59 AM Arnd Bergmann wrote: > > On Fri, Jul 2, 2021 at 1:55 AM 'Nick Desaulniers' via Clang Built > Linux wrote: > > > > +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) > > +endif > > +endif > > +endif > > I think only the "CLANG_TARGET :=--target=aarch64-linux" line should > go into the > per-architecture Makefile. It doesn't hurt to just set that > unconditionally here, > and then change the CLANG_FLAGS logic in the top-level Makefile to use this > in place of $(notdir $(CROSS_COMPILE:%-=%)). I don't think we can do that. Based on the order the arch/ specific Makefiles are included, if we don't eagerly add --target to the KBUILD_{C|A}FLAGS, then cc-option, as-option, and as-instr macros (defined in scripts/Makefile.compiler) checks in per arch/ Makefiles may fail erroneously because --target was not set for KBUILD_{C|A}FLAGS yet. Another issue is the order of operations between the top level Makefile and the per arch/ Makefiles. The `notdir` block you reference occurs earlier than the per-arch includes: 609 TENTATIVE_CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) ... 648 include $(srctree)/arch/$(SRCARCH)/Makefile We would need the opposite order to do what you describe. Reordering these would effectively be a revert of commit ae6b289a3789 ("kbuild: Set KBUILD_CFLAGS before incl. arch Makefile") which I'm not sure we want to do. But maybe there's another way I'm not seeing yet? -- Thanks, ~Nick Desaulniers