From patchwork Wed Mar 15 17:15:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_M=C3=BCller?= X-Patchwork-Id: 13176393 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E985C6FD1D for ; Wed, 15 Mar 2023 17:16:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230059AbjCORQK (ORCPT ); Wed, 15 Mar 2023 13:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229974AbjCORQJ (ORCPT ); Wed, 15 Mar 2023 13:16:09 -0400 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88475867FB for ; Wed, 15 Mar 2023 10:16:06 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 048482407C2 for ; Wed, 15 Mar 2023 18:16:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1678900565; bh=T7oQUm+ypc/roZDz1Lt9WOrkLZYufjpjFKViVcE1cQY=; h=From:To:Cc:Subject:Date:From; b=C3sm/WA59iZI1PZBTwNJZWT3M2/y7fy9w0nTeOuVW0e5joy7XsaeCZYkU/3zv4GIW lx0p0nOO6mCP2LQPd4Kx1PIEsAj7LFmVJfRM8JJEZuJh/VNk8bqfQLZ6cZDkIsH3xs 0CTvjj1NyT4G9hDN6en83S08hv3SdkYOUQxgTXCqzIM7/GfxBhXJSkxfRU8OZA/xKn xtK36wrWOX8kHF9MCPNpP+6CI67NIrYmrBrV5Gpq2KhoI4/vJwXyNDy7+oS/Ns307L 52xgh+EI2UkFw3RoCPQDlCOpwWxdd4btS3zxdDme9yX5Y72QT5CxhFX4Nq2e+4bQ9S faI/W4hOZiPJg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PcH9J0YxWz9rxM; Wed, 15 Mar 2023 18:16:04 +0100 (CET) From: =?utf-8?q?Daniel_M=C3=BCller?= To: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net, kafai@meta.com, kernel-team@meta.com Cc: Linux Kernel Functional Testing Subject: [PATCH bpf-next] libbpf: Ignore warnings about "inefficient alignment" Date: Wed, 15 Mar 2023 17:15:50 +0000 Message-Id: <20230315171550.1551603-1-deso@posteo.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net 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. Reported-by: Linux Kernel Functional Testing Link: https://lore.kernel.org/bpf/CA+G9fYtBnwxAWXi2+GyNByApxnf_DtP1-6+_zOKAdJKnJBexjg@mail.gmail.com/ Fixes: 1eebcb60633f ("libbpf: Implement basic zip archive parsing support") Signed-off-by: Daniel Müller --- tools/lib/bpf/zip.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/lib/bpf/zip.c b/tools/lib/bpf/zip.c index f561aa..3f26d62 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;