]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
libbpf: Fix missing #pragma in libbpf_utils.c
authorTony Ambardar <tony.ambardar@gmail.com>
Thu, 2 Oct 2025 20:31:50 +0000 (13:31 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 2 Oct 2025 21:33:57 +0000 (14:33 -0700)
The recent sha256 patch uses a GCC pragma to suppress compile errors for
a packed struct, but omits a needed pragma (see related link) and thus
still raises errors: (e.g. on GCC 12.3 armhf)

libbpf_utils.c:153:29: error: packed attribute causes inefficient alignment for ‘__val’ [-Werror=attributes]
  153 | struct __packed_u32 { __u32 __val; } __attribute__((packed));
      |                             ^~~~~

Resolve by adding the GCC diagnostic pragma to ignore "-Wattributes".

Link: https://lore.kernel.org/bpf/CAP-5=fXURWoZu2j6Y8xQy23i7=DfgThq3WC1RkGFBx-4moQKYQ@mail.gmail.com/
Fixes: 4a1c9e544b8d ("libbpf: remove linux/unaligned.h dependency for libbpf_sha256()")
Signed-off-by: Tony Ambardar <tony.ambardar@gmail.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/libbpf_utils.c

index 2bae8cafc0774a794c21316766014b5d10894fe2..5d66bc6ff0982e5e52bea174eea5da2f3e006f23 100644 (file)
@@ -150,6 +150,7 @@ const char *libbpf_errstr(int err)
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpacked"
+#pragma GCC diagnostic ignored "-Wattributes"
 struct __packed_u32 { __u32 __val; } __attribute__((packed));
 #pragma GCC diagnostic pop