From 452411c00cad9fbb22e87ccc5840d8dd78ad9914 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 28 Aug 2023 22:03:36 +0100 Subject: gentoo auto-resync : 28:08:2023 - 22:03:35 --- sys-firmware/edk2-ovmf/Manifest | 8 ++-- sys-firmware/edk2-ovmf/edk2-ovmf-202105-r2.ebuild | 2 +- sys-firmware/edk2-ovmf/edk2-ovmf-202202.ebuild | 8 +++- .../edk2-ovmf-202202-binutils-2.41-textrels.patch | 21 +++++++++++ .../files/edk2-ovmf-202202-lld-textrels.patch | 43 ++++++++++++++++++++++ sys-firmware/edk2-ovmf/metadata.xml | 3 ++ 6 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 sys-firmware/edk2-ovmf/files/edk2-ovmf-202202-binutils-2.41-textrels.patch create mode 100644 sys-firmware/edk2-ovmf/files/edk2-ovmf-202202-lld-textrels.patch (limited to 'sys-firmware/edk2-ovmf') diff --git a/sys-firmware/edk2-ovmf/Manifest b/sys-firmware/edk2-ovmf/Manifest index 6bb7fc4051f8..e753ec9054fc 100644 --- a/sys-firmware/edk2-ovmf/Manifest +++ b/sys-firmware/edk2-ovmf/Manifest @@ -1,4 +1,6 @@ AUX edk2-ovmf-202105-werror.patch 2355 BLAKE2B 6ce16c0181da1922130209141cde93d1d0407c62f31927270dfe684ebe58cdda94269566231f5b5d0dbb8c1fbde55bd62be881925547d0b1d38b90563e3f480c SHA512 bca368756bab75345e4010b3c0eaa0d3e6a34e172aa662e09a4c89f90d4b4bc6a20a28b7bce5b0fdd678f7f9113193d09a89e49b5d1d6b8a362c445b4098189f +AUX edk2-ovmf-202202-binutils-2.41-textrels.patch 2600 BLAKE2B e3ddfcf36190762cf2589faa777f19f04bc7d3363a226885fa96a17cfbd29f9dd6d6b6501f85080c789b09c34a9174154e2b9dca7f1d1cd274841cf20e8835d2 SHA512 17c01bfc9eb2d2f356e16c08ef5c3def635fd502a9e50692bd5aa3e3a11f999997d0783c8a3b828ede96b34a1e23d4a6d9398607f4a9d0ddc597de3fa2e9a8cf +AUX edk2-ovmf-202202-lld-textrels.patch 2555 BLAKE2B 63b31c92b2fdd043a9569538f448f9b1d5c6d5ec00e981344b07c41fa370acfd69863939475e9d3565c5a52429af61268e72f9531734f8faad87cd6fca9d84cd SHA512 2cbdc3c40267f82ac6a958b6569c5056e8700466732155aaebc041e176c228cf6036632d04225fa86e1de953cb4717a2b6d5e76efda15aa26a50a5ddb8233e05 DIST brotli-666c3280cc11dc433c303d79a83d4ffbdd12cc8d.tar.gz 23855739 BLAKE2B 7406ec5b29ac66afbcd7c1376bb3208f298d19b6592b2869c52173aa64947d58bd443f9a61c67deaf046be910a0e31c0b843e5508e97e0e1f5e7bce100d86904 SHA512 df8e90562c4fd7f0e787949df6bc4f5a165b39bd333f442d27874fe65640fbba268f9350d7113e6761a5acceb66d78e75f1a296e5a89b94574edf28109cdc812 DIST brotli-f4153a09f87cbb9c826d8fc12c74642bb2d879ea.tar.gz 512229 BLAKE2B cd86cc2cc7eefad24f87cda8006409bf764922b5f23ccfb951e7a41214b12004ce532b11f94f5fb858b3bf71f9abf8ef17ba219fa96bd5be23b51873afad0fd5 SHA512 7f48e794e738b31c2005e7cef6d8c0cc0d543f1cd8c137ae8ba14602cac2873de6299a3f32ad52be869f513e7548341353ed049609daef1063975694d9a9b80b DIST edk2-ovmf-202105-qemu-firmware.tar.xz 672 BLAKE2B e87845a84c83f65db836fd054c81a4f3062d5e0fcc51aa0ecf9c2d23c8741f218d38ef737d140f5935ce8d9c34508e5f3b9f54bf9c547a391fa63cdc2ecf1233 SHA512 6100502f26db26e407dacce57c96b1abfd372bcb31767a068332afa09ac435a092fd2a73db27670d27c6e927c26e88315346bbac70578571108434b9683bd00c @@ -8,6 +10,6 @@ DIST edk2-ovmf-202202-qemu-firmware.tar.xz 664 BLAKE2B 1aa4e25804ce0f3c967c80999 DIST edk2-ovmf-202202.tar.gz 14208170 BLAKE2B d8411e6808b335ccd551349a10c983b9448a357e73273fa6c30a07785e27feffed0224950ee98b668712c33f6739a9b006e5043b7dfd014f48dba9fd449b3354 SHA512 200690a4867331de06e0478869b85577bc510213ebe679f2103160efb84d94c82ac8481ef1f15c3e42c1e9f22b7c5ef0d6c8f2c655bce7702ce843551cf9bb83 DIST openssl-d82e959e621a3d597f1e0d50ff8c2d8b96915fd7.tar.gz 10034310 BLAKE2B 6996979dc12a523d565830e7b0943feb682a376f71ddb6f20cb8b9976bb7f12e39f088abaa45d514933ef79c0e4a2933dc6f1af4774fedaa16e74c0081c358e7 SHA512 a89bc652dc4318c5e8a9c594a43d890ca05dfc1acd6b15e2a8ab8b5628b5f33994143ff8024230e07b9e67556b28ea3a5e36763aa72dec20b52022ca8c6f2a7e DIST openssl-e2e09d9fba1187f8d6aafaa34d4172f56f1ffb72.tar.gz 9981169 BLAKE2B 33aac7364cdd45fec5654ab6caef84e1a829464380419c8a6bb311055c5a01c0aaff6e046a7c541a87e908fa9d26bae652f5be901461d03df36f2522f9c34b0c SHA512 db2087c04f0b428b3f4e1c8b3ac53cce69e0fd331ed2b86ba00facafd1685864d73f71c13eee48f4fe0af2bddad848f84a2b8ed2a17fabdf7fa2ed7d9eb39371 -EBUILD edk2-ovmf-202105-r2.ebuild 5147 BLAKE2B 201f10d4b3e93b6b25e74f4d5a0e3c34fa0640b06db6b6445b15455bc8787458a1ca6c0fcde20cfdcf9d16e56da1d57fe02300a92fb5263efe70b866dc642940 SHA512 6efcc132607ffd3edf5c6e9010873f858c49ab77c4cd249e32e6562a343bce3d15d5c9ef3a1ea92c1647e4f73c03cc9a37c2dbdf991d6e971c2b7d7c030725ad -EBUILD edk2-ovmf-202202.ebuild 4769 BLAKE2B 9430d9e3b269a4c0ee712e180d0afd98bd3f0da9fa937c4bdd0c43908a06ea24f2378fbeb4bd1a1bd949b67c157056fe51d5554150e9ec6426fbc44f132fc14f SHA512 d055702701651115dd2f349fd77bcbf5061db9729e61c67682c3fe25fdfcc97f5c8eb87e22b608f34266c2dcfd8bf606272f4086bd3e100bc68e100965009850 -MISC metadata.xml 436 BLAKE2B 091a94f2295817e420f919cc87c89b2ac5aab07f7d1b3279fa153bd89395ed9278d429aa75aa0aa3820ad9ee9400e80c1d4f56a3940eb8b37e39f767438f508a SHA512 d5854375acb0fcdf482458d80f0f916389cba9709a9cdc61ff9dc6ffc8bf5a145445fdf252fe543ea7d25ccd0491089b56aff32c7a30d7470be63acc30ad81d7 +EBUILD edk2-ovmf-202105-r2.ebuild 5146 BLAKE2B 0b95c308f5eb022c48bb1f3fdeaae7ba6db80f4aa789078a0ea8c819c04635ed3b64e4f8c421daf768c89987cee2c3792d87097669d610a62dd80a377f585bbc SHA512 0ab8889e97dea11eb74140421e819911579e32d3b6c632c8b6ad66b2e79ecf0eba7a92c40480f66a815ee9c4ff6806b17f345f8c8ed7c33bc13b2c2038dc2bd9 +EBUILD edk2-ovmf-202202.ebuild 4967 BLAKE2B 9fdf9c6b4ef25088ff83ea47e0cf6adcf18045cc60edbfbd4a64082c0df0c0c739c3d8c25564f97c29bf7ecaaf89d0cfb593e1a9e9363c84dde1a001403f7088 SHA512 a8e13032b229f7a528f5a75267600cada5aeccca7479cc31168e699458b55ccbc54286051ce7c45d71979f828c760e2629129dbfaa8f972954fde7168fa88022 +MISC metadata.xml 512 BLAKE2B a91055d89a5a0e5d91681001183aee1847e034a081a31ab2c107a4a1d341d0cc43e11c352f042ed6e7fb2e6e1c5dcb0afc5a72ef87f32e615aa377d57ebe9056 SHA512 d7fcf625b765140bbd827325592c31d5957b58396f1e3eef6efe460aaec2f7399fed27cd30250680fc91d88925d99f1151c3410732b6a2cfb457a04dd10b000a diff --git a/sys-firmware/edk2-ovmf/edk2-ovmf-202105-r2.ebuild b/sys-firmware/edk2-ovmf/edk2-ovmf-202105-r2.ebuild index e7b13c536c1f..77b264824aeb 100644 --- a/sys-firmware/edk2-ovmf/edk2-ovmf-202105-r2.ebuild +++ b/sys-firmware/edk2-ovmf/edk2-ovmf-202105-r2.ebuild @@ -4,7 +4,7 @@ EAPI=7 PYTHON_REQ_USE="sqlite" -PYTHON_COMPAT=( python3_{9,10,11} ) +PYTHON_COMPAT=( python3_{10..11} ) inherit python-any-r1 readme.gentoo-r1 secureboot diff --git a/sys-firmware/edk2-ovmf/edk2-ovmf-202202.ebuild b/sys-firmware/edk2-ovmf/edk2-ovmf-202202.ebuild index 322c5a16bc5d..43332ccb0057 100644 --- a/sys-firmware/edk2-ovmf/edk2-ovmf-202202.ebuild +++ b/sys-firmware/edk2-ovmf/edk2-ovmf-202202.ebuild @@ -4,7 +4,7 @@ EAPI=8 PYTHON_REQ_USE="sqlite" -PYTHON_COMPAT=( python3_{9,10,11} ) +PYTHON_COMPAT=( python3_{10..11} ) inherit python-any-r1 readme.gentoo-r1 secureboot @@ -36,6 +36,8 @@ RDEPEND="!sys-firmware/edk2-ovmf-bin" PATCHES=( "${FILESDIR}/${PN}-202105-werror.patch" + "${FILESDIR}/${PN}-202202-lld-textrels.patch" + "${FILESDIR}/${PN}-202202-binutils-2.41-textrels.patch" ) S="${WORKDIR}/edk2-edk2-stable${PV}" @@ -104,6 +106,10 @@ src_compile() { -D SMM_REQUIRE \ -D EXCLUDE_SHELL_FROM_FD" + export LDFLAGS="-z notext" + export EXTRA_LDFLAGS="-z notext" + export DLINK_FLAGS="-z notext" + emake ARCH=${TARGET_ARCH} -C BaseTools . ./edksetup.sh diff --git a/sys-firmware/edk2-ovmf/files/edk2-ovmf-202202-binutils-2.41-textrels.patch b/sys-firmware/edk2-ovmf/files/edk2-ovmf-202202-binutils-2.41-textrels.patch new file mode 100644 index 000000000000..22d33c9097aa --- /dev/null +++ b/sys-firmware/edk2-ovmf/files/edk2-ovmf-202202-binutils-2.41-textrels.patch @@ -0,0 +1,21 @@ +https://bugs.gentoo.org/913110 +--- a/BaseTools/Conf/tools_def.template ++++ b/BaseTools/Conf/tools_def.template +@@ -1906,7 +1906,7 @@ DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z comm + DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address + DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address + DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable +-DEFINE GCC48_IA32_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive ++DEFINE GCC48_IA32_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive -Wl,-z,notext + DEFINE GCC48_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON) + DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_FLAGS) -Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie + DEFINE GCC48_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 DEF(GCC_DLINK2_FLAGS_COMMON) +@@ -1929,7 +1929,7 @@ DEFINE GCC49_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -fno-pic -fno-pi + DEFINE GCC49_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) + DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40 + DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable +-DEFINE GCC49_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive ++DEFINE GCC49_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive -Wl,-z,notext + DEFINE GCC49_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS) + DEFINE GCC49_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie + DEFINE GCC49_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS) diff --git a/sys-firmware/edk2-ovmf/files/edk2-ovmf-202202-lld-textrels.patch b/sys-firmware/edk2-ovmf/files/edk2-ovmf-202202-lld-textrels.patch new file mode 100644 index 000000000000..eb8b6296fcff --- /dev/null +++ b/sys-firmware/edk2-ovmf/files/edk2-ovmf-202202-lld-textrels.patch @@ -0,0 +1,43 @@ +https://bugs.gentoo.org/913110 +https://github.com/tianocore/edk2/commit/a257988f590ba90dd8394dd6bc7014ae9d814a08 + +From a257988f590ba90dd8394dd6bc7014ae9d814a08 Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Mon, 3 Apr 2023 22:29:15 +0800 +Subject: [PATCH] BaseTools/tools_def CLANGDWARF: Permit text relocations + +We rely on PIE executables to get the codegen that is suitable for +PE/COFF conversion where the resulting executables can be loaded +anywhere in the address space. + +However, ELF linkers may default to disallowing text relocations in PIE +executables, as this would require text segments to be updated at +runtime, which is bad for security and increases the copy-on-write +footprint of ELF executables and shared libraries. + +However, none of those concerns apply to PE/COFF executables in the +context of EFI, which are copied into memory rather than mmap()'ed, and +fixed up by the loader before launch. + +So pass -z notext to the LLD linker to permit runtime relocations in +read-only sections. + +Signed-off-by: Ard Biesheuvel +Reviewed-by: Rebecca Cran +--- + BaseTools/Conf/tools_def.template | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template +index 39c49b8001f4..9a5c11f6a385 100755 +--- a/BaseTools/Conf/tools_def.template ++++ b/BaseTools/Conf/tools_def.template +@@ -2870,7 +2870,7 @@ DEFINE CLANGDWARF_X64_PREFIX = ENV(CLANG_BIN) + DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-q,--gc-sections -z max-page-size=0x40 + DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds + DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable +-DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive ++DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive -Wl,-z,notext + DEFINE CLANGDWARF_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) + DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) + diff --git a/sys-firmware/edk2-ovmf/metadata.xml b/sys-firmware/edk2-ovmf/metadata.xml index 26afde23af57..eda06b3e2ed0 100644 --- a/sys-firmware/edk2-ovmf/metadata.xml +++ b/sys-firmware/edk2-ovmf/metadata.xml @@ -12,4 +12,7 @@ Use pre-built binaries + + tianocore/edk2 + -- cgit v1.2.3