From nobody Mon Apr 29 00:09:36 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1504683872889805.6035628624395; Wed, 6 Sep 2017 00:44:32 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1CD0321E62BC6; Wed, 6 Sep 2017 00:41:41 -0700 (PDT) Received: from proxmox.maurer-it.com (proxmox.maurer-it.com [212.186.127.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6F47720958BDA for ; Wed, 6 Sep 2017 00:41:39 -0700 (PDT) Received: from proxmox.maurer-it.com (localhost [127.0.0.1]) by proxmox.maurer-it.com (Proxmox) with ESMTP id 8751F1000593; Wed, 6 Sep 2017 09:44:26 +0200 (CEST) X-Original-To: edk2-devel@lists.01.org To: edk2-devel@lists.01.org From: Thomas Lamprecht Message-ID: <9fbd059f-18d8-a798-da00-951f85c9fd1a@proxmox.com> Date: Wed, 6 Sep 2017 09:44:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Language: en-US Subject: [edk2] OvmfPkg/IoMmuDxe: unused-const-variable warning fails release build with GCC 6.3 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laszlo Ersek Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8"; format="flowed" Hi, commit 2ad6ba80a1bd58382bde6b994070f7c01d2fb48d Author: Laszlo Ersek Date: Wed Aug 30 14:00:58 2017 +0200 OvmfPkg/IoMmuDxe: IoMmuMap(): log nicer and more informative DEBUG msgs triggers a unused-const-variable warning for mBusMasterOperationName, and thus for releases with warnings-as-errors a build error. I'm using a quite vanilla Debian Stretch machine on amd64/x86_64 (running in qemu/KVM) as build host, gcc version is 6.3.0 20170516 (Debian 6.3.0-18) My build procedure looks like: # make -C BaseTools/ # . edksetup.sh # OvmfPkg/build.sh -a X64 -b RELEASE -n 4 -t GCC5 With current master (12cfc9009e7cf1a69ca675110c2cf6e21b152992) checked out. I suspect that gcc, at least in this version, cannot track the usage of the variable in crime in the DEBUG macros, and thus (falsely?) detects this war= ning. So I'm not quite sure if this is a problem with edk2/Ovmf itself or a probl= em stemming from gcc. The following patch fixes the problem quite nonchalantly by adding an unused attribute, which is highly probably not what is wanted as a clean fix - I guess - but it achieves my desired result :) ----8<---- diff --git a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c index bc57de5b57..8c0b8b0931 100644 --- a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c +++ b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c @@ -48,7 +48,7 @@ STATIC LIST_ENTRY mRecycledMapInfos =3D INITIALIZE_LIST_H= EAD_VARIABLE ( // ASCII names for EDKII_IOMMU_OPERATION constants, for debug logging. // STATIC CONST CHAR8 * CONST -mBusMasterOperationName[EdkiiIoMmuOperationMaximum] =3D { +mBusMasterOperationName[EdkiiIoMmuOperationMaximum] __attribute__ ((unused= )) =3D { "Read", "Write", "CommonBuffer", ---->8---- It naturally could be that I've got something wrong, wouldn't be the first = time, but I suspect that it's edk2 in combination with my GCC version this time. As I lack in depth knowledge of Ovmf it'd be nice if someone could confirm = my suspicion. CC'ing Laszlo as he is the author of the patch which lets this problem trigger and following this mailing list since a bit it seems that he surely has the in depth knowledge. Sorry that I wasn't patient enough to test other compiler version before posting here. cheers, Thomas _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel