File 1017-efi-workarounds-for-building-PEs-with-gcc7.patch of Package systemd.38170

From 0114ef6581149acbe21caffb5a69310f4303fbcd Mon Sep 17 00:00:00 2001
From: Franck Bui <fbui@suse.com>
Date: Wed, 27 Sep 2023 12:29:20 +0200
Subject: [PATCH 1017/1017] efi: workarounds for building PEs with gcc7

- "-static-pie" is missing: replace it with its full equivalent cmdline
  (according to Michael Matz):

  % gcc -static -pie -Wl,-pie -Wl,--no-dynamic-linker -Wl,-z,text hello.o

- For now disable the build of empty addon stub due to the following error:

  [   41s] /usr/bin/ld.bfd: warning: src/boot/efi/addonx64.elf.stub has a LOAD segment with RWX permissions
  [   41s] collect2: error: ld returned 1 exit status

  The trick in the linker script elf2efi.lds to avoid the merge of .text and
  .dynsym section doesn't work.
---
 src/boot/efi/meson.build | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
index 9a60a57329..9ad038e51a 100644
--- a/src/boot/efi/meson.build
+++ b/src/boot/efi/meson.build
@@ -157,7 +157,8 @@ efi_c_ld_args = [
 
         '-lgcc',
         '-nostdlib',
-        '-static-pie',
+        '-static',
+        '-pie',
         '-Wl,--entry=efi_main',
         '-Wl,--fatal-warnings',
 
@@ -347,19 +348,6 @@ foreach archspec : efi_archspecs
                 override_options : efi_override_options,
                 name_suffix : 'elf.stub',
                 pie : true)
-
-        efi_elf_binaries += executable(
-                'addon' + archspec['arch'],
-                addon_sources,
-                include_directories : efi_includes,
-                c_args : archspec['c_args'],
-                link_args : archspec['link_args'],
-                link_depends : elf2efi_lds,
-                dependencies : versiondep,
-                gnu_symbol_visibility : 'hidden',
-                override_options : efi_override_options,
-                name_suffix : 'elf.stub',
-                pie : true)
 endforeach
 
 foreach efi_elf_binary : efi_elf_binaries
-- 
2.35.3

openSUSE Build Service is sponsored by