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 git repositories for Cygwin packaging.
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 /HIGHENTROPYVA (Support 64-Bit ASLR) and /DYNAMICBASE which is known to be poorly implemented in Cygwin (e.g., cygwin + binutils 2.36 + ASLR/dynamicbase defaults).
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 WIP: Add `aarch64-pc-cygwin` target to `advanced.yml` by Blackhex · Pull Request #123 · Windows-on-ARM-Experiments/mingw-woarm64-build, the insights gained during that experiment has been documented at Cygwin toolchain port capable of building functional "Hello World!" executable · Issue #183 · Windows-on-ARM-Experiments/mingw-woarm64-build.
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.