From: Eduard Zingerman <eddyz87@gmail.com>
To: Stanislav Fomichev <stfomichev@gmail.com>
Cc: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org,
daniel@iogearbox.net, martin.lau@linux.dev, kernel-team@fb.com,
yonghong.song@linux.dev, masahiroy@kernel.org
Subject: Re: [PATCH bpf v2] samples/bpf: remove unnecessary -I flags from libbpf EXTRA_CFLAGS
Date: Mon, 02 Dec 2024 16:52:36 -0800 [thread overview]
Message-ID: <ed5cd40f87b28528cd6a9a6db55e9879e34d9e92.camel@gmail.com> (raw)
In-Reply-To: <Z05PkpUCQb7T_rk3@mini-arch>
On Mon, 2024-12-02 at 16:23 -0800, Stanislav Fomichev wrote:
[...[
> > diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> > index bcf103a4c14f..44f7e05973de 100644
> > --- a/samples/bpf/Makefile
> > +++ b/samples/bpf/Makefile
> > @@ -146,13 +146,14 @@ ifeq ($(ARCH), x86)
> > BPF_EXTRA_CFLAGS += -fcf-protection
> > endif
> >
> > -TPROGS_CFLAGS += -Wall -O2
> > -TPROGS_CFLAGS += -Wmissing-prototypes
> > -TPROGS_CFLAGS += -Wstrict-prototypes
> > -TPROGS_CFLAGS += $(call try-run,\
> > +COMMON_CFLAGS += -Wall -O2
> > +COMMON_CFLAGS += -Wmissing-prototypes
> > +COMMON_CFLAGS += -Wstrict-prototypes
> > +COMMON_CFLAGS += $(call try-run,\
> > printf "int main() { return 0; }" |\
> > $(CC) -Werror -fsanitize=bounds -x c - -o "$$TMP",-fsanitize=bounds,)
> >
> > +TPROGS_CFLAGS += $(COMMON_CFLAGS)
> > TPROGS_CFLAGS += -I$(objtree)/usr/include
> > TPROGS_CFLAGS += -I$(srctree)/tools/testing/selftests/bpf/
> > TPROGS_CFLAGS += -I$(LIBBPF_INCLUDE)
> > @@ -229,7 +230,7 @@ clean:
> >
> > $(LIBBPF): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OUTPUT)
> > # Fix up variables inherited from Kbuild that tools/ build system won't like
> > - $(MAKE) -C $(LIBBPF_SRC) RM='rm -rf' EXTRA_CFLAGS="$(TPROGS_CFLAGS)" \
> > + $(MAKE) -C $(LIBBPF_SRC) RM='rm -rf' EXTRA_CFLAGS="$(COMMON_CFLAGS)" \
> > LDFLAGS="$(TPROGS_LDFLAGS)" srctree=$(BPF_SAMPLES_PATH)/../../ \
> > O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= \
> > $@ install_headers
> > --
> > 2.47.0
> >
>
> Naive question: why pass EXTRA_CFLAGS to libbpf at all? Can we drop it?
This was added by the commit [0].
As far as I understand, the idea is to pass the following flags:
ifeq ($(ARCH), arm)
# Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux
# headers when arm instruction set identification is requested.
ARM_ARCH_SELECTOR := $(filter -D__LINUX_ARM_ARCH__%, $(KBUILD_CFLAGS))
...
TPROGS_CFLAGS += $(ARM_ARCH_SELECTOR)
endif
ifeq ($(ARCH), mips)
TPROGS_CFLAGS += -D__SANE_USERSPACE_TYPES__
...
endif
Not sure if these are still necessary.
[0] commit d8ceae91e9f0 ("samples/bpf: Provide C/LDFLAGS to libbpf")
next prev parent reply other threads:[~2024-12-03 0:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 23:47 [PATCH bpf v2] samples/bpf: remove unnecessary -I flags from libbpf EXTRA_CFLAGS Eduard Zingerman
2024-12-03 0:23 ` Stanislav Fomichev
2024-12-03 0:52 ` Eduard Zingerman [this message]
2024-12-03 1:44 ` Eduard Zingerman
2024-12-03 4:50 ` Eduard Zingerman
2024-12-03 5:00 ` 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=ed5cd40f87b28528cd6a9a6db55e9879e34d9e92.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=martin.lau@linux.dev \
--cc=masahiroy@kernel.org \
--cc=stfomichev@gmail.com \
--cc=yonghong.song@linux.dev \
/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