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

commit a49b5ae3e4a612308f5cf8c14621ddf8e72a4cfe
Author:     Thirumalai Nagalingam <[email protected]>
AuthorDate: Thu Feb 19 22:26:35 2026 +0530
Commit:     Corinna Vinschen <[email protected]>
CommitDate: Wed Mar 11 15:41:32 2026 +0100

    Cygwin: gendef: restore support for arch-specific cygwin.din files
    
    This change adds support for architecture-specific cygwin.din fragments
    to allow exported symbols to vary by target CPU.
    
    This mechanism existed prior to commit 3ba050dfcd1d
    ("Cygwin: fold common.din and x86_64.din into cygwin.din"), which merged
    all exports into a single file when only x86 and x86_64 targets were
    supported.
    
    With the introduction of on-going AArch64 suport, architecture-specific
    export control is again required. The common cygwin.din remains in the
    parent directory, while per-architecture files are placed under the
    respective arch sub-directories.
    
    The build system is updated to detect and include an optional
    architecture-specific cygwin.din file when generating the .def file.
    Makefile.am now defines an ARCH_DIN path based on the target CPU and
    passes it to scripts/gendef prior to the common cygwin.din. This ensures
    architecture-specific directives, such as the LIBRARY base address or
    arch-specific exports, are applied correctly while preserving the common
    export definitions.
    
    Signed-off-by: Thirumalai Nagalingam 
<[email protected]>

Diff:
---
 winsup/cygwin/Makefile.am        | 8 ++++++--
 winsup/cygwin/aarch64/cygwin.din | 6 ++++++
 winsup/cygwin/cygwin.din         | 3 ---
 winsup/cygwin/x86_64/cygwin.din  | 6 ++++++
 4 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am
index 5f5fdc5ab0e2..06ae3b7dec0b 100644
--- a/winsup/cygwin/Makefile.am
+++ b/winsup/cygwin/Makefile.am
@@ -636,8 +636,12 @@ $(NEW_DLL_NAME): $(LDSCRIPT) libdll.a $(VERSION_OFILES) 
$(LIBSERVER)\
 # cygwin import library
 toolopts=--cpu=@target_cpu@ --ar=@AR@ --as=@AS@ --nm=@NM@ --objcopy=@OBJCOPY@
 
-$(DEF_FILE): scripts/gendef cygwin.din
-       $(AM_V_GEN)$(srcdir)/scripts/gendef --cpu=@target_cpu@ 
--output-def=$(DEF_FILE) $(srcdir)/cygwin.din
+# Architecture-specific .din files
+ARCH_DIN = $(srcdir)/@target_cpu@/cygwin.din
+
+$(DEF_FILE): scripts/gendef cygwin.din $(wildcard $(ARCH_DIN))
+       $(AM_V_GEN)$(srcdir)/scripts/gendef --cpu=@target_cpu@ 
--output-def=$(DEF_FILE) \
+         $(wildcard $(ARCH_DIN)) $(srcdir)/cygwin.din
 
 sigfe.s: $(DEF_FILE) tlsoffsets
        @[ -s $@ ] || \
diff --git a/winsup/cygwin/aarch64/cygwin.din b/winsup/cygwin/aarch64/cygwin.din
new file mode 100644
index 000000000000..67ed5ffcc52a
--- /dev/null
+++ b/winsup/cygwin/aarch64/cygwin.din
@@ -0,0 +1,6 @@
+# aarch64-specific exports
+# These symbols are available on AArch64 architecture
+
+LIBRARY "cygwin1.dll" BASE=0x180040000
+
+EXPORTS
diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din
index cd71da274659..c3518f4804a7 100644
--- a/winsup/cygwin/cygwin.din
+++ b/winsup/cygwin/cygwin.din
@@ -1,6 +1,3 @@
-LIBRARY "cygwin1.dll" BASE=0x180040000
-
-EXPORTS
 # Exported variables
 __argc DATA
 __argv DATA
diff --git a/winsup/cygwin/x86_64/cygwin.din b/winsup/cygwin/x86_64/cygwin.din
new file mode 100644
index 000000000000..12a49b009682
--- /dev/null
+++ b/winsup/cygwin/x86_64/cygwin.din
@@ -0,0 +1,6 @@
+# x86_64-specific exports
+# These symbols are available on x64 architecture
+
+LIBRARY "cygwin1.dll" BASE=0x180040000
+
+EXPORTS

Reply via email to