From 307f2595ddeebff38f95045b25be937e6b72eff2 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Tue, 22 Sep 2020 12:48:04 +0100 Subject: Linker: If the type is pie the results should be an executable which entry point should be an executable entry point, not a DLL one. * emultempl/pe.em (set_entry_point): Only use the DLL entry point for DLLs. * emultempl/pep.em (set_entry_point): Likewise. --- ld/ChangeLog | 6 ++++++ ld/emultempl/pe.em | 2 +- ld/emultempl/pep.em | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index cffb271..dfa58a9 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2020-09-22 Frediano Ziglio + + * emultempl/pe.em (set_entry_point): Only use the DLL entry point + for DLLs. + * emultempl/pep.em (set_entry_point): Likewise. + 2020-09-16 Mikael Pettersson * testsuite/ld-elf/shared.exp: Add -Av9 to AFLAGS_PIE on sparc. diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 055d08d..22993c5 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 f161cce..b0a0471 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"; } -- cgit v1.1