-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upstream fix for efi stub linking failure
issue occurs if linker different than bfd is used but binutils 2.39 is present see systemd/systemd#24241
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
From bddad6089e7d1a19ccf56b612b748232f46461b6 Mon Sep 17 00:00:00 2001 | ||
From: Jan Janssen <medhefgo@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'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters