]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
ovmf: Fix build with GCC 16 and GLIBC 2.43
authorZoltán Böszörményi <zboszor@gmail.com>
Thu, 9 Apr 2026 12:22:25 +0000 (14:22 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 13 Apr 2026 20:42:31 +0000 (21:42 +0100)
Backport two patches from master to fix native build with
GCC 16 and GLIBC 2.43

commit 3597306191297b504683b83fe7750e49c6a2e836
Author: Gerd Hoffmann <kraxel@redhat.com>
Date:   Thu Jan 29 09:23:32 2026 +0100

    BaseTools/StringFuncs: fix gcc 16 warning

    StringFuncs.c: In function ‘SplitStringByWhitespace’:
    StringFuncs.c:113:15: error: variable ‘Item’ set but not used [-Werror=unused-but-set-variable=]
      113 |   UINTN       Item;
          |               ^~~~

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Author: Gerd Hoffmann <kraxel@redhat.com>
Date:   Mon Dec 8 10:28:50 2025 +0100

    BaseTools/EfiRom: fix compiler warning

    New warning after updating gcc:

    EfiRom.c: In function ‘main’:
    EfiRom.c:78:17: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]

    The assigned value is not used, so fix the warning by just removing it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/ovmf/ovmf/0001-BaseTools-StringFuncs-fix-gcc-16-warning.patch [new file with mode: 0644]
meta/recipes-core/ovmf/ovmf/0002-BaseTools-EfiRom-fix-compiler-warning.patch [new file with mode: 0644]
meta/recipes-core/ovmf/ovmf_git.bb

diff --git a/meta/recipes-core/ovmf/ovmf/0001-BaseTools-StringFuncs-fix-gcc-16-warning.patch b/meta/recipes-core/ovmf/ovmf/0001-BaseTools-StringFuncs-fix-gcc-16-warning.patch
new file mode 100644 (file)
index 0000000..38c2622
--- /dev/null
@@ -0,0 +1,43 @@
+From 3597306191297b504683b83fe7750e49c6a2e836 Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Thu, 29 Jan 2026 09:23:32 +0100
+Subject: [PATCH 1/2] BaseTools/StringFuncs: fix gcc 16 warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+StringFuncs.c: In function ‘SplitStringByWhitespace’:
+StringFuncs.c:113:15: error: variable ‘Item’ set but not used [-Werror=unused-but-set-variable=]
+  113 |   UINTN       Item;
+      |               ^~~~
+
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+Upstream-Status: Backport
+---
+ BaseTools/Source/C/Common/StringFuncs.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/BaseTools/Source/C/Common/StringFuncs.c b/BaseTools/Source/C/Common/StringFuncs.c
+index 53e44365e9..df02d9c808 100644
+--- a/BaseTools/Source/C/Common/StringFuncs.c
++++ b/BaseTools/Source/C/Common/StringFuncs.c
+@@ -110,7 +110,6 @@ SplitStringByWhitespace (
+   CHAR8       *EndOfSubString;\r
+   CHAR8       *EndOfString;\r
+   STRING_LIST *Output;\r
+-  UINTN       Item;\r
\r
+   String = CloneString (String);\r
+   if (String == NULL) {\r
+@@ -120,7 +119,7 @@ SplitStringByWhitespace (
\r
+   Output = NewStringList ();\r
\r
+-  for (Pos = String, Item = 0; Pos < EndOfString; Item++) {\r
++  for (Pos = String; Pos < EndOfString;) {\r
+     while (isspace ((int)*Pos)) {\r
+       Pos++;\r
+     }\r
+-- 
+2.53.0
+
diff --git a/meta/recipes-core/ovmf/ovmf/0002-BaseTools-EfiRom-fix-compiler-warning.patch b/meta/recipes-core/ovmf/ovmf/0002-BaseTools-EfiRom-fix-compiler-warning.patch
new file mode 100644 (file)
index 0000000..f463103
--- /dev/null
@@ -0,0 +1,45 @@
+From 9af06ef3cbb052b142f9660c2c01e7aeb401300c Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Mon, 8 Dec 2025 10:28:50 +0100
+Subject: [PATCH 2/2] BaseTools/EfiRom: fix compiler warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+New warning after updating gcc:
+
+EfiRom.c: In function ‘main’:
+EfiRom.c:78:17: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
+
+The assigned value is not used, so fix the warning by just removing it.
+
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+Upstream-Status: Backport
+---
+ BaseTools/Source/C/EfiRom/EfiRom.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/BaseTools/Source/C/EfiRom/EfiRom.c b/BaseTools/Source/C/EfiRom/EfiRom.c
+index fa7bf0e62e..6e903b3504 100644
+--- a/BaseTools/Source/C/EfiRom/EfiRom.c
++++ b/BaseTools/Source/C/EfiRom/EfiRom.c
+@@ -44,7 +44,6 @@ Returns:
+   FILE_LIST *FList;\r
+   UINT32    TotalSize;\r
+   UINT32    Size;\r
+-  CHAR8     *Ptr0;\r
\r
+   SetUtilityName(UTILITY_NAME);\r
\r
+@@ -75,7 +74,7 @@ Returns:
+   //\r
+   if (mOptions.DumpOption == 1) {\r
+     if (mOptions.FileList != NULL) {\r
+-      if ((Ptr0 = strstr ((CONST CHAR8 *) mOptions.FileList->FileName, DEFAULT_OUTPUT_EXTENSION)) != NULL) {\r
++      if (strstr ((CONST CHAR8 *) mOptions.FileList->FileName, DEFAULT_OUTPUT_EXTENSION) != NULL) {\r
+         DumpImage (mOptions.FileList);\r
+         goto BailOut;\r
+       } else {\r
+-- 
+2.53.0
+
index ec6c3b516cb9513418a2870eba40a15a13539fd0..107dcf0359e6bcbb49cf1e0e63dc355fadd4d187 100644 (file)
@@ -26,6 +26,8 @@ SRC_URI = "gitsm://github.com/tianocore/edk2.git;branch=master;protocol=https;ta
            file://0003-debug-prefix-map.patch \
            file://0004-reproducible.patch \
            file://0005-UefiCpuPkg-CpuExceptionHandlerLib-fix-push-instructi.patch \
+           file://0001-BaseTools-StringFuncs-fix-gcc-16-warning.patch \
+           file://0002-BaseTools-EfiRom-fix-compiler-warning.patch \
            "
 
 PV = "edk2-stable202511"