summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorElyes Haouas <ehaouas@noos.fr>2023-05-06 14:37:48 +0200
committerFelix Held <felix-coreboot@felixheld.de>2023-05-26 15:17:45 +0000
commita28e2358c207cd98f806e1ed7a64143f4d9821a9 (patch)
tree3947734bc69d5c4bcbbb0c8fe0446d8537ee8f79 /util
parent9fb599bd9b4c73e573842a2a874964034034484e (diff)
util/crossgcc: Update binutils-2.40 import set_entry_point patch
Import set_entry_point patch from https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3539414584be0094b0a4fe56dfd64ea79d802edc to fix issue in binutils 2.40 with LTO when applied to PE/PE+ binaries (i.e. UEFI). Change-Id: I3844b53c8761239932ce91c2ff19ed0402321d1a Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/74974 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Diffstat (limited to 'util')
-rw-r--r--util/crossgcc/patches/binutils-2.40_stop_loosing_entry_point_when_LTO_enabled.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/util/crossgcc/patches/binutils-2.40_stop_loosing_entry_point_when_LTO_enabled.patch b/util/crossgcc/patches/binutils-2.40_stop_loosing_entry_point_when_LTO_enabled.patch
new file mode 100644
index 0000000000..548540c8c4
--- /dev/null
+++ b/util/crossgcc/patches/binutils-2.40_stop_loosing_entry_point_when_LTO_enabled.patch
@@ -0,0 +1,42 @@
+From 3539414584be0094b0a4fe56dfd64ea79d802edc Mon Sep 17 00:00:00 2001
+From: Nick Clifton <nickc@redhat.com>
+Date: Thu, 4 May 2023 14:24:16 +0100
+Subject: [PATCH] Stop the linker from loosing the entry point for COFF/PE code
+ when compiling with LTO enabled.
+
+ PR 30300
+ * emultempl/pep.em (set_entry_point): Add an undefined reference to the entry point if it has been constructed heuristically.
+ * emultempl/pe.em (set_entry_point): Likewise.
+---
+
+diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
+index 55412d6ef9e..1f2a5f310be 100644
+--- a/ld/emultempl/pe.em
++++ b/ld/emultempl/pe.em
+@@ -659,6 +659,9 @@ set_entry_point (void)
+ }
+
+ lang_default_entry (entry);
++
++ if (bfd_link_executable (&link_info) && ! entry_from_cmdline)
++ ldlang_add_undef (entry, false);
+ }
+
+ static void
+diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
+index 2a3fd0e6ea8..ca4acaea148 100644
+--- a/ld/emultempl/pep.em
++++ b/ld/emultempl/pep.em
+@@ -631,6 +631,9 @@ set_entry_point (void)
+ }
+
+ lang_default_entry (entry);
++
++ if (bfd_link_executable (&link_info) && ! entry_from_cmdline)
++ ldlang_add_undef (entry, false);
+ }
+
+ static void
+--
+2.31.1
+