Skip to contentSkip to conversation

ovmf: Fix build with GCC 16 and GLIBC 2.43

PATCH New Zoltán Böszörményi 1 participant 1 message Apr 9

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ovmf: Fix build with GCC 16 and GLIBC 2.43

Backport two patches from master to fix native build with GCC 16 and GLIBC 2.43

commit 3597306191297b504683b83fe7750e49c6a2e836

Author: Gerd Hoffmann <[email protected]>
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;
| ^~~~

Author: Gerd Hoffmann <[email protected]>
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.

---
 ...Tools-StringFuncs-fix-gcc-16-warning.patch | 43 ++++++++++++++++++
 ...aseTools-EfiRom-fix-compiler-warning.patch | 45 +++++++++++++++++++
 meta/recipes-core/ovmf/ovmf_git.bb            |  2 +
 3 files changed, 90 insertions(+)
 create mode 100644 meta/recipes-core/ovmf/ovmf/0001-BaseTools-StringFuncs-fix-gcc-16-warning.patch
 create mode 100644 meta/recipes-core/ovmf/ovmf/0002-BaseTools-EfiRom-fix-compiler-warning.patch
meta/recipes-core/ovmf/ovmf/0001-BaseTools-StringFuncs-fix-gcc-16-warning.patch new file +43 -0
new file mode 100644
index 0000000000..38c26224df
@@ -0,0 +1,43 @@
+From 3597306191297b504683b83fe7750e49c6a2e836 Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <[email protected]>
+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 <[email protected]>
+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;
+   CHAR8       *EndOfString;
+   STRING_LIST *Output;
+-  UINTN       Item;
+ 
+   String = CloneString (String);
+   if (String == NULL) {
+@@ -120,7 +119,7 @@ SplitStringByWhitespace (
+ 
+   Output = NewStringList ();
+ 
+-  for (Pos = String, Item = 0; Pos < EndOfString; Item++) {
++  for (Pos = String; Pos < EndOfString;) {
+     while (isspace ((int)*Pos)) {
+       Pos++;
+     }
+-- 
+2.53.0
+
meta/recipes-core/ovmf/ovmf/0002-BaseTools-EfiRom-fix-compiler-warning.patch new file +45 -0

45 lines not on this page · raw message

meta/recipes-core/ovmf/ovmf_git.bb +2 -0
index ec6c3b516c..107dcf0359 100644
@@ -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"
Signature · 1 line
2.53.0