ovmf: backport a fix for build with gcc-16
PATCH 1/1 ovmf: backport a fix for build with gcc-16
From: Martin Jansa <[email protected]>
Fixes build on host with gcc-16:
StringFuncs.c: In function ‘SplitStringByWhitespace’:
StringFuncs.c:113:15: error: variable ‘Item’ set but not used [-Werror=unused-but-set-variable=]
113 | UINTN Item;
| ^~~~and
EfiRom.c: In function ‘main’:
EfiRom.c:78:17: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
78 | if ((Ptr0 = strstr ((CONST CHAR8 *) mOptions.FileList->FileName, DEFAULT_OUTPUT_EXTENSION)) != NULL) {
| ^
and one more for older version used in scarthgap
main.c: In function ‘ProcessArgs’:
main.c:163:42: error: too many arguments to function ‘p->process’; expected 0, have 2
163 | (*p->process)( *argv, *(argv+1) );
| ~^~~~~~~~~~~~ ~~~~~main.c:120:34: note: declared here
120 | WildFunc process;
| ^~~~~~~
main.c:168:42: error: too many arguments to function ‘p->process’; expected 0, have 1
168 | (*p->process)( *argv );
| ~^~~~~~~~~~~~ ~~~~~main.c:120:34: note: declared here
120 | WildFunc process;
| ^~~~~~~
--- ...Tools-StringFuncs-fix-gcc-16-warning.patch | 42 ++++++++++++++++++ ...aseTools-EfiRom-fix-compiler-warning.patch | 44 +++++++++++++++++++ .../0008-BaseTools-Pccts-set-C-standard.patch | 44 +++++++++++++++++++ meta/recipes-core/ovmf/ovmf_git.bb | 3 ++ 4 files changed, 133 insertions(+) create mode 100644 meta/recipes-core/ovmf/ovmf/0006-BaseTools-StringFuncs-fix-gcc-16-warning.patch create mode 100644 meta/recipes-core/ovmf/ovmf/0007-BaseTools-EfiRom-fix-compiler-warning.patch create mode 100644 meta/recipes-core/ovmf/ovmf/0008-BaseTools-Pccts-set-C-standard.patch
meta/recipes-core/ovmf/ovmf/0006-BaseTools-StringFuncs-fix-gcc-16-warning.patch new file +42 -0
@@ -0,0 +1,42 @@ +From 015c26aea52a54e96319887ea542870b4804fb91 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann <[email protected]> +Date: Thu, 29 Jan 2026 09:23:32 +0100 +Subject: [PATCH] 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 [edk2-stable202602 https://github.com/tianocore/edk2/commit/3597306191297b504683b83fe7750e49c6a2e836] +Signed-off-by: Martin Jansa <[email protected]> +--- + 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++; + }
meta/recipes-core/ovmf/ovmf/0007-BaseTools-EfiRom-fix-compiler-warning.patch new file +44 -0
44 lines not on this page · raw message
meta/recipes-core/ovmf/ovmf/0008-BaseTools-Pccts-set-C-standard.patch new file +44 -0
44 lines not on this page · raw message
meta/recipes-core/ovmf/ovmf_git.bb +3 -0
@@ -26,6 +26,9 @@ SRC_URI = "gitsm://github.com/tianocore/edk2.git;branch=master;protocol=https \ file://0004-reproducible.patch \ file://0001-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch \ file://0001-MdeModulePkg-Potential-UINT32-overflow-in-S3-ResumeC.patch \ + file://0006-BaseTools-StringFuncs-fix-gcc-16-warning.patch \ + file://0007-BaseTools-EfiRom-fix-compiler-warning.patch \ + file://0008-BaseTools-Pccts-set-C-standard.patch \ " PV = "edk2-stable202402"