From patchwork Wed Nov 16 22:46:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 21317 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp99479wrr; Wed, 16 Nov 2022 14:49:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ats3zbbpPPPux1pEdqEJFQI7SHaehilFE5YsTjOsVeZ4uhxTws8SDbkOxDQ7SZ58l3RQn X-Received: by 2002:a17:907:119a:b0:7ad:b45d:810c with SMTP id uz26-20020a170907119a00b007adb45d810cmr20026044ejb.181.1668638961883; Wed, 16 Nov 2022 14:49:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668638961; cv=none; d=google.com; s=arc-20160816; b=nji9Wf+N+zGila3nOwULDMOVg25ctywrCKIHzJ8vAYGI+834hRDYqzWbf8Oqk4malv C3T0ql8/IAstrcYSHl68rO2yoa7GGBMMh2aO886RZ2NaRWmyH/FprJzn26zV5+nk4Uz3 Sz6vFlR06yxFXK4S+p2bRN2/GNAcEv8+ECrbKeTwnVLgBXXwAbcs5ssOtIFxKuzqMhpN wZS8RWHCuuCrQYwqA9qxso9TTKNXZ/avqmSFzHoPqh5xxp7EDLyVdPJ1+jlI3pfTLImB hSTeN3HSwzCRXxHeRw+IeEhd5+aWHgQiLVmOAEpNRqhiiSYyM16HcfcUZ3qnc2ddEbHC vnDw== 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=ECsizzUPW5YOb7oAQXRNb+Xilf4/6y3zdt9/ywk2ZNg=; b=d+GXfbofp0lm5mBmaOIEe8/B+HhubmlLewHcc5syerWXr8Dm4Pm8YAJrSJL6rCfpX0 aV3ib2kf0v3reC07LcRugdMS6M6TIoPnavI3Dhrn/zKRTwSjvLPDxPM8bauzv3INSQ2G xIZ2ZWLcNBOUM6joHJOfYfBaHTuQBiWouBZ8Qup1B6fjDHJpPhKFuTxL2Ye+Zk/EBxU9 2dvR4iMvEoVu3bBehAuvegwWOCWX6+OyNf6z4z1wTVcIqy7jCd5mRW4Ykv1rs9mgx+74 WhfhPMaSNS6kOi/IVoqU5n05rgqmjZs11SVs5E4B/8m30EyVhlI4MJDJDi/bW85J/l/g cNpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="qNC0+/AK"; 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 n19-20020a05640206d300b00458ea275c22si13091980edy.325.2022.11.16.14.48.58; Wed, 16 Nov 2022 14:49:21 -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="qNC0+/AK"; 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 S234458AbiKPWrW (ORCPT + 99 others); Wed, 16 Nov 2022 17:47:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239133AbiKPWqw (ORCPT ); Wed, 16 Nov 2022 17:46:52 -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 A34CF6DCCB for ; Wed, 16 Nov 2022 14:46:46 -0800 (PST) Received: by mail-pl1-x64a.google.com with SMTP id x18-20020a170902ec9200b001869f20da7eso14890420plg.10 for ; Wed, 16 Nov 2022 14:46:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=ECsizzUPW5YOb7oAQXRNb+Xilf4/6y3zdt9/ywk2ZNg=; b=qNC0+/AKAGeX7QXSDmOijuSzD2DiyM9sVGtBjQ1/WbBZTIsLX7UfefxzoDCmh+c0FV kKc+5FpNGTnvySO8PwEYHs/O0o1wL5InFD6wxutOJ3qHyn+G8ABP2WOOLpgW6maSPeez K/ln6bD+PAEyrmoUp3sHHwJ/aho+eRdjcfkYfBlqmco+sQEio9Yz5txQeXR3hSbcDetU nc1vOiKMDCBFO/LfQcRoC7WHtMmYfbK1k9pfB4UuIPj2xZS9qebD8XgvQEoDEu8juXoV /iMZDiObHA4YlXBjtHUtb5UySCVZGgNaU7ke3DjhIdaDWDnzybrAUTwkHZJtvH+maS4S ZAZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ECsizzUPW5YOb7oAQXRNb+Xilf4/6y3zdt9/ywk2ZNg=; b=vLPaqILYKGja3m72GdNG39PdPYeAmjAhqegNCXQec0Pe7xJCPQClV+xXO1vAZdqdR6 QLbsVaAdyOeiKZUisuq4itgvgQyH5mxChU7nERh/pgjsHYXm0eCx2oN0PyEpEcmxye7Y hiJx5r19ZedfwhogTFFVY3PD7/pi81NrMWmGEKZxE79c/5BF8074DVV1u0ueNJ2Wlot9 J4hsr0W4eWvSQ16t7aYnWLQcby88qUI4PKsgvUvUXXKOJC7UsbrqRrQq6QBn32JFIt9e D1LQfFiVMaC69duo7ugQtLjHvUGmxrqb9WqSpIiF1bG6Qu6IFOMMBDdEYotxoGa30Czh lZlw== X-Gm-Message-State: ANoB5pmbRiHjQLJKBeuDkZMpJEVAQLVGJBo0K2fQZdvrLAaWVWgBlhIB 6fYECynm0fFkoMU8T3ik8BF9Tu5gZYi5 X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:c14c:6035:5882:8faa]) (user=irogers job=sendgmr) by 2002:a05:6a00:1696:b0:571:2b7c:6693 with SMTP id k22-20020a056a00169600b005712b7c6693mr145885pfc.48.1668638806175; Wed, 16 Nov 2022 14:46:46 -0800 (PST) Date: Wed, 16 Nov 2022 14:46:31 -0800 Message-Id: <20221116224631.207631-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Subject: [PATCH] perf build: Fix LIBTRACEEVENT_DYNAMIC From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Masahiro Yamada , Nicolas Schier , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, Nick Desaulniers , Andrii Nakryiko Cc: Stephane Eranian , Ian Rogers 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=ham 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?1749694667248209024?= X-GMAIL-MSGID: =?utf-8?q?1749694768020823699?= The tools/lib includes fixes break LIBTRACEVENT_DYNAMIC as the makefile erroneously had depdendencies on building libtraceevent even when not linking with it. This change fixes the issues with LIBTRACEEVENT_DYNAMIC by making the built files optional. Signed-off-by: Ian Rogers --- tools/perf/Makefile.perf | 25 ++++++++++++++++++++++--- tools/perf/util/setup.py | 3 ++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index dd096aba4430..59c4e8f9b014 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -242,8 +242,10 @@ sub-make: fixdep else # force_fixdep LIBAPI_DIR = $(srctree)/tools/lib/api/ +ifndef LIBTRACEEVENT_DYNAMIC LIBTRACEEVENT_DIR = $(srctree)/tools/lib/traceevent/ LIBTRACEEVENT_PLUGINS_DIR = $(LIBTRACEEVENT_DIR)/plugins +endif LIBBPF_DIR = $(srctree)/tools/lib/bpf/ LIBSUBCMD_DIR = $(srctree)/tools/lib/subcmd/ LIBSYMBOL_DIR = $(srctree)/tools/lib/symbol/ @@ -293,6 +295,7 @@ SCRIPT_SH += perf-iostat.sh grep-libs = $(filter -l%,$(1)) strip-libs = $(filter-out -l%,$(1)) +ifndef LIBTRACEEVENT_DYNAMIC ifneq ($(OUTPUT),) LIBTRACEEVENT_OUTPUT = $(abspath $(OUTPUT))/libtraceevent else @@ -306,13 +309,16 @@ LIBTRACEEVENT = $(LIBTRACEEVENT_OUTPUT)/libtraceevent.a export LIBTRACEEVENT LIBTRACEEVENT_DYNAMIC_LIST = $(LIBTRACEEVENT_PLUGINS_OUTPUT)/libtraceevent-dynamic-list CFLAGS += -I$(LIBTRACEEVENT_OUTPUT)/include - # # The static build has no dynsym table, so this does not work for # static build. Looks like linker starts to scream about that now # (in Fedora 26) so we need to switch it off for static build. DYNAMIC_LIST_LDFLAGS = -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST) LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = $(if $(findstring -static,$(LDFLAGS)),,$(DYNAMIC_LIST_LDFLAGS)) +else +LIBTRACEEVENT_DYNAMIC_LIST = +LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = +endif ifneq ($(OUTPUT),) LIBAPI_OUTPUT = $(abspath $(OUTPUT))/libapi @@ -375,7 +381,11 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) +ifndef LIBTRACEEVENT_DYNAMIC PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPI) +else +PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBAPI) +endif SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) @@ -785,9 +795,12 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioc $(LIBPERF) \ $(LIBSUBCMD) \ $(LIBSYMBOL) \ - $(LIBTRACEEVENT) \ bpf-skel +ifndef LIBTRACEEVENT_DYNAMIC +prepare: $(LIBTRACEEVENT) +endif + $(OUTPUT)%.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ @@ -843,6 +856,7 @@ endif $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h) +ifndef LIBTRACEEVENT_DYNAMIC LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) 'EXTRA_CFLAGS=$(EXTRA_CFLAGS)' 'LDFLAGS=$(filter-out -static,$(LDFLAGS))' $(LIBTRACEEVENT): FORCE | $(LIBTRACEEVENT_OUTPUT) @@ -872,6 +886,7 @@ install-traceevent-plugins: libtraceevent_plugins $(Q)$(MAKE) -C $(LIBTRACEEVENT_PLUGINS_DIR) O=$(LIBTRACEEVENT_PLUGINS_OUTPUT) \ DESTDIR=$(LIBTRACEEVENT_PLUGINS_DESTDIR) prefix= \ $(LIBTRACEEVENT_FLAGS) install +endif $(LIBAPI): FORCE | $(LIBAPI_OUTPUT) $(Q)$(MAKE) -C $(LIBAPI_DIR) O=$(LIBAPI_OUTPUT) \ @@ -1152,7 +1167,7 @@ endif # BUILD_BPF_SKEL bpf-skel-clean: $(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS) -clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean libtraceevent_plugins-clean +clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean $(call QUIET_CLEAN, core-objs) $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive $(OUTPUT)perf-iostat $(LANG_BINDINGS) $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete $(Q)$(RM) $(OUTPUT).config-detected @@ -1192,6 +1207,10 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea $(call QUIET_CLEAN, Documentation) \ $(MAKE) -C $(DOC_DIR) O=$(OUTPUT) clean >/dev/null +ifndef LIBTRACEEVENT_DYNAMIC +clean:: $(LIBTRACEEVENT)-clean libtraceevent_plugins-clean +endif + # # To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY) # file if defined, with no further action. diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 5b1e6468d5e8..43e7ca40b2ec 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -77,7 +77,8 @@ perf = Extension('perf', include_dirs = ['util/include'], libraries = extra_libraries, extra_compile_args = cflags, - extra_objects = [libtraceevent, libapikfs, libperf], + extra_objects = [ x for x in [libtraceevent, libapikfs, libperf] + if x is not None], ) setup(name='perf',