Check for just mainCRTStartup when targeting AMD64 PE
authorRobert Pengelly <robertapengelly@hotmail.com>
Sat, 20 Jun 2026 18:19:29 +0000 (19:19 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Sat, 20 Jun 2026 18:19:29 +0000 (19:19 +0100)
link.c

diff --git a/link.c b/link.c
index 31eab401d7801ff571b929dcc27d73395156d45a..e6ae99114c0524c0a7667515bfe196f918c0dd5c 100644 (file)
--- a/link.c
+++ b/link.c
@@ -970,7 +970,18 @@ static void calculate_entry_point (void) {
             
             }
         
-        } else if (state->format == LD_FORMAT_I386_PE || state->format == LD_FORMAT_AMD64_PE) {
+        } else if (state->format == LD_FORMAT_AMD64_PE) {
+        
+            state->entry_symbol_name = xstrdup ("mainCRTStartup");
+            
+            if ((symbol = symbol_find (state->entry_symbol_name))) {
+            
+                state->entry_point = symbol_get_value_no_base (symbol);
+                return;
+            
+            }
+        
+        } else if (state->format == LD_FORMAT_I386_PE) {
         
             state->entry_symbol_name = xstrdup ("_mainCRTStartup");