[newlib-cygwin/main] Cygwin: Drop _pei386_runtime_relocator stub on aarch64

Jon Turney jturney@sourceware.org
Sun Nov 8 13:10:38 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1f1b48abebc6107f8b7d00104d504e16c6bd052b

commit 1f1b48abebc6107f8b7d00104d504e16c6bd052b
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Tue Jun 2 15:54:05 2026 +0100

    Cygwin: Drop _pei386_runtime_relocator stub on aarch64
    
    On aarch64, don't emit a stub _pei386_runtime_relocator into the
    libcygwin.a import library, purely for satisfying a reference which ld
    no longer makes.

Diff:
---
 winsup/cygwin/Makefile.am                |  6 +++++-
 winsup/cygwin/lib/_cygwin_crt0_common.cc | 19 ++++++++++++++-----
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am
index 22b7b14bd..ba281779b 100644
--- a/winsup/cygwin/Makefile.am
+++ b/winsup/cygwin/Makefile.am
@@ -83,9 +83,13 @@ LIB_FILES= \
 	lib/premain1.c \
 	lib/premain2.c \
 	lib/premain3.c \
-	lib/pseudo-reloc-dummy.c \
 	lib/pthreadconst.S
 
+if TARGET_X86_64
+LIB_FILES+= \
+	lib/pseudo-reloc-dummy.c
+endif
+
 FHANDLER_FILES= \
 	fhandler/base.cc \
 	fhandler/clipboard.cc \
diff --git a/winsup/cygwin/lib/_cygwin_crt0_common.cc b/winsup/cygwin/lib/_cygwin_crt0_common.cc
index a22528ab4..30c1e2912 100644
--- a/winsup/cygwin/lib/_cygwin_crt0_common.cc
+++ b/winsup/cygwin/lib/_cygwin_crt0_common.cc
@@ -221,12 +221,21 @@ _cygwin_crt0_common (MainFunc f, per_process *u)
   u->pseudo_reloc_start = &__RUNTIME_PSEUDO_RELOC_LIST__;
   u->pseudo_reloc_end = &__RUNTIME_PSEUDO_RELOC_LIST_END__;
   u->image_base = &_image_base__;
-  /* This is actually a dummy call to force the linker to load this
-     symbol for older apps which need it. Unfortunately, ld for x86_64
-     still emits this symbol when linking against static libs which
-     require pseudo relocation, so we can't drop this call and the
-     dummy function just yet. */
+  /* This is actually a dummy call to force the linker to add this symbol to the
+     cygwin import lib, for the benefit of apps which need it.
+
+     Unfortunately, ld emits a reference to this symbol for PE/PE+ targets
+     whenever linking against static libs which require pseudo-relocation (even
+     though it's unncessary for v2 pseudo-reloc, which has always been available
+     for those targets), so we can't drop this call and the dummy function just
+     yet.
+
+     Linking for aarch64 targets is assumed to be using a more recent or patched
+     ld, which no longer emits that reference.
+  */
+#ifdef __x86_64__
   _pei386_runtime_relocator (NULL);
+#endif
   return 1;
 }
 } /* "C" */


More information about the Cygwin-cvs mailing list