[DTrace-devel] [PATCH 2/3] Ignore "discarded qualifier" compile warnings with old bpf.h

Kris Van Hees kvanhees at kvh-deb-bpf.us.oracle.com
Tue Jan 30 15:47:58 UTC 2024


On Wed, Nov 29, 2023 at 11:56:10PM -0500, Kris Van Hees wrote:
> On Wed, Nov 29, 2023 at 09:43:58PM -0500, eugene.loh--- via DTrace-devel wrote:
> > From: Eugene Loh <eugene.loh at oracle.com>
> > 
> > Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> > ---
> >  bpf/Build | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/bpf/Build b/bpf/Build
> > index 917e8a0e..3279f427 100644
> > --- a/bpf/Build
> > +++ b/bpf/Build
> > @@ -48,6 +48,11 @@ bpf_dlib_SOURCES = \
> >  	strtok.S \
> >  	substr.S
> >  
> > +# Older linux/bpf.h omit the const qualifier to key and value parameters
> > +# in bpf_map_[lookup|update|delete]_elem() calls.  Ignore related warnings.
> 
> But that should not be a problem because we compile with our own copy of
> bpf.h.  Unless somehow the BPF precompilation is pickup up the wrong bpf.h.
> It should be using the one in include/linux/bpf.h in the DTrace source tree.

Looked a bit more at this.  This is not related to bpf.h at all.  This has to
do with the definition of the builtins (in gcc) for these helpers, that were
based on an older version of the helpers definitions.  Since then, those were
updated (in the kernel) and the gcc builtins were updated as well, so that this
is not an issue with newer compilers.

Since this is an isolated problem on OL7 with an older compiler, I'd say we do
not bother with this.  Surpressing the warning is potentially more harmful than
having these warnings show up on OL7.

> > +get_agg.c_CFLAGS := -Wno-discarded-qualifiers
> > +get_dvar.c_CFLAGS := -Wno-discarded-qualifiers
> > +
> >  bpf-check: $(objdir)/include/.dir.stamp
> >  	$(BPFC) $(BPFCPPFLAGS) $(bpf_dlib_CPPFLAGS) $(BPFCFLAGS) -S \
> >  		-o - bpf/get_bvar.c | \
> > -- 
> > 2.18.4
> > 
> > 
> > _______________________________________________
> > DTrace-devel mailing list
> > DTrace-devel at oss.oracle.com
> > https://oss.oracle.com/mailman/listinfo/dtrace-devel
> 



More information about the DTrace-devel mailing list