From patchwork Thu Jan 19 18:31:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 45896 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp486745wrn; Thu, 19 Jan 2023 10:44:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXsoO8VvvTmWDxxf1N431p1k9RUm5q/1oABfVC57H8w8Vc4S8ANDKgfaM7lGyt3jMHEqKCX2 X-Received: by 2002:a05:6a20:d80e:b0:ac:b2a3:e39c with SMTP id iv14-20020a056a20d80e00b000acb2a3e39cmr11449726pzb.62.1674153887291; Thu, 19 Jan 2023 10:44:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674153887; cv=none; d=google.com; s=arc-20160816; b=BmD58YTeO82C7rZYxIe26BMiqrFHCAVdL16rkYJWg1LkyO0Um7W3WBaPiGCevL8R/o aavLVVX8tiHdUHoWiJnCjwbp4aXympv2puBBJ46RNhwPEv4FhgAkApbaV+lwfn+KExwq 3gBdtswEyGIKr1INlQfeK/qqMbATEDvxWFfyzO2Jx11wJ7VDRvp/TVpveLyiGGwoExRQ Z3J6sGh7rNnsJjLRnvmcHtooPvc3nU2mRDBOWW4jSqCqAxqyHOjSlS7RA9ehimOETDdp dpUFI2y5z6n8CCGeTqm40LuEpiJR4GEne9JK3AHjkaI2gcMsHC38yL1kml+QQbcdqlpg fayg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=XyXhvPvPbADpaSv/EYaQvarEBuQZacwnWp/5FIvc94s=; b=tr03PyhRHg7gnorU/RC7G9Ri07DgDC0UpShRfZWn+9/xDayy52Kqg9E7wk2BkU0H70 AA1+o0jztybghzW6zWSTPMo2FEh991X8WMfM8DHJgMxizSuXN4pulpot1q84LDcCoNs3 UXvVX2lbQvDJrYCFa19G2Vpz+XaPQuJM5srdG/TXkYagvX4FPxZbFCMdpfWn3o2Qzp6E sSh6PcJlyJvtEBvFFo9ezn1NPHbnngIJDvsBIlI38ClLMq2lS73kZrbX3Bl5jot9ah3F GHFYSPlg2lu2y5P0lZGXGaHoq3Gd89AFJViCuHPO/WZUnPjgNlsbPtfoSNxgO5aMw3Cm n9lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=dUXnT88T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e63-20020a636942000000b004d23a59d6e9si2019082pgc.373.2023.01.19.10.44.35; Thu, 19 Jan 2023 10:44:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=dUXnT88T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230303AbjASSbo (ORCPT + 99 others); Thu, 19 Jan 2023 13:31:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbjASSbk (ORCPT ); Thu, 19 Jan 2023 13:31:40 -0500 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 544F175A37 for ; Thu, 19 Jan 2023 10:31:39 -0800 (PST) Received: by mail-pl1-x64a.google.com with SMTP id u6-20020a170903124600b00188cd4769bcso1827659plh.0 for ; Thu, 19 Jan 2023 10:31:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=XyXhvPvPbADpaSv/EYaQvarEBuQZacwnWp/5FIvc94s=; b=dUXnT88TH2X/cpMgLnC/jDim2bvVeneZtEmqqSsTVO+h3X/PsM+8YkeiPvU8ZQevzK Zn4T2ff7XcwlgxMq6h9V5y2e3yHL+hYcJZ/ojweALCJFZICxQl8Fsy3e+fZ2yAFMj2gl K1kmwYEsi1V7TNTsLu+fyq4tEgA6H1KjmzyksYGbA0TG5R2RDMOxtEN8jNIXvLmB6Fsp Lq/pLiQAnxNuvSPRsfzFvj9lcp1BCon/lS5gVIy/b/INatUUqVF9IcxCv/H6BxuPFLFI xbgAQEzjCQwJcOkE0tZR4SgoVqD0CH9QMwJzoTZChK1QvzubxA4nmkGwN3cFaoQOkSeO BzXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XyXhvPvPbADpaSv/EYaQvarEBuQZacwnWp/5FIvc94s=; b=qRfG6phKK8mgXXnjPTerONR+PidcxMuvhWJ5mxEoxQphOErqX9Ckhs9++l3b2XXG1I PEnzwG5Mb/Re0cRpgkaapsFLvUdYaNsYnz6JnbhH67prvEG7v3IcRlbxA80dgdB7SsP1 fR2azA3fEQxc9AUjBnDsnsZCZTui7n+V4t46m7ltPSOEKGZ4py/ySDmnKJmjBWdVFEGN qckhBNsXKtmtHTVTjNmQa7zniCyWkNEGlmXU6TrPT0ut/IagetNML3hb/GpXZdmWhON3 ARtiy+dxCQ1I43xX4TAx/1qgII5M6nTG45Ju4TwpQ0iy3zDSSwL7eIXJ9PbbDfMJBu2d +tzg== X-Gm-Message-State: AFqh2kr2AlK0sdd8uPwooFz9OdSn4lcTjy028DUUlP+yS4p3ZT4ZlTOt ZztkqmVb16lAcNqdO8/JdifYvsSwguzb X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:93c6:b65e:5f33:bc6b]) (user=irogers job=sendgmr) by 2002:aa7:8f95:0:b0:58d:a316:b578 with SMTP id t21-20020aa78f95000000b0058da316b578mr1125043pfs.58.1674153098798; Thu, 19 Jan 2023 10:31:38 -0800 (PST) Date: Thu, 19 Jan 2023 10:31:17 -0800 In-Reply-To: <20230119183118.126387-1-irogers@google.com> Message-Id: <20230119183118.126387-2-irogers@google.com> Mime-Version: 1.0 References: <20230119183118.126387-1-irogers@google.com> X-Mailer: git-send-email 2.39.0.246.g2a6d74b583-goog Subject: [PATCH v3 1/2] tools/resolve_btfids: Install subcmd headers From: Ian Rogers To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Connor OBrien , Nathan Chancellor , Ian Rogers , Kumar Kartikeya Dwivedi , bpf@vger.kernel.org, linux-kernel@vger.kernel.org X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755477586775436248?= X-GMAIL-MSGID: =?utf-8?q?1755477586775436248?= Previously tools/lib/subcmd was added to the include path, switch to installing the headers and then including from that directory. This avoids dependencies on headers internal to tools/lib/subcmd. Add the missing subcmd directory to the affected #include. Signed-off-by: Ian Rogers --- tools/bpf/resolve_btfids/Makefile | 19 ++++++++++++++----- tools/bpf/resolve_btfids/main.c | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile index 19a3112e271a..76b737b2560d 100644 --- a/tools/bpf/resolve_btfids/Makefile +++ b/tools/bpf/resolve_btfids/Makefile @@ -35,21 +35,29 @@ SUBCMD_SRC := $(srctree)/tools/lib/subcmd/ BPFOBJ := $(OUTPUT)/libbpf/libbpf.a LIBBPF_OUT := $(abspath $(dir $(BPFOBJ)))/ SUBCMDOBJ := $(OUTPUT)/libsubcmd/libsubcmd.a +SUBCMD_OUT := $(abspath $(dir $(SUBCMDOBJ)))/ LIBBPF_DESTDIR := $(LIBBPF_OUT) LIBBPF_INCLUDE := $(LIBBPF_DESTDIR)include +SUBCMD_DESTDIR := $(SUBCMD_OUT) +SUBCMD_INCLUDE := $(SUBCMD_DESTDIR)include + BINARY := $(OUTPUT)/resolve_btfids BINARY_IN := $(BINARY)-in.o all: $(BINARY) +prepare: $(BPFOBJ) $(SUBCMDOBJ) + $(OUTPUT) $(OUTPUT)/libsubcmd $(LIBBPF_OUT): $(call msg,MKDIR,,$@) $(Q)mkdir -p $(@) $(SUBCMDOBJ): fixdep FORCE | $(OUTPUT)/libsubcmd - $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@) + $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(SUBCMD_OUT) \ + DESTDIR=$(SUBCMD_DESTDIR) prefix= \ + $(abspath $@) install_headers $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OUT) $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(LIBBPF_OUT) \ @@ -60,14 +68,14 @@ CFLAGS += -g \ -I$(srctree)/tools/include \ -I$(srctree)/tools/include/uapi \ -I$(LIBBPF_INCLUDE) \ - -I$(SUBCMD_SRC) + -I$(SUBCMD_INCLUDE) LIBS = -lelf -lz export srctree OUTPUT CFLAGS Q include $(srctree)/tools/build/Makefile.include -$(BINARY_IN): $(BPFOBJ) fixdep FORCE | $(OUTPUT) +$(BINARY_IN): fixdep FORCE prepare | $(OUTPUT) $(Q)$(MAKE) $(build)=resolve_btfids $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) @@ -79,7 +87,8 @@ clean_objects := $(wildcard $(OUTPUT)/*.o \ $(OUTPUT)/.*.o.d \ $(LIBBPF_OUT) \ $(LIBBPF_DESTDIR) \ - $(OUTPUT)/libsubcmd \ + $(SUBCMD_OUT) \ + $(SUBCMD_DESTDIR) \ $(OUTPUT)/resolve_btfids) ifneq ($(clean_objects),) @@ -96,4 +105,4 @@ tags: FORCE: -.PHONY: all FORCE clean tags +.PHONY: all FORCE clean tags prepare diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c index 80cd7843c677..77058174082d 100644 --- a/tools/bpf/resolve_btfids/main.c +++ b/tools/bpf/resolve_btfids/main.c @@ -75,7 +75,7 @@ #include #include #include -#include +#include #define BTF_IDS_SECTION ".BTF_ids" #define BTF_ID "__BTF_ID__"