Re: [PATCH bpf-next 3/3] selftests/bpf: Allow ignoring some flags for Clang builds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> 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!

> 
> [...]
> 





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux