Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1844179pxy; Mon, 2 Aug 2021 11:40:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbgR9qY10WFGkTqQAteXXsuf+afWi73fE/LXeUGvw1sXKyMKx1ktUwt1zws4/ZzUA1X9LX X-Received: by 2002:a17:906:948f:: with SMTP id t15mr16867337ejx.85.1627929657857; Mon, 02 Aug 2021 11:40:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627929657; cv=none; d=google.com; s=arc-20160816; b=s9rl+xH48J3zb9Nzp8zcrjql7MyJpeGYg5iNAFgSI0j0rfUdpbXs1VIbIt7TBqqQcA WiDUiyUYPtMgL+wQkG/P1xbR6l93er8GI5tVvxvmOP7DrxF7WEzjSj+F6cck0SjmbsBc ES4UDpEoslGG1p6OI1VKr2bOYJdokJuNVZRIDQjLZ6/M4qJ37Mi6ExJeYrieRlbxU2cW unoaPJaFhKvPDYoquSn5U23TRM8D9R4XoBCFj3c8s6U1QucE6/wrpQr4pIy0NT76Arxc b5OlXvhYJyAhNkqWZAKZ6k/cH++SEIo1qtddr/Xcw9zbmR63qH8Q1+SKVxQt0Qbc2Bgp ujRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=WTdy23QqSO2DMUu2Ys+7R1vYJMU/74du8VLy/2Y4DPA=; b=nR81pC2SY9NMn9viOMxUnklLD4KbCLWT7q78rPMOoeDtbned6VTg1ONWwX9K24Ey06 qt/4DBWsrBpT5NdmDVtPuDC14WCKklceu0z9rAQbfY9VljdbHewL475yJObxCUIUxcxE TsVT1Sj0MnyiLBiokrfL9qf/COE3/AkHDf++8iDzkQn6biu9M2XOEnX4h3JwfL+iSSWv n8i5SSSTkAp6BJPeWewFGYt+hGDp8CzLvO/wc0/D/F2esaPNhDQGdmgJQ9M46+sVCjCe dP+yENm3+si2j+Zan7MPtTmmp2KF2qP2+QFgTjYzcemjgK9J8QoFVHzjNmPEEsW9UU45 PcXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vGeI3BYB; 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 r4si262692edv.196.2021.08.02.11.40.34; Mon, 02 Aug 2021 11:40: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=vGeI3BYB; 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 S229640AbhHBSj1 (ORCPT + 99 others); Mon, 2 Aug 2021 14:39:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbhHBSj1 (ORCPT ); Mon, 2 Aug 2021 14:39:27 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA869C061760 for ; Mon, 2 Aug 2021 11:39:17 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id e78-20020a2569510000b029059206351038so4955917ybc.22 for ; Mon, 02 Aug 2021 11:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=WTdy23QqSO2DMUu2Ys+7R1vYJMU/74du8VLy/2Y4DPA=; b=vGeI3BYBkGKRi6LHTihmZGbPjuFbs0b9QT5/pySpO0cIAIaUYmd5rtlYB7T4o43Sk4 cDi4l4mFb1gtH6ii4bX12t8K5wqQIUfT2M52ci3FV25/4kXPuTsYvkkQYQsTmU1vbahd LcsJqXOQycyQcdJrtUY/AaDnMMZfe72AYB/Z8djUZDn6drxtGFE1vi++B27uQ7IWCVDM 5HUlJY7Rk4pXHmVaz2tDSBMfV/7T0QpavDpABpYq3UZ4Ejh3MyIpZneo55Trjf3XMxhm EvnkVjJFpp689uLowYjggVmKbcClMvTXsvrPDL0dyqh8g+kvnsXSvEYKgaC9Ov92yahe fM4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=WTdy23QqSO2DMUu2Ys+7R1vYJMU/74du8VLy/2Y4DPA=; b=cMJNnLuHLV7+ANmUSpX0MnpNWpGU06t0WPPBck8bXUoisgEfU3MW1lF6oK/rF7mY3c RLcdAIFNCkjFZWhrd8f5PARoAJ+DY9eNjtlVfwC7SX2E+N1jxdxXMXhIhZS40iiIB8o3 8Vb4yXwZjdUizrmSYCnNKplgc+GFLuevSd954YudbEhfKOti3IFpurx41V2XTvwoSNy0 6C90cqQXJ1Y0P8mJpcj4t950o+YQXZA5yGsHq9nU4VsGn+b5iV5sKJ1DAu27w2h73tvt at6x32um3AdUKcK8r7oXLkAj6McmYX+v2XKdbi9gxbSkXIHszOijtfyrL/ILzNYy87Eg UfLg== X-Gm-Message-State: AOAM532TKhrb8WEqXRh5RAHkdUBBE2oe3XfAfPWPXoD5tq3O2lpC+ftE u2I48i3d+LKuGbLrN8pLYweGmmYvaeQThg3AoRI= X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:15c:211:202:3db0:42c:8665:a4ae]) (user=ndesaulniers job=sendgmr) by 2002:a25:1209:: with SMTP id 9mr23717204ybs.166.1627929556907; Mon, 02 Aug 2021 11:39:16 -0700 (PDT) Date: Mon, 2 Aug 2021 11:39:07 -0700 Message-Id: <20210802183910.1802120-1-ndesaulniers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.32.0.554.ge1b32706d8-goog Subject: [PATCH v6 0/3] infer --target from SRCARCH for CC=clang From: Nick Desaulniers To: Masahiro Yamada Cc: Miguel Ojeda , Fangrui Song , Michal Marek , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com, Geert Uytterhoeven , Christoph Hellwig , Linus Torvalds , Nick Desaulniers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We get constant feedback that the command line invocation of make is too long. CROSS_COMPILE is helpful when a toolchain has a prefix of the target triple, or is an absolute path outside of $PATH, but it's mostly redundant for a given ARCH. Instead, let's infer --target from SRCARCH, and move some flag handling into a new file included from the top level Makefile. Changes v5 -> v6: * Use indirection as per Linus. * Change hexagon triple to use -musl rather than -gnu. glibc doesn't have support for hexagon, and hexagon-linux-musl is the triple we use in CI. https://github.com/ClangBuiltLinux/continuous-integration2/blob/d659897d1700894d67feb64fe28e298da399a287/generator.yml#L53 * Pick up Fangrui's RB. * Reorder use of Env vars in documentation to use command line parameters instead, for consistency. Changes v4 -> v5: * Include previously missing first patch! Changes v3 -> v4: * Remove the requirement that LLVM_IAS=1 be set, as per Masahiro. * Remove the Documentation/ change from patch 2, as per Masahiro and Nathan. * Add Documentation/ change as patch 3, from Masahiro. * Reword commit message of patch 2, as per Nathan. * Change patch 2 oneline to refer to --target and CC=clang (not CROSS_COMPILE). * Carry Arnd's and Nathan's AB/RB/TB tags, confirmed ok on IRC+discord. Changes v2 -> v3: * Remove requirement that LLVM=1 be set. Instead, if building with just CC=clang LLVM_IAS=1 instead of LLVM=1 LLVM_IAS=1, you should use LD=ld.lld explicitly, or LD=aarch64-linux-gnu-ld. (As per Masahiro) Example: $ ARCH=arm64 make CC=clang LLVM_IAS=1 LD=ld.lld OBJCOPY=llvm-objcopy \ STRIP=llvm-strip -j72 defconfig all (It's still preferable to use LLVM=1 IMO, but this is maximally flexible.) * Change oneliner from LLVM=1 to CC=clang. * Update Docs slightly. Changes v1 -> v2: * patch 1/2 untouched. * Fix typos in commit message as per Geert and Masahiro. * Use SRCARCH instead of ARCH, simplifying x86 handling, as per Masahiro. Add his sugguested by tag. * change commit oneline from 'drop' to 'infer.' * Add detail about explicit host --target and relationship of ARCH to SRCARCH, as per Masahiro. Nick Desaulniers (3): Makefile: move initial clang flag handling into scripts/Makefile.clang Makefile: infer --target from ARCH for CC=clang Documentation/llvm: update CROSS_COMPILE inferencing Documentation/kbuild/llvm.rst | 19 ++++++++++++++++++- MAINTAINERS | 1 + Makefile | 15 +-------------- scripts/Makefile.clang | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 scripts/Makefile.clang base-commit: d7a86429dbc691bf540688fcc8542cc20246a85b -- 2.32.0.554.ge1b32706d8-goog