From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Stanislav Fomichev <sdf@google.com>
Cc: netdev@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
quentin.monnet@netronome.com
Subject: Re: [PATCH bpf-next] bpftool: make libbfd optional
Date: Mon, 12 Nov 2018 11:42:34 -0800 [thread overview]
Message-ID: <20181112114234.48ef2e6b@cakuba.netronome.com> (raw)
In-Reply-To: <20181112185328.125589-1-sdf@google.com>
On Mon, 12 Nov 2018 10:53:28 -0800, Stanislav Fomichev wrote:
> Make it possible to build bpftool without libbfd. This excludes support for
> disassembling jit-ted code and prints an error if the user tries to use
> these features.
>
> Tested by:
> cat > FEATURES_DUMP.bpftool <<EOF
> feature-libbfd=0
> feature-disassembler-four-args=1
> feature-reallocarray=0
> feature-libelf=1
> feature-libelf-mmap=1
> feature-bpf=1
> EOF
> FEATURES_DUMP=$PWD/FEATURES_DUMP.bpftool make
> ldd bpftool | grep libbfd
>
> Signed-off-by: Stanislav Fomichev <sdf@google.com>
Would you mind spelling out the motivation?
> diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h
> index 61d82020af58..ec1bc2ae3c71 100644
> --- a/tools/bpf/bpftool/main.h
> +++ b/tools/bpf/bpftool/main.h
> @@ -147,8 +147,19 @@ int prog_parse_fd(int *argc, char ***argv);
> int map_parse_fd(int *argc, char ***argv);
> int map_parse_fd_and_info(int *argc, char ***argv, void *info, __u32 *info_len);
>
> +#ifdef HAVE_LIBBFD_SUPPORT
> void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
> const char *arch, const char *disassembler_options);
> +void disasm_init(void);
> +#else
> +static inline
> +void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
> + const char *arch, const char *disassembler_options)
> +{
> + p_err("No libbfd support");
> +}
I think an error per instruction is a bit much, could we make sure we
error out earlier?
> +static inline void disasm_init(void) {}
> +#endif
> void print_data_json(uint8_t *data, size_t len);
> void print_hex_data_json(uint8_t *data, size_t len);
Otherwise LGTM.
next prev parent reply other threads:[~2018-11-13 5:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 18:53 [PATCH bpf-next] bpftool: make libbfd optional Stanislav Fomichev
2018-11-12 19:42 ` Jakub Kicinski [this message]
2018-11-12 19:58 ` Stanislav Fomichev
2018-11-12 20:35 ` Jakub Kicinski
2018-11-12 21:30 ` Stanislav Fomichev
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=20181112114234.48ef2e6b@cakuba.netronome.com \
--to=jakub.kicinski@netronome.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
--cc=quentin.monnet@netronome.com \
--cc=sdf@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox