Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp632045pxb; Thu, 21 Jan 2021 16:13:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzjxR7OnuibOYeymWRwg/7uG9zQ4JhaY5Q4dYkzgqWMPHLYi2YkXO9fmioy5o4PGX/McVi7 X-Received: by 2002:a17:906:2785:: with SMTP id j5mr1221367ejc.527.1611274394767; Thu, 21 Jan 2021 16:13:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611274394; cv=none; d=google.com; s=arc-20160816; b=S4BklMOkJNr94iJN2DDQ64hSbCvlR53hUwsc5GIwMonmcXj1S9hhVY95nK3di995jK StkB5gh7Zkc1G/KxlSAgRJAm3T/RLlx4mMC43HhiHkQ+f+bhShboRQ9Do4K0u7vFFMK3 HSXfsPZTidfbONNR7N0Rbas7TKGQojXdO7Vfq9F49IE/XcoE4e3X3JRGUN/f4tyR0aeq YbWjEzeNGQqTw840n15VDyXq1m9pRJEZTo6ury84yadMiKPFKeHqs3Tm4I1/ZTOv0for oC/DtKGGrbHH3TW55uRb+QgOu9xdwUZhi9y9jKLc9M1i7WHCitCR4rs1iR74bIZgRaCv 1V2g== 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=B+c6Vsc2Hr1NYtehFNtn1wrNndygwXtWUpkJB2b6HZE=; b=ng8/OXN6vpxHGa9OutzCUoeMi9+EqGFlKky2vOcQV7vgv+QkYBGxpV5vOtQxS6n5b0 k/fr9wttloPUoV93CEWkAwFYULcW0TJ2KNNL62B39YKNKKU2tTzrOp33EuLl5ONqT+Xb 2C/RlDTq+iqbp40jy0w89o4wlDrxHzDQA/ZqFP4uZEi3+cz5z9eNtFKSxSb3+8JU1d8W Ho9zQjokBI6PQcIi3CEmOiUPhaWLOpHZhH6PpzzEmzVhrwT3xi0etsVhO5H1T/YVY/Io 5Lzn9QReNE8VzlZo6qdc0Mlg58QC9kxsG/q9bUciPXfit6H12zQVz500ZDaqJz8O01Hv yHOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WEZB+ES+; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o19si2973211edz.565.2021.01.21.16.12.51; Thu, 21 Jan 2021 16:13:14 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=WEZB+ES+; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726438AbhAVAFe (ORCPT + 99 others); Thu, 21 Jan 2021 19:05:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725827AbhAVAF0 (ORCPT ); Thu, 21 Jan 2021 19:05:26 -0500 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6048CC0613D6; Thu, 21 Jan 2021 16:04:46 -0800 (PST) Received: by mail-yb1-xb32.google.com with SMTP id i141so3855225yba.0; Thu, 21 Jan 2021 16:04:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B+c6Vsc2Hr1NYtehFNtn1wrNndygwXtWUpkJB2b6HZE=; b=WEZB+ES+30vwtfjjodlhKEup0jmMLyCGmrbtCm3IUoybNmf2N7/LEXpV/v/bgvKc09 PgisUMPbDi0b57bzVFA0mllJMVs1+P9zIYj9n1jqxfBlhufm0JenhwBVo8ZETy4JWQeS a9GQIYWFYd0BG7KMltMbO/SSf2voBrX/jcTkJTx7sqaX42bcmPaR037jzXnlhaJAHze2 GbUPuKfRFSI3hXtDuBPMt8dp4lAG64jWKREN8nbsGV9k0R0Znq4rlsPaa4n5x2qTx3F3 prB5gATlF6XIoLQJdytoHS1L0u9iLlKx2hHP8ojsX4LkMrkT9jhB6vgANAtD0IecrcNc 5mWg== 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=B+c6Vsc2Hr1NYtehFNtn1wrNndygwXtWUpkJB2b6HZE=; b=r6ceAPq1uKbAbxhY4cqTy8F43z0wXw3TgYCoGBu3Mc/O/si+/mBDHCKIdtrXad9pQD UX+NGnIuP+6pjki2KfP3aNCB761qPnBae+FyqOXR5Fc+LIWxatLGirNfQwYJpGU4POE8 TmAKaLLiIcATNxG1Dtlb2VHqXJB/e1MoA1qit8HZH6wXJMh70ikmFL05vgmLC5u1GTax UkTprJaGzzK5H6HKboM1uk53y3tifhgSczKg74NnTrLq8oHTVD7BvXa5517TEhg4+K3N OyN9YxdDzlOB/O3SYINnBoToTuB1MdmTzbEEFvNVcCa3iaVXcM+i+g9wywsCMTR6SghL vQQA== X-Gm-Message-State: AOAM531XuhSzNPDQAdvt8qV3EVCZifWe5FskH1kYW/g/K2ESuooyAagN hFU6/9pzKIO6gS6WdMYitqVGAfy9TVcDMnKq5aA= X-Received: by 2002:a25:d6d0:: with SMTP id n199mr2624997ybg.27.1611273885731; Thu, 21 Jan 2021 16:04:45 -0800 (PST) MIME-Version: 1.0 References: <20210116095413.72820-1-sedat.dilek@gmail.com> <20210120223546.GF1798087@krava> In-Reply-To: <20210120223546.GF1798087@krava> From: Andrii Nakryiko Date: Thu, 21 Jan 2021 16:04:34 -0800 Message-ID: Subject: Re: [PATCH RFC] tools: Factor Clang, LLC and LLVM utils definitions To: Jiri Olsa Cc: Sedat Dilek , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Quentin Monnet , Jean-Philippe Brucker , Tobias Klauser , Ilya Leoshkevich , =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= , Yulia Kartseva , Andrey Ignatov , Thomas Hebb , Stephane Eranian , "Frank Ch. Eigler" , Masami Hiramatsu , "David S. Miller" , Davide Caratti , Briana Oursler , Networking , bpf , open list , "open list:KERNEL SELFTEST FRAMEWORK" , clang-built-linux Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 20, 2021 at 2:36 PM Jiri Olsa wrote: > > On Sat, Jan 16, 2021 at 10:54:04AM +0100, Sedat Dilek wrote: > > When dealing with BPF/BTF/pahole and DWARF v5 I wanted to build bpftool. > > > > While looking into the source code I found duplicate assignments > > in misc tools for the LLVM eco system, e.g. clang and llvm-objcopy. > > > > Move the Clang, LLC and/or LLVM utils definitions to > > tools/scripts/Makefile.include file and add missing > > includes where needed. > > Honestly, I was inspired by commit c8a950d0d3b9 > > ("tools: Factor HOSTCC, HOSTLD, HOSTAR definitions"). > > > > I tested with bpftool and perf on Debian/testing AMD64 and > > LLVM/Clang v11.1.0-rc1. > > > > Build instructions: > > > > [ make and make-options ] > > MAKE="make V=1" > > MAKE_OPTS="HOSTCC=clang HOSTCXX=clang++ HOSTLD=ld.lld CC=clang LD=ld.lld LLVM=1 LLVM_IAS=1" > > MAKE_OPTS="$MAKE_OPTS PAHOLE=/opt/pahole/bin/pahole" > > > > [ clean-up ] > > $MAKE $MAKE_OPTS -C tools/ clean > > > > [ bpftool ] > > $MAKE $MAKE_OPTS -C tools/bpf/bpftool/ > > > > [ perf ] > > PYTHON=python3 $MAKE $MAKE_OPTS -C tools/perf/ > > > > I was careful with respecting the user's wish to override custom compiler, > > linker, GNU/binutils and/or LLVM utils settings. > > > > Some personal notes: > > 1. I have NOT tested with cross-toolchain for other archs (cross compiler/linker etc.). > > 2. This patch is on top of Linux v5.11-rc3. > > > > I hope to get some feedback from especially Linux-bpf folks. > > > > Signed-off-by: Sedat Dilek > > --- > > tools/bpf/bpftool/Makefile | 2 -- > > tools/bpf/runqslower/Makefile | 3 --- > > tools/build/feature/Makefile | 4 ++-- > > tools/perf/Makefile.perf | 1 - > > for tools/build and tools/perf > > Acked-by: Jiri Olsa > It's pretty straightforward and looks good for bpftool and runqslower, but I couldn't apply directly to test due to merge conflicts. Also, which tree this should go through, given it touches multiple parts under tools/? > jirka > > > tools/scripts/Makefile.include | 7 +++++++ > > tools/testing/selftests/bpf/Makefile | 3 +-- > > tools/testing/selftests/tc-testing/Makefile | 3 +-- > > 7 files changed, 11 insertions(+), 12 deletions(-) > > > > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile > > index f897cb5fb12d..71c14efa6e91 100644 > > --- a/tools/bpf/bpftool/Makefile > > +++ b/tools/bpf/bpftool/Makefile > > SNIP >