Stop the linker from loosing the entry point for COFF/PE code when compiling with...
authorNick Clifton <nickc@redhat.com>
Thu, 4 May 2023 13:24:16 +0000 (14:24 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 4 May 2023 13:24:16 +0000 (14:24 +0100)
  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.

ld/ChangeLog
ld/emultempl/pe.em
ld/emultempl/pep.em

index dcdf27cf4237e275726ab31f3e8828b79752adf9..121bdfd735f8e08739e9c55b752b86e43864a85e 100644 (file)
@@ -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
index 55412d6ef9e35f2944b7dc92859dd6cd77898292..1f2a5f310be927e75fc695209a5806345a7b1df8 100644 (file)
@@ -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
index 2a3fd0e6ea802b3683dc786540d13b92f92e9160..ca4acaea1484d1537fc259a5713f5af0af963f37 100644 (file)
@@ -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