Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1566152ybl; Mon, 2 Dec 2019 05:20:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzdn+F3c3sWmZQBKbTSwjHK6cAfrnyrdbYs43kqtf48vI6gT25FPM6A2VlIETLgQrCi8Zyz X-Received: by 2002:a2e:9143:: with SMTP id q3mr14836480ljg.199.1575292846431; Mon, 02 Dec 2019 05:20:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575292846; cv=none; d=google.com; s=arc-20160816; b=GcE+Ig6bS3aMkjzMxUOsAfe4lBPvMkz5sGzRQ4ItL0+AHMpZQ9UcgIUjWY6IOxRLyR JDkVeRZEYL5140Vf8YWnEP8ylmXK3nh7j+ODbDBuiSTjZLOrJq2pMLKg+6tGQc+vQXYm dwjpLeHUn21M0gSsLv5nVqpW036r27SvmW9u9lasvewNMMuqY5FG4NAcIQquU8N88PMY ELsdJxSD7/lC+q2mpelOf/ZOhwhJ/CZ/lkrig4A6nr//Z2KomXYNDKIHhBx35/zeLPkx F8NUdaH1PDJ29ix7EZximRJpF6RacZgQwti/s22t8SPOofqH5otWcH0jzN0GpbECG6qt CpJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=J8itW/3mfeuEXrqrMMcGiVXM/WIpb+UTkaymAWEwkxY=; b=grNTIJEuAvW11wWKDd3NZGMStxS0W3XQ+8CvSLZhtzBh6/VM6p7c4YRugAxya+jYb1 E2yNk/yq47gq4GDxdBDdZrJGT6mdNRJYorJr4QiryVCDHiKPXXgTMJMSDJ/JQa3Pl+HA uVHP6BjmzKGuw/oEZqLNJYg4UpS3zLFTkAU5SJkWgZ9fWui+1uC1Y+nTtitsSwGFbe7+ XSL0MahDy1jPNIBKmjomXEzZDKydak6NsQgL/vEXl15xVbCAawfW0Cl3YregWKMg50Mf l1Gc1L/gZFKuHl8M8uYz7JLhKI+Jc7LrK1OUZPACcExLe6TNQ4lpGBC8B9TFomT0EQ9V npAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ca15si4154973ejb.239.2019.12.02.05.20.20; Mon, 02 Dec 2019 05:20:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727486AbfLBNTC convert rfc822-to-8bit (ORCPT + 99 others); Mon, 2 Dec 2019 08:19:02 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:31171 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727398AbfLBNTC (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=20H=C3=B8iland-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 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-)