diff --git a/0030-BaseTools-fix-gcc12-warning.patch b/0030-BaseTools-fix-gcc12-warning.patch new file mode 100644 index 0000000..ff687cd --- /dev/null +++ b/0030-BaseTools-fix-gcc12-warning.patch @@ -0,0 +1,50 @@ +From 84d64059dd0082609a43c7938a8a35e10da10706 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Mon, 24 Jan 2022 11:03:25 +0100 +Subject: [PATCH 30/32] BaseTools: fix gcc12 warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +GenFfs.c:545:5: error: pointer ‘InFileHandle’ used after ‘fclose’ [-Werror=use-after-free] + 545 | Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +GenFfs.c:544:5: note: call to ‘fclose’ here + 544 | fclose (InFileHandle); + | ^~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Gerd Hoffmann +--- + BaseTools/Source/C/GenFfs/GenFfs.c | 2 +- + BaseTools/Source/C/GenSec/GenSec.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c +index 949025c33325..d78d62ab3689 100644 +--- a/BaseTools/Source/C/GenFfs/GenFfs.c ++++ b/BaseTools/Source/C/GenFfs/GenFfs.c +@@ -542,7 +542,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment) + PeFileBuffer = (UINT8 *) malloc (PeFileSize); + if (PeFileBuffer == NULL) { + fclose (InFileHandle); +- Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle); ++ Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile); + return EFI_OUT_OF_RESOURCES; + } + fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle); +diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c +index d54a4f9e0a7d..b1d05367ec0b 100644 +--- a/BaseTools/Source/C/GenSec/GenSec.c ++++ b/BaseTools/Source/C/GenSec/GenSec.c +@@ -1062,7 +1062,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment) + PeFileBuffer = (UINT8 *) malloc (PeFileSize); + if (PeFileBuffer == NULL) { + fclose (InFileHandle); +- Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle); ++ Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile); + return EFI_OUT_OF_RESOURCES; + } + fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle); +-- +2.35.1 + diff --git a/0031-BaseTools-fix-gcc12-warning.patch b/0031-BaseTools-fix-gcc12-warning.patch new file mode 100644 index 0000000..c6cd39d --- /dev/null +++ b/0031-BaseTools-fix-gcc12-warning.patch @@ -0,0 +1,52 @@ +From c537b93adc2dc2243c6e53dfbbe8cd10fb073b7a Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Mon, 24 Jan 2022 11:04:55 +0100 +Subject: [PATCH 31/32] BaseTools: fix gcc12 warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Sdk/C/LzmaEnc.c: In function ‘LzmaEnc_CodeOneMemBlock’: +Sdk/C/LzmaEnc.c:2828:19: error: storing the address of local variable ‘outStream’ in ‘*p.rc.outStream’ [-Werror=dangling-pointer=] + 2828 | p->rc.outStream = &outStream.vt; + | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ +Sdk/C/LzmaEnc.c:2811:28: note: ‘outStream’ declared here + 2811 | CLzmaEnc_SeqOutStreamBuf outStream; + | ^~~~~~~~~ +Sdk/C/LzmaEnc.c:2811:28: note: ‘pp’ declared here +Sdk/C/LzmaEnc.c:2828:19: error: storing the address of local variable ‘outStream’ in ‘*(CLzmaEnc *)pp.rc.outStream’ [-Werror=dangling-pointer=] + 2828 | p->rc.outStream = &outStream.vt; + | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ +Sdk/C/LzmaEnc.c:2811:28: note: ‘outStream’ declared here + 2811 | CLzmaEnc_SeqOutStreamBuf outStream; + | ^~~~~~~~~ +Sdk/C/LzmaEnc.c:2811:28: note: ‘pp’ declared here +cc1: all warnings being treated as errors + +Signed-off-by: Gerd Hoffmann +--- + BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c +index 4e9b499f8d80..4b9f5fa69248 100644 +--- a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c ++++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c +@@ -2825,12 +2825,13 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit, + + nowPos64 = p->nowPos64; + RangeEnc_Init(&p->rc); +- p->rc.outStream = &outStream.vt; + + if (desiredPackSize == 0) + return SZ_ERROR_OUTPUT_EOF; + ++ p->rc.outStream = &outStream.vt; + res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize); ++ p->rc.outStream = NULL; + + *unpackSize = (UInt32)(p->nowPos64 - nowPos64); + *destLen -= outStream.rem; +-- +2.35.1 + diff --git a/0032-Basetools-turn-off-gcc12-warning.patch b/0032-Basetools-turn-off-gcc12-warning.patch new file mode 100644 index 0000000..bfa7560 --- /dev/null +++ b/0032-Basetools-turn-off-gcc12-warning.patch @@ -0,0 +1,42 @@ +From 15e8ff0438387a1737f136ab8f1ad513cfb52993 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Thu, 24 Mar 2022 10:28:45 +0100 +Subject: [PATCH 32/32] Basetools: turn off gcc12 warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In function ‘SetDevicePathEndNode’, + inlined from ‘FileDevicePath’ at DevicePathUtilities.c:857:5: +DevicePathUtilities.c:321:3: error: writing 4 bytes into a region of size 1 [-Werror=stringop-overflow=] + 321 | memcpy (Node, &mUefiDevicePathLibEndDevicePath, sizeof (mUefiDevicePathLibEndDevicePath)); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In file included from UefiDevicePathLib.h:22, + from DevicePathUtilities.c:16: +../Include/Protocol/DevicePath.h: In function ‘FileDevicePath’: +../Include/Protocol/DevicePath.h:51:9: note: destination object ‘Type’ of size 1 + 51 | UINT8 Type; ///< 0x01 Hardware Device Path. + | ^~~~ + +Signed-off-by: Gerd Hoffmann +--- + BaseTools/Source/C/DevicePath/GNUmakefile | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile +index 7ca08af9662d..b05d2bddfa68 100644 +--- a/BaseTools/Source/C/DevicePath/GNUmakefile ++++ b/BaseTools/Source/C/DevicePath/GNUmakefile +@@ -13,6 +13,9 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o DevicePathUtili + + include $(MAKEROOT)/Makefiles/app.makefile + ++# gcc 12 trips over device path handling ++BUILD_CFLAGS += -Wno-error=stringop-overflow ++ + LIBS = -lCommon + ifeq ($(CYGWIN), CYGWIN) + LIBS += -L/lib/e2fsprogs -luuid +-- +2.35.1 + diff --git a/efifs.spec b/efifs.spec index dc42559..e62f545 100644 --- a/efifs.spec +++ b/efifs.spec @@ -9,13 +9,13 @@ %global grub2_commit 1ea4e5ef09c06552402bf676ce262a661372f08d # Preferrably the latest stable version shipped in Fedora -%global edk2_stable_date 202105 +%global edk2_stable_date 202202 %global edk2_stable_str edk2-stable%{edk2_stable_date} Summary: Free software EFI/UEFI standalone file system drivers Name: efifs Version: 1.8 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ URL: https://efi.akeo.ie/ Source0: https://github.com/pbatard/efifs/archive/v%{version}/%{name}-%{version}.tar.gz @@ -27,6 +27,9 @@ Source1: https://git.savannah.gnu.org/cgit/grub.git/snapshot/grub-%{grub2 Source2: https://github.com/tianocore/edk2/archive/%{edk2_stable_str}.tar.gz # Small helper script to enable EfiFs drivers using efibootmgr Source3: efifs-enable.sh +Patch0: https://src.fedoraproject.org/rpms/edk2/raw/e3d786aa1d65dd0d01597b24b800d7c54f72f58f/f/0030-BaseTools-fix-gcc12-warning.patch +Patch1: https://src.fedoraproject.org/rpms/edk2/raw/e3d786aa1d65dd0d01597b24b800d7c54f72f58f/f/0031-BaseTools-fix-gcc12-warning.patch +Patch2: https://src.fedoraproject.org/rpms/edk2/raw/e3d786aa1d65dd0d01597b24b800d7c54f72f58f/f/0032-Basetools-turn-off-gcc12-warning.patch BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: make @@ -62,6 +65,10 @@ cd grub && patch -Np1 -i ../0001-GRUB-fixes.patch popd pushd edk2-%{edk2_stable_str} +%patch0 -p1 -b .0030-BaseTools-fix-gcc12-warning +%patch1 -p1 -b .0031-BaseTools-fix-gcc12-warning +%patch2 -p1 -b .0032-Basetools-turn-off-gcc12-warning + # Do not build BrotliCompress (because it's unused) sed -e '/BrotliCompress/d' -i BaseTools/Source/C/GNUmakefile @@ -98,6 +105,9 @@ install -p -m 0700 edk2-%{edk2_stable_str}/Build/EfiFs/RELEASE_GCC5/%{efi_arch_u %{efi_esp_dir}/ %changelog +* Mon Apr 18 2022 Robert Scheck 1.8-3 +- Update bundled edk2 to 202202 and add GCC 12 fixes (#2045335) + * Thu Jan 20 2022 Fedora Release Engineering - 1.8-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/sources b/sources index 4e4b016..08589b2 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (efifs-1.8.tar.gz) = 0ead0fecfbf8bc698af0498aa409e5f6bfb0bb840fb9a57843de46514e7389ef4760b7d768b692bd94aa275d49cb40cab9db9112cd1d38c66f08f5037cf5fa96 -SHA512 (edk2-stable202105.tar.gz) = c263345cbb243c63985f974a61f37c577a139d6a7099d2b8c9e1a553e5ebf16de12fb711b72624081c6bf637f8084bbf71731ab99e5747d81da460388ac25791 +SHA512 (edk2-stable202202.tar.gz) = 200690a4867331de06e0478869b85577bc510213ebe679f2103160efb84d94c82ac8481ef1f15c3e42c1e9f22b7c5ef0d6c8f2c655bce7702ce843551cf9bb83 SHA512 (grub-1ea4e5ef09c06552402bf676ce262a661372f08d.tar.gz) = d0024f5e39c3e65b92c05496a30ad0b54f35725428414c050ac2f68866d91033136d4a18a82f8dc8b3e3a5dca0b2e9d87d0cb7e842d58b3cf45982971a246d96