[PATCH] Do not use DLL entry point for executables

fziglio@redhat.com fziglio@redhat.com
Fri Aug 28 09:44:42 GMT 2020


From: Frediano Ziglio <fziglio@redhat.com>

bfd_link_pic check for dll or pie type.
If the type is pie the results should be an executable which
entry point should be an executable entry point, not a DLL
one.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 ld/emultempl/pe.em  | 2 +-
 ld/emultempl/pep.em | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 9d2097f486..8b44d65c1d 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -571,7 +571,7 @@ set_entry_point (void)
   /* Entry point name for arbitrary subsystem numbers.  */
   static const char default_entry[] = "mainCRTStartup";
 
-  if (bfd_link_pic (&link_info) || dll)
+  if (bfd_link_dll (&link_info) || dll)
     {
 #if defined (TARGET_IS_i386pe)
       entry = "DllMainCRTStartup@12";
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 7d9395168d..4cf38428d8 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -537,7 +537,7 @@ set_entry_point (void)
   /* Entry point name for arbitrary subsystem numbers.  */
   static const char default_entry[] = "mainCRTStartup";
 
-  if (bfd_link_pic (&link_info) || dll)
+  if (bfd_link_dll (&link_info) || dll)
     {
       entry = "DllMainCRTStartup";
     }
-- 
2.25.4



More information about the Binutils mailing list