public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Stop the linker from loosing the entry point for COFF/PE code when compiling with LTO enabled.
@ 2023-05-04 13:26 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-05-04 13:26 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3539414584be0094b0a4fe56dfd64ea79d802edc

commit 3539414584be0094b0a4fe56dfd64ea79d802edc
Author: Nick Clifton <nickc@redhat.com>
Date:   Thu May 4 14:24:16 2023 +0100

    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:
---
 ld/ChangeLog        | 7 +++++++
 ld/emultempl/pe.em  | 3 +++
 ld/emultempl/pep.em | 3 +++
 3 files changed, 13 insertions(+)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index dcdf27cf423..121bdfd735f 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2023-05-04  Nick Clifton  <nickc@redhat.com>
+
+	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.
+
 2023-05-04  Dimitar Dimitrov  <dimitar@dinux.eu>
 
 	* scripttempl/pru.sc (OUTPUT_SECTION_ALIGN): New helper variable
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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-04 13:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-04 13:26 [binutils-gdb] Stop the linker from loosing the entry point for COFF/PE code when compiling with LTO enabled Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).