Commit 2175ccfb authored by Alexei Starovoitov's avatar Alexei Starovoitov
Browse files

Merge branch 'bpf-selftests-fixes-for-gcc-bpf-16'

Jose E. Marchesi says:

====================
bpf: selftests fixes for GCC-BPF 16

Hello.

Just a couple of small fixes to get the BPF selftests build with what
will become GCC 16 this spring.  One of the regressions is due to a
change in the behavior of a warning in GCC 16.  The other is due to
the fact that GCC 16 actually implements btf_decl_tag and
btf_type_tag.

Salud!
====================

Link: https://patch.msgid.link/20260106173650.18191-1-jose.marchesi@oracle.com


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parents 24216497 68160064
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -7,6 +7,16 @@

#define MAX_ENTRIES 8

/* clang considers 'sum += 1' as usage but 'sum++' as non-usage.  GCC
 * is more consistent and considers both 'sum += 1' and 'sum++' as
 * non-usage.  This triggers warnings in the functions below.
 *
 * Starting with GCC 16 -Wunused-but-set-variable=2 can be used to
 * mimic clang's behavior.  */
#if !defined(__clang__) && __GNUC__ > 15
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif

struct map_value {
	struct bpf_timer timer;
};
+10 −0
Original line number Diff line number Diff line
@@ -7,6 +7,16 @@
#include "bpf_tracing_net.h"
#include "bpf_misc.h"

/* clang considers 'sum += 1' as usage but 'sum++' as non-usage.  GCC
 * is more consistent and considers both 'sum += 1' and 'sum++' as
 * non-usage.  This triggers warnings in the functions below.
 *
 * Starting with GCC 16 -Wunused-but-set-variable=2 can be used to
 * mimic clang's behavior.  */
#if !defined(__clang__) && __GNUC__ > 15
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif

char _license[] SEC("license") = "GPL";

struct {
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ struct {
} hashmap1 SEC(".maps");


static __noinline int foo(int x __tag1 __tag2) __tag1 __tag2
static __noinline __tag1 __tag2 int foo(int x __tag1 __tag2)
{
	struct key_t key;
	value_t val = {};