[packages/systemd] upstream fix for efi stub linking failure

atler atler at pld-linux.org
Wed Sep 14 10:22:09 CEST 2022


commit d4c99016fb9a5bb9882d1d7ec4a44270f1c719e6
Author: Jan Palus <atler at pld-linux.org>
Date:   Wed Sep 14 10:05:33 2022 +0200

    upstream fix for efi stub linking failure
    
    issue occurs if linker different than bfd is used but binutils 2.39 is
    present
    
    see https://github.com/systemd/systemd/issues/24241

 efi-linker-flags.patch | 39 +++++++++++++++++++++++++++++++++++++++
 systemd.spec           |  2 ++
 2 files changed, 41 insertions(+)
---
diff --git a/systemd.spec b/systemd.spec
index 4ef1ec4..eb03f06 100644
--- a/systemd.spec
+++ b/systemd.spec
@@ -80,6 +80,7 @@ Patch14:	pld-pam-%{name}-user.patch
 Patch15:	%{name}-x32.patch
 Patch16:	rpm-macros.patch
 Patch17:	%{name}-include.patch
+Patch18:	efi-linker-flags.patch
 URL:		https://www.freedesktop.org/wiki/Software/systemd/
 BuildRequires:	acl-devel
 %{?with_audit:BuildRequires:	audit-libs-devel}
@@ -773,6 +774,7 @@ Makra RPM-a definiujące ścieżki i skryptlety związane z systemd.
 %patch15 -p1
 %patch16 -p1
 %patch17 -p1
+%patch18 -p1
 
 cp -p %{SOURCE2} src/systemd_booted.c
 
diff --git a/efi-linker-flags.patch b/efi-linker-flags.patch
new file mode 100644
index 0000000..267d8b2
--- /dev/null
+++ b/efi-linker-flags.patch
@@ -0,0 +1,39 @@
+From bddad6089e7d1a19ccf56b612b748232f46461b6 Mon Sep 17 00:00:00 2001
+From: Jan Janssen <medhefgo at web.de>
+Date: Tue, 9 Aug 2022 10:32:41 +0200
+Subject: [PATCH] meson: Test correct efi linker for supported args
+
+Fixes: #24241
+---
+ src/boot/efi/meson.build | 18 +++++++++++++-----
+ 1 file changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
+index 127b4e17a3a7..95785dfd5d83 100644
+--- a/src/boot/efi/meson.build
++++ b/src/boot/efi/meson.build
+@@ -266,11 +266,19 @@ efi_ldflags = [
+         efi_crt0,
+ ]
+ 
+-possible_link_flags = [
+-        '-Wl,--no-warn-execstack',
+-        '-Wl,--no-warn-rwx-segments',
+-]
+-efi_ldflags += cc.get_supported_link_arguments(possible_link_flags)
++foreach arg : ['-Wl,--no-warn-execstack',
++               '-Wl,--no-warn-rwx-segments']
++        # We need to check the correct linker for supported args. This is what
++        # cc.has_multi_link_arguments() is for, but it helpfully overrides our
++        # choice of linker by putting its own -fuse-ld= arg after ours.
++        if run_command('bash', '-c',
++                       'exec "$@" -x c -o/dev/null <(echo "int main(void){return 0;}")' +
++                       ' -fuse-ld=' + efi_ld + ' -Wl,--fatal-warnings ' + arg,
++                       'bash', cc.cmd_array(),
++                       check : false).returncode() == 0
++                efi_ldflags += arg
++        endif
++endforeach
+ 
+ if efi_arch[1] in ['aarch64', 'arm', 'riscv64']
+         efi_ldflags += ['-shared']
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/systemd.git/commitdiff/78c3cf6fd299d2a24a385c5f2b412078e768b5a6



More information about the pld-cvs-commit mailing list