Cygwin Runtime
Project
Cygwin may refer both to:
Cygwin runtime (
cygwin1.dll
), required foraarch64-pc-cygwin
GNU toolchain, available at https://www.cygwin.com/git.html, which provides the necessary POSIX APIs and the standard library implementations for building and running POSIX-based software on Windows,or the whole distribution of POSIX-based software (https://www.cygwin.com/packages.html) compiled to run on Windows available at https://cygwin.com/packaging/repos.html.
This project’s scope is limited to Cygwin runtime (
cygwin1.dll
) only. Porting of individual Cygwin packages hasn’t started yet as theaarch64-pc-cygwin
GNU toolchain and the runtime are not available upstream and it would deserve separate project pages for individual packages or some reasonable groups of packages.The Cygwin runtime source code consists for two main sub-projects,
newlib
andwinsup
:The
newlib
sub-project contains implementation of standard C library (libc
), and implementation of standard C mathematical library implementation (libm
).The
winsup
project is where the most of the magic of POSIX APIs and Cygwin environment implementations happen.Fun fact: The
newlib
is a least 26 years old fork of GCC codebase (that far the git history goes) being occasionally synchronized to the upstream.
Risks
Windows on Arm64 require binaries to use https://learn.microsoft.com/en-us/cpp/build/reference/highentropyva-support-64-bit-aslr?view=msvc-170 and https://learn.microsoft.com/en-us/cpp/build/reference/dynamicbase?view=msvc-170 which is known to be poorly implemented in Cygwin (e.g., https://cygwin.com/pipermail/cygwin/2021-February/247922.html).
Porting POSIX
fork
implementation will be the biggest challenge as it requires address space and stack manipulation and is affected by the high-entropy ASLR and dynamic base issues as well.
Status
Experiment attempting to build
aarch64-pc-cygwin
GNU toolchain and thecygwin1.dll
runtime capable of building functionalHello World!
executable has been conducted within https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/pull/123, the insights gained during that experiment has been documented at https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/issues/183.
Next Steps
The
Hello World!
experiment did lot of hacks, like commenting out the code that is not needed to run the binary, that needs to be implemented in a way that would be acceptable for upstreaming.Then, the next target should be compilation of
bash.exe
executable. It might show up that this goal si too stretched and some less ambitious target should be chosen instead.