@@ -306,6 +306,19 @@ APE binaries use the System V ABI, as defined by:
306
306
307
307
There are however a few changes we've had to make.
308
308
309
+ ### No Red Zone
310
+
311
+ Actually Portable Executables that have Windows and/or bare metal in
312
+ their support vector MUST be compiled using ` -mno-red-zone ` . This is
313
+ because, on Windows, DLLs and other software lurking in the va-space
314
+ might use tricks like SetThreadContext() to take control of a thread
315
+ whereas on bare metal, it's also generally accepted that kernel-mode
316
+ code cannot assume a red zone either due to hardware interrutps that
317
+ pull the exact same kinds of stunts.
318
+
319
+ APE software that only has truly System V ABI conformant OSes (e.g.
320
+ Linux) in their support vector MAY use the red zone optimization.
321
+
309
322
### Thread Local Storage
310
323
311
324
#### aarch64
@@ -668,6 +681,11 @@ converged on a strong consensus of having a page size that's 4096 bytes.
668
681
However this convention was never guaranteed. New computers have become
669
682
extremely popular, such as Apple Silicon, that use a 16kb page size.
670
683
684
+ By convention, Cosmopolitan Libc currently generates ELF headers for
685
+ x86-64 that are strictly aligned on a 4096-byte page size. On ARM64
686
+ Cosmopolitan is currently implemented to always generate ELF headers
687
+ aligned on a 16kb page size.
688
+
671
689
In addition to being page size agnostic, APE software that cares about
672
690
working correctly on Windows needs to be aware of the concept of
673
691
allocation granularity. While the page size on Windows is generally 4kb
0 commit comments