Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp33693pxb; Tue, 28 Sep 2021 14:45:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7j4nmFQcmWO8Kfb7xV+i/0ibbG+/oDT3f3LNg21damNd0JD2RAx9feXHFD6/fy2kDwvzZ X-Received: by 2002:a50:da0a:: with SMTP id z10mr10573204edj.95.1632865558072; Tue, 28 Sep 2021 14:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632865558; cv=none; d=google.com; s=arc-20160816; b=BmVzzy+lx3PoQfPNQYl12YBZ+8BWeQTMhN2UTQCtGXlKAFTqAxrFt1jAX2IWPwDZ8p acq3IUFFr1Jy9sXlQKe3CClvwm5k1bSOd5nGGWLN4vs2BstKY8S+eADKUL5UDBaUt4wD KEqSXpbFRkdg/Q0USq9czDVBbX3nVomYMNnWiuhJPFUoanZCMl3S07bNCyCjCswj+nMJ 1D1WjV7fDaKht9bS7WJmK7yWLpOt+MoSwFb8tbb/0krXpSyAUDxt274iu/LzXMPDIf2w 1dSsVrg42TMpGjwDYeoTZw/Do5VZgAoLCTDxNGEWgfgSXQIeo7czt4owH16tVrx13H/p 2aOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=iiF8exoYlueRS0KnTsyCUS9qWOqre2hhhD+QduQ5KmQ=; b=PnB+8AsPNTq31DkJKQmk2jGR+C/qV1MUJB85yd0x5xev3PWR5mE2ekYPO+JVjkoDNX ys1FSZtouTGpifcqNUl0m5+1Gp9lNuJMHW5TcRG7J0HvvfKrVYIfyIA0pq41nhjCcOIV TkNr6BAQiQ9b+FLrNTttYsmkU6Gr/ns2+oJd1kv0vXDoOhjrf8a27NMJu02u3F1UKxX+ LqkwfASxscGM87Bz+QBQOUQf1GfmHeA91XbEo41fWdW/evr8qml5d+reFgdPFJxQV9OJ nx1F5pNKAN2+NXRzHy0mFstSMQmQ12NDOigZ2AHohhUUheGlBZI3jmWUwyXH4DCPXhle /FNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="h/M2YgpI"; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si262038edz.454.2021.09.28.14.45.34; Tue, 28 Sep 2021 14:45:58 -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=@redhat.com header.s=mimecast20190719 header.b="h/M2YgpI"; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232003AbhI1Vpj (ORCPT + 99 others); Tue, 28 Sep 2021 17:45:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22007 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241482AbhI1Vpi (ORCPT ); Tue, 28 Sep 2021 17:45:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632865438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iiF8exoYlueRS0KnTsyCUS9qWOqre2hhhD+QduQ5KmQ=; b=h/M2YgpIXSdfeRk3QGzzxo9XKllMTEDaRMgk4tV6guALUud22Y5eqEn1HPsVs4K+rGkmqI 8PkpAJWiKQmNUjV6sNZmkMOyJ5PZjL7UFPDpGZ+fONM2wxx+RrdiAB/VUt+gV9JJufrk1J RDw5PJKb6nxZkTka1etHqUPv33e8ja4= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-213-E8qhOiQHMfWAL8TaAoWzbg-1; Tue, 28 Sep 2021 17:43:57 -0400 X-MC-Unique: E8qhOiQHMfWAL8TaAoWzbg-1 Received: by mail-ed1-f69.google.com with SMTP id 14-20020a508e4e000000b003d84544f33eso183840edx.2 for ; Tue, 28 Sep 2021 14:43:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=iiF8exoYlueRS0KnTsyCUS9qWOqre2hhhD+QduQ5KmQ=; b=gCyt6SKVRy4cg2ubjcJL9LgAFfFE8VVJ1mkKse4OgkHVxToV82repDCXxKEK4eYWR8 p9+878HBwRIBJGuuUiS1YY/IcwWPmlER2b+fMaZWdwZnyKxtuwnK/Mob4NM9cCKByWry nxiQBvCycZEtRk+MQPlZ98+KowSM0RRgqLuEr147yYwRdBHoMr0Z8zbYlhJwZAlZsf42 mR5VmHV2bLmVk37Vfopcm7C+EY8/acNYYAJOJLiqPbMxsk3/UhLWpWW+W9RGRs8F6r/U /I7Odp+Ul/EdTGq9oPprahM4FlAxA/cha4MchwQfowXG/H9Tqxne6Yg3rMHWhuPhpSZM DITQ== X-Gm-Message-State: AOAM533Xi4zmot1V4EuxtbSyN3fQgIUYwj8TdEEq+kUy+l4xvNL9RrX7 syHJubc1otKAX4r2KFSLM+Ezg0039hOj3p6Thjlq7Cezq9T5PzLkFi/1QSBoN2BayfMXIjmwEyo 9sO03H4C7BU67tn7Qqi55s//6 X-Received: by 2002:a17:906:a150:: with SMTP id bu16mr9687733ejb.108.1632865436027; Tue, 28 Sep 2021 14:43:56 -0700 (PDT) X-Received: by 2002:a17:906:a150:: with SMTP id bu16mr9687714ejb.108.1632865435859; Tue, 28 Sep 2021 14:43:55 -0700 (PDT) Received: from krava ([83.240.63.48]) by smtp.gmail.com with ESMTPSA id m7sm171987ejc.83.2021.09.28.14.43.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 14:43:55 -0700 (PDT) Date: Tue, 28 Sep 2021 23:43:53 +0200 From: Jiri Olsa To: Jinshan Xiong Cc: arnaldo.melo@gmail.com, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] tools/lib/perf: make the static libperf complete Message-ID: References: <20210927223101.3155964-1-jinshan.xiong@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210927223101.3155964-1-jinshan.xiong@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 27, 2021 at 03:30:26PM -0700, Jinshan Xiong wrote: > This patch makes libperf.a complete. Initially it misses the symbols > fdarray_* that makes it unusable after being installed by: > $ make install DESTDIR= > > Check missing symbols: > $ nm tools/lib/perf/libperf.a | grep fdarray_ > U fdarray__add > 0000000000002b3e t fdarray__available_entries > U fdarray__exit > U fdarray__filter > U fdarray__grow > U fdarray__init > U fdarray__poll right, libperf.a should be complete.. but how about we use libperf.a as source for libapi.a and include it directly in there.. and remove libapi.a from perf we will have complete libperf.a without new -ext.a file and perf compiles properly.. should be also ok for future perf dynamic linking with libperf.so I did just quick build test.. I might have missed something jirka --- diff --git a/tools/lib/perf/Makefile b/tools/lib/perf/Makefile index 08fe6e3c4089..e1150408e095 100644 --- a/tools/lib/perf/Makefile +++ b/tools/lib/perf/Makefile @@ -109,7 +109,7 @@ else endif LIBAPI = $(API_PATH)libapi.a -export LIBAPI +LIBAPI_IN = $(API_PATH)libapi-in.o $(LIBAPI): FORCE $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a @@ -121,8 +121,8 @@ $(LIBAPI)-clean: $(LIBPERF_IN): FORCE $(Q)$(MAKE) $(build)=libperf -$(LIBPERF_A): $(LIBPERF_IN) - $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN) +$(LIBPERF_A): $(LIBPERF_IN) $(LIBAPI) + $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN) $(LIBAPI_IN) $(LIBPERF_SO): $(LIBPERF_IN) $(LIBAPI) $(QUIET_LINK)$(CC) --shared -Wl,-soname,libperf.so \ diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index e04313c4d840..a500fd6fe5ea 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -321,9 +321,6 @@ LIBTRACEEVENT_DYNAMIC_LIST = $(PLUGINS_PATH)libtraceevent-dynamic-list DYNAMIC_LIST_LDFLAGS = -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST) LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = $(if $(findstring -static,$(LDFLAGS)),,$(DYNAMIC_LIST_LDFLAGS)) -LIBAPI = $(API_PATH)libapi.a -export LIBAPI - LIBBPF = $(BPF_PATH)libbpf.a LIBSUBCMD = $(SUBCMD_PATH)libsubcmd.a @@ -340,7 +337,7 @@ 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) -PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPI) +PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) @@ -379,7 +376,7 @@ endif export PERL_PATH -PERFLIBS = $(LIBAPI) $(LIBSUBCMD) $(LIBPERF) +PERFLIBS = $(LIBSUBCMD) $(LIBPERF) ifndef NO_LIBBPF ifndef LIBBPF_DYNAMIC PERFLIBS += $(LIBBPF) @@ -820,13 +817,6 @@ $(LIBTRACEEVENT)-clean: install-traceevent-plugins: libtraceevent_plugins $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins -$(LIBAPI): FORCE - $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a - -$(LIBAPI)-clean: - $(call QUIET_CLEAN, libapi) - $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null - $(LIBBPF): FORCE $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) @@ -1078,7 +1068,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 $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean +clean:: $(LIBTRACEEVENT)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean $(call QUIET_CLEAN, core-objs) $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(OUTPUT)perf-iostat $(LANG_BINDINGS) $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete $(Q)$(RM) $(OUTPUT).config-detected diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 483f05004e68..c470a67d2b77 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -51,7 +51,6 @@ src_perf = getenv('srctree') + '/tools/perf' build_lib = getenv('PYTHON_EXTBUILD_LIB') build_tmp = getenv('PYTHON_EXTBUILD_TMP') libtraceevent = getenv('LIBTRACEEVENT') -libapikfs = getenv('LIBAPI') libperf = getenv('LIBPERF') ext_sources = [f.strip() for f in open('util/python-ext-sources') @@ -71,7 +70,7 @@ perf = Extension('perf', include_dirs = ['util/include'], libraries = extra_libraries, extra_compile_args = cflags, - extra_objects = [libtraceevent, libapikfs, libperf], + extra_objects = [libtraceevent, libperf], ) setup(name='perf',