BPF List
 help / color / mirror / Atom feed
From: Quentin Monnet <quentin@isovalent.com>
To: Song Liu <song@kernel.org>
Cc: "Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <kafai@fb.com>,
	"Song Liu" <songliubraving@fb.com>, "Yonghong Song" <yhs@fb.com>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"KP Singh" <kpsingh@kernel.org>,
	"Stanislav Fomichev" <sdf@google.com>,
	"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
	bpf <bpf@vger.kernel.org>,
	"Niklas Söderlund" <niklas.soderlund@corigine.com>,
	"Simon Horman" <simon.horman@corigine.com>
Subject: Re: [PATCH bpf-next 4/7] bpftool: Group libbfd defs in Makefile, only pass them if we use libbfd
Date: Wed, 7 Sep 2022 15:19:01 +0100	[thread overview]
Message-ID: <65d37b4e-7261-6ea9-839a-5f8aa259139f@isovalent.com> (raw)
In-Reply-To: <CAPhsuW6DXecC3OsjrL7na-OHM=B6KfhEx5P21en+-QRN-RU_UQ@mail.gmail.com>

On 07/09/2022 00:31, Song Liu wrote:
> On Tue, Sep 6, 2022 at 6:44 AM Quentin Monnet <quentin@isovalent.com> wrote:
>>
> [...]
> 
>>
>> +# If one of the above feature combinations is set, we support libbfd
>>  ifneq ($(filter -lbfd,$(LIBS)),)
>> -CFLAGS += -DHAVE_LIBBFD_SUPPORT
>> -SRCS += $(BFD_SRCS)
>> +  CFLAGS += -DHAVE_LIBBFD_SUPPORT
>> +
>> +  # Libbfd interface changed over time, figure out what we need
>> +  ifeq ($(feature-disassembler-four-args), 1)
>> +    CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
>> +  endif
>> +  ifeq ($(feature-disassembler-init-styled), 1)
>> +    CFLAGS += -DDISASM_INIT_STYLED
>> +  endif
>> +endif
> 
> 
>> +ifeq ($(filter -DHAVE_LIBBFD_SUPPORT,$(CFLAGS)),)
>> +  # No support for JIT disassembly
>> +  SRCS := $(filter-out jit_disasm.c,$(SRCS))
>>  endif
> 
> This part could just be an else clause for the ifneq above.
> Well, I guess the difference is minimal.

True for this patch, but please see patch 6 with the LLVM support: the
ifneq above gets embedded in an outer if/else block (we only run it if
LLVM is not found), whereas removing jit_disasm.c from the sources
occurs when none of the two libs is available.

Ideally we'd have "if LLVM ... else if libbfd ... else remove
jit_disasm.c", but the check on libbfd involved checking multiple
features so I didn't find a simple way to write that in Makefile syntax
and thought it more readable to have a separate block for jit_disasm.c.

> 
> Acked-by: Song Liu <song@kernel.org>

Thanks for the review!

  reply	other threads:[~2022-09-07 14:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 13:36 [PATCH bpf-next 0/7] bpftool: Add LLVM as default library for disassembling JIT-ed programs Quentin Monnet
2022-09-06 13:36 ` [PATCH bpf-next 1/7] bpftool: Define _GNU_SOURCE only once Quentin Monnet
2022-09-06 23:14   ` Song Liu
2022-09-06 13:36 ` [PATCH bpf-next 2/7] bpftool: Remove asserts from JIT disassembler Quentin Monnet
2022-09-06 23:16   ` Song Liu
2022-09-06 13:36 ` [PATCH bpf-next 3/7] bpftool: Split FEATURE_TESTS/FEATURE_DISPLAY definitions in Makefile Quentin Monnet
2022-09-06 23:18   ` Song Liu
2022-09-06 13:36 ` [PATCH bpf-next 4/7] bpftool: Group libbfd defs in Makefile, only pass them if we use libbfd Quentin Monnet
2022-09-06 23:31   ` Song Liu
2022-09-07 14:19     ` Quentin Monnet [this message]
2022-09-06 13:36 ` [PATCH bpf-next 5/7] bpftool: Refactor disassembler for JIT-ed programs Quentin Monnet
2022-09-06 23:55   ` Song Liu
2022-09-06 13:36 ` [PATCH bpf-next 6/7] bpftool: Add LLVM as default library for disassembling " Quentin Monnet
2022-09-06 23:46   ` Alexei Starovoitov
2022-09-07 14:20     ` Quentin Monnet
2022-09-07 16:10       ` Alexei Starovoitov
2022-09-07 16:33         ` Quentin Monnet
2022-09-07 18:02           ` Yonghong Song
2022-09-11 20:13             ` Quentin Monnet
2022-09-07  0:06   ` Song Liu
2022-09-07 14:20     ` Quentin Monnet
2022-09-07 16:37       ` Song Liu
2022-09-06 13:36 ` [PATCH bpf-next 7/7] bpftool: Add llvm feature to "bpftool version" Quentin Monnet
2022-09-10 19:41 ` [PATCH bpf-next 0/7] bpftool: Add LLVM as default library for disassembling JIT-ed programs Niklas Söderlund

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=65d37b4e-7261-6ea9-839a-5f8aa259139f@isovalent.com \
    --to=quentin@isovalent.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=niklas.soderlund@corigine.com \
    --cc=sdf@google.com \
    --cc=simon.horman@corigine.com \
    --cc=song@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.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