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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31B84C7619A for ; Wed, 5 Apr 2023 23:51:11 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 668908600B; Thu, 6 Apr 2023 01:49:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="YE7Kjogm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 08C7785FB3; Thu, 6 Apr 2023 01:49:21 +0200 (CEST) Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E4F8B85FE7 for ; Thu, 6 Apr 2023 01:49:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-5491fa028adso212233307b3.10 for ; Wed, 05 Apr 2023 16:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1680738550; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WNz1OY+E9MjHmz1z7/8dzf4fRALowjcS0hUPxN6aBsY=; b=YE7KjogmWbNU7HZ1AmduesYxWcNs5lCW7EeAMcXnMbAX+8so//sNTnSZz79UxTLm7m uhk0gIWoS0ohLE5sQTQpFfJ6PRA2BNzM016tCbVlOgr4QMfnln23ZbsxBuh7pR76LIT/ 0dXfcETWf76fQsx9WOKlNJBFKtv077OqRNobY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680738550; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WNz1OY+E9MjHmz1z7/8dzf4fRALowjcS0hUPxN6aBsY=; b=Y9S5UDzfiph2oWZl6TToHHyp3pJ2AchxQ+bwjgqlgjF1p5wdNp0M2WS4SHM8KXD0t5 RrXNveiG/KGkfDrIdXnjiv62iogjI38mYzJOsILK5G2vMIbDWrUn7yDtPdLl2c0FT7sf R+pJHm7ur7sy4a3+u+7x1GuoAGkVnmrOlG07ODtoqDrRui9Rvdh42PeW4s5pFG0ZziW6 eyA010rhz/8ckAH0FoDr6HlxKFOYN1mo9rz5N9mLfNUagBM0Ddd51UjsKJ2bzKDW2tMp DVzHJ1/Nx5eudeyJpmZM4skfi85sJ8gzJtXdmRlc+61FP+IPonsE69rfHaRyHvfTWkpC KFcQ== X-Gm-Message-State: AAQBX9el1FX4ZiUnibK0mfv+PmAL3H7h5duwg1ExhgIR/1If0bmaYOBB GLGwSltCjCGCltqZ9U6dnHsp/O0ucZvuSJ2pKO6Ibg== X-Google-Smtp-Source: AKy350Zs55T6nGXxcA9JIfFPviX/UFrFtOdBy2xpi/g9DpvGcRRoIsCfOhoUp8NNRqN1c5yjzgPC1w== X-Received: by 2002:a81:4e06:0:b0:536:cd10:ef06 with SMTP id c6-20020a814e06000000b00536cd10ef06mr6896076ywb.27.1680738550533; Wed, 05 Apr 2023 16:49:10 -0700 (PDT) Received: from bill-the-cat.lan (2603-6081-7b00-6400-acff-1005-f218-7c24.res6.spectrum.com. [2603:6081:7b00:6400:acff:1005:f218:7c24]) by smtp.gmail.com with ESMTPSA id l33-20020a81ad61000000b00545a08184b1sm4215448ywk.65.2023.04.05.16.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 16:49:10 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas Subject: [PATCH 8/9] clang: efi payload: Silence unaligned access warning Date: Wed, 5 Apr 2023 19:48:58 -0400 Message-Id: <20230405234859.1446811-9-trini@konsulko.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230405234859.1446811-1-trini@konsulko.com> References: <20230405234859.1446811-1-trini@konsulko.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean When building with clang we see this warning: field guid within 'struct efi_hii_keyboard_layout' is less aligned than 'efi_guid_t' and is usually due to 'struct efi_hii_keyboard_layout' being packed, which can lead to unaligned accesses [-Wunaligned-access] Which is correct and true as EFI payloads are by specification allowed to do unaligned access. And so to silence the warning here and only here, we make use of #pragma to push/pop turning off the warning. Signed-off-by: Tom Rini --- Cc: Heinrich Schuchardt Cc: Ilias Apalodimas --- include/efi_api.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/efi_api.h b/include/efi_api.h index dc6e5ce236c9..f3bcbf593bea 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -1168,9 +1168,21 @@ struct efi_key_descriptor { u16 affected_attribute; } __packed; +/* The warniing: + * field guid within 'struct efi_hii_keyboard_layout' is less aligned than 'efi_guid_t' and is usually due to 'struct efi_hii_keyboard_layout' being packed, which can lead to unaligned accesses [-Wunaligned-access] + * is intentional due to EFI requiring unaligned access to be supported. + */ struct efi_hii_keyboard_layout { u16 layout_length; +#ifdef CONFIG_CC_IS_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunaligned-access" +#endif efi_guid_t guid; +#ifdef CONFIG_CC_IS_CLANG +#pragma clang diagnostic pop +#endif + u32 layout_descriptor_string_offset; u8 descriptor_count; struct efi_key_descriptor descriptors[]; -- 2.34.1