From bb25ae1a3e573867628cae9c97fa7b4dad4ef3cf Mon Sep 17 00:00:00 2001 From: dataCobra Date: Thu, 15 Feb 2024 15:16:13 +0100 Subject: [PATCH 1/2] gnu-efi-libs: update to 3.0.17. --- srcpkgs/gnu-efi-libs/patches/no-werror.patch | 18 +++++++----------- srcpkgs/gnu-efi-libs/template | 7 +++++-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/srcpkgs/gnu-efi-libs/patches/no-werror.patch b/srcpkgs/gnu-efi-libs/patches/no-werror.patch index f6cc95bdccffa..8d91760ded5bb 100644 --- a/srcpkgs/gnu-efi-libs/patches/no-werror.patch +++ b/srcpkgs/gnu-efi-libs/patches/no-werror.patch @@ -1,20 +1,16 @@ -Source: Alpine Linux (adapted) -Upstream: No -Reason: Fixes compilation on i686 - --- a/Make.defaults +++ b/Make.defaults -@@ -156,11 +156,11 @@ ifneq (mingw32,$(findstring mingw32, $(GCCMACHINE))) +@@ -183,11 +183,11 @@ ifneq (mingw32,$(findstring mingw32, $(GCCMACHINE))) endif ifeq (FreeBSD, $(findstring FreeBSD, $(OS))) -CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \ +CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra \ - -fshort-wchar -fno-strict-aliasing \ + -funsigned-char -fshort-wchar -fno-strict-aliasing \ -ffreestanding -fno-stack-protector else --CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \ -+CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra \ - -fshort-wchar -fno-strict-aliasing \ - -fno-merge-all-constants -ffreestanding -fno-stack-protector \ - -fno-stack-check +-CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Wno-pointer-sign -Werror \ ++CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Wno-pointer-sign \ + -funsigned-char -fshort-wchar -fno-strict-aliasing \ + -ffreestanding -fno-stack-protector -fno-stack-check \ + -fno-stack-check \ diff --git a/srcpkgs/gnu-efi-libs/template b/srcpkgs/gnu-efi-libs/template index 8e5b09f2cd20c..2f088744633b6 100644 --- a/srcpkgs/gnu-efi-libs/template +++ b/srcpkgs/gnu-efi-libs/template @@ -1,7 +1,7 @@ # Template file for 'gnu-efi-libs' pkgname=gnu-efi-libs reverts="3.0w_1" # Not an actual revert, xbps considers 3.0w higher than 3.0.8 -version=3.0.14 +version=3.0.17 revision=1 makedepends="pciutils-devel" short_desc="Library for building UEFI Applications using GNU toolchain" @@ -9,7 +9,7 @@ maintainer="Orphaned " license="GPL-2.0-or-later" homepage="https://sourceforge.net/projects/gnu-efi/" distfiles="${SOURCEFORGE_SITE}/gnu-efi/gnu-efi-${version}.tar.bz2" -checksum=b73b643a0d5697d1f396d7431448e886dd805668789578e3e1a28277c9528435 +checksum=7807e903349343a7a142ebb934703a2872235e89688cf586c032b0a1087bcaf4 nostrip=yes # If we are cross-building we need to pass the cross-compilation triplet @@ -41,6 +41,9 @@ case "$XBPS_TARGET_MACHINE" in esac do_build() { + # upstream provides LDFLAGS directly to ld: https://sourceforge.net/p/gnu-efi/bugs/33/ + LDFLAGS="${LDFLAGS//-Wl/}" + LDFLAGS="${LDFLAGS//,/ }" make ARCH=${TARGET_ARCH} HOSTARCH=${HOST_ARCH} } From e483d370c9e6ffa522157db2e2006ecb86c68e5f Mon Sep 17 00:00:00 2001 From: dataCobra Date: Thu, 15 Feb 2024 15:21:14 +0100 Subject: [PATCH 2/2] fwupd-efi: update to 1.4. --- srcpkgs/fwupd-efi/patches/cc-as-ld.patch | 78 ++++++++++++++++++++++++ srcpkgs/fwupd-efi/template | 12 ++-- 2 files changed, 82 insertions(+), 8 deletions(-) create mode 100644 srcpkgs/fwupd-efi/patches/cc-as-ld.patch diff --git a/srcpkgs/fwupd-efi/patches/cc-as-ld.patch b/srcpkgs/fwupd-efi/patches/cc-as-ld.patch new file mode 100644 index 0000000000000..67092dd0fb679 --- /dev/null +++ b/srcpkgs/fwupd-efi/patches/cc-as-ld.patch @@ -0,0 +1,78 @@ +--- a/meson.build ++++ b/meson.build +@@ -9,7 +9,6 @@ + conf.set_quoted('PACKAGE_VERSION', meson.project_version()) + + cc = meson.get_compiler('c') +-ld = cc.get_linker_id() + objcopy = find_program('objcopy') + objcopy_version = run_command(objcopy, '--version').stdout().split('\n')[0].split(' ')[-1] + +--- a/efi/generate_binary.py ++++ b/efi/generate_binary.py +@@ -29,9 +29,9 @@ + "-j", + ".rodata", + "-j", ++ ".areloc", ++ "-j", + ".rel*", +- "--section-alignment", +- "512", + args.infile, + args.outfile, + ] +--- a/efi/meson.build ++++ b/efi/meson.build +@@ -72,6 +72,11 @@ + coff_header_in_crt0 = false + endif + ++# For NX compat, we must ensure we have .note.GNU-stack ++if run_command('grep', '-q', '.note.GNU-stack', join_paths(efi_crtdir, arch_crt), check: false).returncode() != 0 ++ error('Cannot find NX section in @0@, update to gnu-efi 3.0.15+'.format(join_paths(efi_crtdir, arch_crt))) ++endif ++ + # older objcopy for Aarch64 and ARM32 are not EFI capable. + # Use 'binary' instead, and add required symbols manually. + if host_cpu == 'arm' or (host_cpu == 'aarch64' and (objcopy_version.version_compare ('< 2.38') or coff_header_in_crt0)) +@@ -95,7 +100,6 @@ + # is the system crt0 for arm and aarch64 new enough to know about SBAT? + if objcopy_manualsymbols + if get_option('efi_sbat_distro_id') != '' +- arch_crt_source = 'crt0-efi-@0@.S'.format(gnu_efi_path_arch) + cmd = run_command('grep', '-q', 'sbat', join_paths(efi_crtdir, arch_crt)) + if cmd.returncode() != 0 + warning('Cannot find SBAT section in @0@, using local copy'.format(join_paths(efi_crtdir, arch_crt))) +@@ -163,6 +167,12 @@ + '-L', efi_libdir, + join_paths(efi_crtdir, arch_crt)] + ++if host_cpu == 'aarch64' ++# Don't use 64KiB pages ++ efi_ldflags += ['-z', 'common-page-size=4096'] ++ efi_ldflags += ['-z', 'max-page-size=4096'] ++endif ++ + if objcopy_manualsymbols + # older objcopy for Aarch64 and ARM32 are not EFI capable. + # Use 'binary' instead, and add required symbols manually. +@@ -223,11 +233,16 @@ + fwupd_so_deps += [o_crt0] + endif + ++efi_cc_ldflags = [] ++foreach flag : efi_ldflags ++ efi_cc_ldflags += ['-Wl,' + flag] ++endforeach ++ + so = custom_target('fwup.so', + input : [o_file1, o_file2, o_file3, o_file4, o_file5], + output : 'fwup.so', +- command : [ld, '-o', '@OUTPUT@'] + +- efi_ldflags + ['@INPUT@'] + ++ command : [cc.cmd_array(), '-nostdlib', '-o', '@OUTPUT@'] + ++ efi_cc_ldflags + ['@INPUT@'] + + ['-lefi', '-lgnuefi', libgcc_file_name], + depends: fwupd_so_deps) + diff --git a/srcpkgs/fwupd-efi/template b/srcpkgs/fwupd-efi/template index 78a543fec1dd7..a1897e8f450d4 100644 --- a/srcpkgs/fwupd-efi/template +++ b/srcpkgs/fwupd-efi/template @@ -1,22 +1,18 @@ # Template file for 'fwupd-efi' pkgname=fwupd-efi -version=1.3 +version=1.4 revision=1 archs="x86_64* i686* arm* aarch64*" build_style=meson build_helper="gir" configure_args="-Defi-includedir=${XBPS_CROSS_BASE}/usr/include/efi - -Defi-ldsdir=${XBPS_CROSS_BASE}/usr/lib -Defi-ld=${XBPS_CROSS_BASE}/bin/ld + -Defi-ldsdir=${XBPS_CROSS_BASE}/usr/lib -Defi-libdir=${XBPS_CROSS_BASE}/usr/lib" hostmakedepends="efivar" -makedepends="libefivar-devel gnu-efi-libs" +makedepends="libefivar-devel gnu-efi-libs python3-pefile" short_desc="EFI Application used by uefi-capsule plugin in fwupd" maintainer="dkwo " license="LGPL-2.1-or-later" homepage="https://github.com/fwupd/fwupd-efi" distfiles="https://github.com/fwupd/fwupd-efi/archive/refs/tags/${version}.tar.gz" -checksum=0e76057c178e221f63eaf9142fa1d06780a8eb3df7cf0c11f92660138dec5c83 - -if [ "$CROSS_BUILD" ]; then - configure_args+=" -Defi-cc=/usr/bin/${XBPS_CROSS_TRIPLET}-gcc" -fi +checksum=b1f5fe72e16d4e2f4c616da416dc93bd79331057336208465da37bafe8f8f83d