Skip to content

Commit 63d2247

Browse files
guidosarducciAlexei Starovoitov
authored andcommitted
libbpf: Fix missing #pragma in libbpf_utils.c
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: 4a1c9e5 ("libbpf: remove linux/unaligned.h dependency for libbpf_sha256()") Signed-off-by: Tony Ambardar <[email protected]> Acked-by: Andrii Nakryiko <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 2ce61c6 commit 63d2247

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/lib/bpf/libbpf_utils.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ const char *libbpf_errstr(int err)
150150

151151
#pragma GCC diagnostic push
152152
#pragma GCC diagnostic ignored "-Wpacked"
153+
#pragma GCC diagnostic ignored "-Wattributes"
153154
struct __packed_u32 { __u32 __val; } __attribute__((packed));
154155
#pragma GCC diagnostic pop
155156

0 commit comments

Comments
 (0)