Introduce native support for MacOS ARM64

There's a new program named ape/ape-m1.c which will be used to build an
embeddable binary that can load ape and elf executables. The support is
mostly working so far, but still chasing down ABI issues.
This commit is contained in:
Justine Tunney 2023-05-18 19:05:08 -07:00
parent b852650c08
commit 1422e96b4e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
757 changed files with 2988 additions and 1321 deletions

View file

@ -67,9 +67,6 @@
*/
.initbss 300,_init_systemfive
__hostos:
.quad 0
.endobj __hostos,globl,hidden
// Performs System Five System Call.
//
@ -268,7 +265,7 @@ systemfive_xnu:
push %rbx
push %rsi
// Detect the operating system.
mov (%rdi),%eax # __hostos
mov __hostos(%rip),%eax
#if SupportsWindows() || SupportsXnu() || SupportsFreebsd()
// set by libc/ape.S for XNU
// set by libc/crt/crt.S for XNU/FreeBSD
@ -296,7 +293,7 @@ systemfive_xnu:
#endif
mov $_HOSTLINUX,%al
_init_systemfive_detected:
stosq # __hostos
mov %eax,__hostos(%rip)
bsr %eax,%eax
mov $_init_systemfive_jmptab,%ebx
movzbl (%rbx,%rax),%eax
@ -452,80 +449,6 @@ _init_systemfive_done:
nop
.init.end 300,_init_systemfive,globl,hidden
// Sections for varint encoded magic numbers.
//
// These sections are all ordered by (group_name, constant_name).
// They're populated by modules simply referencing the symbols.
//
// @see libc/sysv/consts.sh
// @see libc/sysv/consts/syscon_h
.section .piro.bss.sort.syscon.1,"aw",@nobits
.balign 8
syscon_start:/*
...decentralized quadwords...
*/.previous
.section .piro.bss.sort.syscon.3,"aw",@nobits
syscon_end:
.previous
.type syscon_start,@object
.type syscon_end,@object
.globl syscon_start
.globl syscon_end
#if SupportsLinux() || SupportsMetal()
.section .sort.rodata.syscon.linux.1,"a",@progbits
.balign 1
syscon_linux:/*
...decentralized leb128...
*/.previous
.type syscon_linux,@object
.globl syscon_linux
#endif
#if SupportsXnu()
.section .sort.rodata.syscon.xnu.1,"a",@progbits
.balign 1
syscon_xnu:/*
...decentralized leb128...
*/.previous
.type syscon_xnu,@object
.globl syscon_xnu
#endif
#if SupportsFreebsd()
.section .sort.rodata.syscon.freebsd.1,"a",@progbits
.balign 1
syscon_freebsd:/*
...decentralized leb128...
*/.previous
.type syscon_freebsd,@object
.globl syscon_freebsd
#endif
#if SupportsOpenbsd()
.section .sort.rodata.syscon.openbsd.1,"a",@progbits
.balign 1
syscon_openbsd:/*
...decentralized leb128...
*/.previous
.type syscon_openbsd,@object
.globl syscon_openbsd
#endif
#if SupportsNetbsd()
.section .sort.rodata.syscon.netbsd.1,"a",@progbits
.balign 1
syscon_netbsd:/*
...decentralized leb128...
*/.previous
.type syscon_netbsd,@object
.globl syscon_netbsd
#endif
#if SupportsWindows()
.section .sort.rodata.syscon.windows.1,"a",@progbits
.balign 1
syscon_windows:/*
...decentralized leb128...
*/.previous
.type syscon_windows,@object
.globl syscon_windows
#endif
#ifdef SYSDEBUG
.rodata.str1.1
.Llog: .ascii STRACE_PROLOGUE