summaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorDaniel Müller <deso@posteo.net>2023-03-15 20:15:50 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2023-03-16 20:20:08 +0300
commit6cb9430be1471d631e1b6b138e6d26657a9caa81 (patch)
tree48734653af849ac6f74ecd84b4b93d14fc76eb2f /tools/lib
parent226efec2b0efad60d4a6c4b2c3a8710dafc4dc21 (diff)
downloadlinux-6cb9430be1471d631e1b6b138e6d26657a9caa81.tar.xz
libbpf: Ignore warnings about "inefficient alignment"
Some consumers of libbpf compile the code base with different warnings enabled. In a report for perf, for example, -Wpacked was set which caused warnings about "inefficient alignment" to be emitted on a subset of supported architectures. With this change we silence specifically those warnings, as we intentionally worked with packed structs. This is a similar resolution as in b2f10cd4e805 ("perf cpumap: Fix alignment for masks in event encoding"). Fixes: 1eebcb60633f ("libbpf: Implement basic zip archive parsing support") Reported-by: Linux Kernel Functional Testing <lkft@linaro.org> Signed-off-by: Daniel Müller <deso@posteo.net> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Cc: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/bpf/CA+G9fYtBnwxAWXi2+GyNByApxnf_DtP1-6+_zOKAdJKnJBexjg@mail.gmail.com/ Link: https://lore.kernel.org/bpf/20230315171550.1551603-1-deso@posteo.net
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/zip.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/lib/bpf/zip.c b/tools/lib/bpf/zip.c
index f561aa07438f..3f26d629b2b4 100644
--- a/tools/lib/bpf/zip.c
+++ b/tools/lib/bpf/zip.c
@@ -16,6 +16,10 @@
#include "libbpf_internal.h"
#include "zip.h"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpacked"
+#pragma GCC diagnostic ignored "-Wattributes"
+
/* Specification of ZIP file format can be found here:
* https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
* For a high level overview of the structure of a ZIP file see
@@ -119,6 +123,8 @@ struct local_file_header {
__u16 extra_field_length;
} __attribute__((packed));
+#pragma GCC diagnostic pop
+
struct zip_archive {
void *data;
__u32 size;