BPF List
 help / color / mirror / Atom feed
From: Viktor Malik <vmalik@redhat.com>
To: Eduard Zingerman <eddyz87@gmail.com>,
	Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf@vger.kernel.org, Andrii Nakryiko <andrii@kernel.org>,
	Mykola Lysenko <mykolal@fb.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>
Subject: Re: [PATCH bpf-next 3/3] selftests/bpf: Allow ignoring some flags for Clang builds
Date: Thu, 17 Oct 2024 10:34:02 +0200	[thread overview]
Message-ID: <094b356d-ecfb-4bfe-9d90-4268d4cf5f12@redhat.com> (raw)
In-Reply-To: <7fdc3253df59bd216eec02a53bbd0adc06fb8e7c.camel@gmail.com>

On 10/17/24 00:18, Eduard Zingerman wrote:
> On Wed, 2024-10-16 at 13:37 -0700, Andrii Nakryiko wrote:
>> On Mon, Oct 14, 2024 at 11:55 PM Viktor Malik <vmalik@redhat.com> wrote:
>>>
>>> There exist compiler flags supported by GCC but not supported by Clang
>>> (e.g. -specs=...). Currently, these cannot be passed to BPF selftests
>>> builds, even when building with GCC, as some binaries (urandom_read and
>>> liburandom_read.so) are always built with Clang and the unsupported
>>> flags make the compilation fail (as -Werror is turned on).
>>>
>>> Add new Makefile variable CLANG_FILTEROUT_FLAGS which can be used by
>>> users to specify which flags (from the user-provided CFLAGS or LDFLAGS)
>>> should be filtered out for Clang invocations.
>>>
>>> This allows to do things like:
>>>
>>>     $ CFLAGS="-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1" \
>>>       CLANG_FILTEROUT_FLAGS="-specs=%" \
>>>       make -C tools/testing/selftests/bpf
>>>
>>> Without this patch, the compilation would fail with:
>>>
>>>     [...]
>>>     clang: error: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' [-Werror,-Wunused-command-line-argument]
>>
>> maybe we should just not error out (i.e., enable
>> -Wno-unused-command-line-argument)?
> 
> I agree with Andrii, grepping for FILTEROUT in kernel source code does
> not show anything similar to this. Are such filter-out variables some
> kind of convention?
> 
> Another option might be to remove `-Werror` and add it on CI via EXTRA_CFLAGS.

Enabling -Wno-unused-command-line-argument is the simplest way here,
let's do that.

Thank you both for suggestions!

> 
> [...]
> 


      reply	other threads:[~2024-10-17  8:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-15  6:54 [PATCH bpf-next 0/3] selftests/bpf: Improve building with extra Viktor Malik
2024-10-15  6:54 ` [PATCH bpf-next 1/3] selftests/bpf: Allow building with extra flags Viktor Malik
2024-10-16 23:17   ` Eduard Zingerman
2024-10-17  7:29     ` Viktor Malik
2024-10-15  6:54 ` [PATCH bpf-next 2/3] bpftool: Prevent setting duplicate _GNU_SOURCE in Makefile Viktor Malik
2024-10-15 10:03   ` Quentin Monnet
2024-10-15 10:17     ` Viktor Malik
2024-10-16 20:34   ` Andrii Nakryiko
2024-10-17  6:08     ` Viktor Malik
2024-10-15  6:54 ` [PATCH bpf-next 3/3] selftests/bpf: Allow ignoring some flags for Clang builds Viktor Malik
2024-10-16 20:37   ` Andrii Nakryiko
2024-10-16 22:18     ` Eduard Zingerman
2024-10-17  8:34       ` Viktor Malik [this message]

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=094b356d-ecfb-4bfe-9d90-4268d4cf5f12@redhat.com \
    --to=vmalik@redhat.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=justinstitt@google.com \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=morbo@google.com \
    --cc=mykolal@fb.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --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