mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-14 06:59:10 +00:00
Fully support OpenBSD 7.3
This change (1) upgrades to OpenBSD's newer kernel ABIs, and (2) modifies APE to have a read-only data segment. Doing this required creating APE Loader v1.1, which is backwards and forwards compatible with the previous version. If you've run the following commands in the past to install your APE Loader systemwide, then you need to run them again. Ad-hoc installations shouldn't be impacted. It's also recommended that APE binaries be remade after upgrading, since they embed old versions of the APE Loader. ape/apeuninstall.sh ape/apeinstall.sh This change does more than just fix OpenBSD. The new loader is smarter and more reliable. We're now able create much tinier ELF and Mach-O data structures than we could before. Both APE Loader and execvpe() will now normalize ambiguous argv[0] resolution the same way as the UNIX shell. Badness with TLS linkage has been solved. Fixes #826
This commit is contained in:
parent
963e10b9bf
commit
40eb3b9d5d
48 changed files with 772 additions and 903 deletions
|
@ -22,6 +22,16 @@
|
|||
#include "libc/runtime/internal.h"
|
||||
.section .start,"ax",@progbits
|
||||
|
||||
#if SupportsXnu() && defined(__x86_64__)
|
||||
// XNU AMD64 Entrypoint
|
||||
//
|
||||
// @note Rosetta barely implements MAC_LC_UNIXTHREAD
|
||||
// @note Rosetta sets many registers to weird values
|
||||
_apple: mov $_HOSTXNU,%cl
|
||||
jmp 1f
|
||||
.endfn _apple,weak,hidden
|
||||
#endif
|
||||
|
||||
// System Five userspace program entrypoint.
|
||||
//
|
||||
// @param rsp is [n,argv₀..argvₙ₋₁,0,envp₀..,0,auxv₀..,0,..]
|
||||
|
@ -32,18 +42,6 @@
|
|||
_start:
|
||||
#ifdef __x86_64__
|
||||
|
||||
#if SupportsXnu()
|
||||
// Hack for detecting M1 Rosetta environment.
|
||||
// https://github.com/jart/cosmopolitan/issues/429#issuecomment-1166704377
|
||||
cmp $-1,%ebx
|
||||
jne 0f
|
||||
cmp $+1,%edx
|
||||
jne 0f
|
||||
mov $_HOSTXNU,%cl
|
||||
xor %edi,%edi
|
||||
0:
|
||||
#endif
|
||||
|
||||
#if SupportsFreebsd()
|
||||
// detect free besiyata dishmaya
|
||||
test %rdi,%rdi
|
||||
|
@ -54,7 +52,7 @@ _start:
|
|||
#endif
|
||||
|
||||
// set operating system when already detected
|
||||
mov %cl,__hostos(%rip)
|
||||
1: mov %cl,__hostos(%rip)
|
||||
|
||||
// get startup timestamp as early as possible
|
||||
// its used by --strace flag and kprintf() %T
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue