summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/systemd/systemd-boot_254.4.bb4
-rw-r--r--meta/recipes-core/systemd/systemd/0030-meson-Pass-all-static-pie-args-to-linker.patch35
2 files changed, 39 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd-boot_254.4.bb b/meta/recipes-core/systemd/systemd-boot_254.4.bb
index 4ee25ee72f..2b43ccf243 100644
--- a/meta/recipes-core/systemd/systemd-boot_254.4.bb
+++ b/meta/recipes-core/systemd/systemd-boot_254.4.bb
@@ -8,6 +8,10 @@ DEPENDS = "intltool-native libcap util-linux gperf-native python3-jinja2-native
8inherit meson pkgconfig gettext 8inherit meson pkgconfig gettext
9inherit deploy 9inherit deploy
10 10
11SRC_URI += " \
12 file://0030-meson-Pass-all-static-pie-args-to-linker.patch \
13 "
14
11LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} " 15LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} "
12 16
13EFI_LD = "bfd" 17EFI_LD = "bfd"
diff --git a/meta/recipes-core/systemd/systemd/0030-meson-Pass-all-static-pie-args-to-linker.patch b/meta/recipes-core/systemd/systemd/0030-meson-Pass-all-static-pie-args-to-linker.patch
new file mode 100644
index 0000000000..8e563238ef
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0030-meson-Pass-all-static-pie-args-to-linker.patch
@@ -0,0 +1,35 @@
1From f85a387a67900b02c69abccb88c2ef7191c67277 Mon Sep 17 00:00:00 2001
2From: Jan Janssen <medhefgo@web.de>
3Date: Sun, 1 Oct 2023 09:55:48 +0200
4Subject: [PATCH] meson: Pass all -static-pie args to linker
5
6Fixes: #29381
7
8Upstream-Status: Backport [https://github.com/systemd/systemd/commit/cecbb162a3134b43d2ca160e13198c73ff34c3ef]
9Signed-off-by: Viswanath Kraleti <quic_vkraleti@quicinc.com>
10---
11 src/boot/efi/meson.build | 11 ++++++++---
12 1 file changed, 8 insertions(+), 3 deletions(-)
13
14diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
15index 2773eaf286..9a60a57329 100644
16--- a/src/boot/efi/meson.build
17+++ b/src/boot/efi/meson.build
18@@ -161,9 +161,14 @@ efi_c_ld_args = [
19 '-Wl,--entry=efi_main',
20 '-Wl,--fatal-warnings',
21
22- # These flags should be passed by -static-pie, but seem to be missing sometimes.
23- '-Wl,--no-dynamic-linker',
24- '-z', 'text',
25+ # These flags should be passed by -static-pie, but for whatever reason the flag translation
26+ # is not enabled on all architectures. Not passing `-static` would just allow the linker to
27+ # use dynamic libraries, (which we can't/don't use anyway). But if `-pie` is missing and the
28+ # gcc build does not default to `-pie` we get a regular (no-pie) binary that will be
29+ # rightfully rejected by elf2efi. Note that meson also passes `-pie` to the linker driver,
30+ # but it is overridden by our `-static-pie`. We also need to pass these directly to the
31+ # linker as `-static`+`-pie` seem to get translated differently.
32+ '-Wl,-static,-pie,--no-dynamic-linker,-z,text',
33
34 # EFI has 4KiB pages.
35 '-z', 'common-page-size=4096',