From patchwork Mon Dec 2 13:18:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Olsa X-Patchwork-Id: 1203143 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47RQgC4MYGz9sP6 for ; Tue, 3 Dec 2019 00:19:03 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727480AbfLBNTC convert rfc822-to-8bit (ORCPT ); Mon, 2 Dec 2019 08:19:02 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:24001 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727381AbfLBNTC (ORCPT ); Mon, 2 Dec 2019 08:19:02 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-17-EV2vrjPkOf2HJGQRGcFDgA-1; Mon, 02 Dec 2019 08:18:58 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D48868017DF; Mon, 2 Dec 2019 13:18:55 +0000 (UTC) Received: from krava.redhat.com (unknown [10.43.17.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3DB5600C8; Mon, 2 Dec 2019 13:18:47 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , netdev@vger.kernel.org, bpf@vger.kernel.org, Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , =?utf-8?q?Toke_H=C3=B8ila?= =?utf-8?q?nd-J=C3=B8rgensen?= , Jesper Dangaard Brouer , Daniel Borkmann , Alexei Starovoitov , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , Quentin Monnet Subject: [PATCHv4 0/6] perf/bpftool: Allow to link libbpf dynamically Date: Mon, 2 Dec 2019 14:18:40 +0100 Message-Id: <20191202131847.30837-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: EV2vrjPkOf2HJGQRGcFDgA-1 X-Mimecast-Spam-Score: 0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org hi, adding support to link bpftool with libbpf dynamically, and config change for perf. It's now possible to use: $ make -C tools/bpf/bpftool/ LIBBPF_DYNAMIC=1 which will detect libbpf devel package and if found, link it with bpftool. It's possible to use arbitrary installed libbpf: $ make -C tools/bpf/bpftool/ LIBBPF_DYNAMIC=1 LIBBPF_DIR=/tmp/libbpf/ I based this change on top of Arnaldo's perf/core, because it contains libbpf feature detection code as dependency. Also available in: git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git libbpf/dyn v4 changes: - based on Toke's v3 post, there's no need for additional API exports: Since bpftool uses bits of libbpf that are not exported as public API in the .so version, we also pass in libbpf.a to the linker, which allows it to pick up the private functions from the static library without having to expose them as ABI. - changing some Makefile variable names - documenting LIBBPF_DYNAMIC and LIBBPF_DIR in the Makefile comment - extending test_bpftool_build.sh with libbpf dynamic link thanks, jirka --- Jiri Olsa (6): perf tools: Allow to specify libbpf install directory bpftool: Allow to link libbpf dynamically bpftool: Rename BPF_DIR Makefile variable to LIBBPF_SRC_DIR bpftool: Rename LIBBPF_OUTPUT Makefile variable to LIBBPF_BUILD_OUTPUT bpftool: Rename LIBBPF_PATH Makefile variable to LIBBPF_BUILD_PATH selftests, bpftool: Add build test for libbpf dynamic linking tools/bpf/bpftool/Makefile | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------- tools/perf/Makefile.config | 27 ++++++++++++++++++++------- tools/testing/selftests/bpf/test_bpftool_build.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 15 deletions(-)