All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <ast@fb.com>
To: Andrii Nakryiko <andriin@fb.com>,
	"andrii.nakryiko@gmail.com" <andrii.nakryiko@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>
Subject: Re: [PATCH bpf-next] libbpf: emit diff of mismatched public API, if any
Date: Wed, 22 May 2019 16:21:13 +0000	[thread overview]
Message-ID: <1b027a52-4ac7-daf8-ee4a-eb528f53e526@fb.com> (raw)
In-Reply-To: <20190522161520.3407245-1-andriin@fb.com>

On 5/22/19 9:15 AM, Andrii Nakryiko wrote:
> It's easy to have a mismatch of "intended to be public" vs really
> exposed API functions. While Makefile does check for this mismatch, if
> it actually occurs it's not trivial to determine which functions are
> accidentally exposed. This patch dumps out a diff showing what's not
> supposed to be exposed facilitating easier fixing.
> 
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> ---
>   tools/lib/bpf/.gitignore | 2 ++
>   tools/lib/bpf/Makefile   | 8 ++++++++
>   2 files changed, 10 insertions(+)
> 
> diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> index d9e9dec04605..c7306e858e2e 100644
> --- a/tools/lib/bpf/.gitignore
> +++ b/tools/lib/bpf/.gitignore
> @@ -3,3 +3,5 @@ libbpf.pc
>   FEATURE-DUMP.libbpf
>   test_libbpf
>   libbpf.so.*
> +libbpf_global_syms.tmp
> +libbpf_versioned_syms.tmp
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index f91639bf5650..7e7d6d851713 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile
> @@ -204,6 +204,14 @@ check_abi: $(OUTPUT)libbpf.so
>   		     "versioned symbols in $^ ($(VERSIONED_SYM_COUNT))." \
>   		     "Please make sure all LIBBPF_API symbols are"	 \
>   		     "versioned in $(VERSION_SCRIPT)." >&2;		 \
> +		readelf -s --wide $(OUTPUT)libbpf-in.o |		 \
> +		    awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}'|   \
> +		    sort -u > $(OUTPUT)libbpf_global_syms.tmp;		 \
> +		readelf -s --wide $(OUTPUT)libbpf.so |			 \
> +		    grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 |		 \
> +		    sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; 	 \
> +		diff -u $(OUTPUT)libbpf_global_syms.tmp			 \
> +		     $(OUTPUT)libbpf_versioned_syms.tmp;		 \
>   		exit 1;							 \

good idea.
how about removing tmp files instead of adding them to .gitignore?

  reply	other threads:[~2019-05-22 16:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 16:15 [PATCH bpf-next] libbpf: emit diff of mismatched public API, if any Andrii Nakryiko
2019-05-22 16:21 ` Alexei Starovoitov [this message]
2019-05-22 16:46   ` Stanislav Fomichev
2019-05-22 17:45     ` Andrii Nakryiko
2019-05-22 18:00       ` Stanislav Fomichev
2019-05-22 17:44   ` Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b027a52-4ac7-daf8-ee4a-eb528f53e526@fb.com \
    --to=ast@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.