Make progress towards aarch64 build

This commit is contained in:
Justine Tunney 2023-05-01 19:43:59 -07:00
parent 08ff26c817
commit ca2860947f
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
15428 changed files with 25694 additions and 23138 deletions

View file

@ -47,17 +47,17 @@
#define USE_SYMBOL_HACK 1
.section .text,"ax",@progbits
.align __SIZEOF_POINTER__
.balign __SIZEOF_POINTER__
.previous
.section .rodata,"a",@progbits
.align __SIZEOF_POINTER__
.balign __SIZEOF_POINTER__
__ro: .endobj __ro,globl,hidden # for gdb readability
.previous
.section .data,"aw",@progbits
.align __SIZEOF_POINTER__
.balign __SIZEOF_POINTER__
.previous
.section .bss,"aw",@nobits
.align __SIZEOF_POINTER__
.balign __SIZEOF_POINTER__
.previous
.section .rodata.str1.1,"a",@progbits
cstr: .endobj cstr,globl,hidden # for gdb readability
@ -179,7 +179,7 @@ ape_mz:
.byte 1 # 6: elf v1.o
.byte ELFOSABI_FREEBSD # 7: FreeBSD
.byte 0 # 8: os/abi ver.
.align 8,0 # 9: padding
.balign 8,0 # 9: padding
.short ET_EXEC # 10: εxεcµταblε
.short EM_NEXGEN32E # 12: NexGen32e
.long 1 # 14: elf v1.o
@ -780,11 +780,11 @@ emush: .ascii "\n@\n#'\"\n"
.endobj emush
#ifdef APE_LOADER
.section .ape.loader,"a",@progbits
.align 64
.balign 64
ape_loader:
.incbin APE_LOADER
.endobj ape_loader,globl
.align 64
.balign 64
ape_loader_end:
nop
.endobj ape_loader_end,globl
@ -858,7 +858,7 @@ openbsd.ident:
.long 4f-3f
.long 1
1: .asciz "OpenBSD"
2: .align 4
2: .balign 4
3: .long 0
4: .size openbsd.ident,.-openbsd.ident
.type openbsd.ident,@object
@ -872,7 +872,7 @@ netbsd.ident:
.long 4f-3f
.long 1
1: .asciz "NetBSD"
2: .align 4
2: .balign 4
3: .long 901000000
4: .size netbsd.ident,.-netbsd.ident
.type netbsd.ident,@object
@ -912,7 +912,7 @@ netbsd.ident:
#if SupportsXnu()
.section .macho,"a",@progbits
.align __SIZEOF_POINTER__
.balign __SIZEOF_POINTER__
ape_macho:
.long 0xFEEDFACE+1
@ -1095,7 +1095,7 @@ PEIMPS = 0b11000000000000000000000001000000
#if SupportsWindows() || SupportsMetal()
.section .pe.header,"a",@progbits
.align __SIZEOF_POINTER__
.balign __SIZEOF_POINTER__
ape_pe: .ascin "PE",4
.short kNtImageFileMachineNexgen32e
.stub ape_pe_shnum,short # NumberOfSections
@ -1198,7 +1198,7 @@ ape_idata_idtend:
.previous
.section .piro.data.sort.metal_gdt,"aw",@progbits
.align 8
.balign 8
_gdt:
// G:granularity (1 limit *= 0x1000)
// D/B:default operation size (0 = 16|64bit, 1 = 32-bit)
@ -1289,7 +1289,7 @@ sconf: .short 1843200/*hz*/ / 16/*wut*/ / 9600/*baud*/
.endobj sconf,global,hidden
// Global Descriptor Table
.align 8
.balign 8
_gdtrlo:
.short 2f-_gdtlo-1 # table byte length
.long REAL(_gdtlo) # table address (base memory space)
@ -1298,7 +1298,7 @@ _gdtr:
.short _gdt_end-_gdt-1 # table byte length
.quad _gdt # table address (final virtual space)
.endobj _gdtr,global,hidden
.align 8
.balign 8
// Partial GDT with descriptors for switching to unreal mode or long mode.
_gdtlo = .-GDT_LEGACY_DATA
.quad 0b0000000011001111100100100000000000000000000000001111111111111111 #32
@ -1715,7 +1715,7 @@ long: movabs $BANE+PHYSICAL(0f),%rax
#define GRUB_CHECKSUM(FLAGS) (-(GRUB_MAGIC + (FLAGS)) & 0xffffffff)
// Grub Header.
.align 4
.balign 4
ape_grub:
.long GRUB_MAGIC # Magic
.long GRUB_AOUT # Flags
@ -1730,7 +1730,7 @@ ape_grub:
// Grub Entrypoint.
// Takes CPU out of legacy mode and jumps to normal entrypoint.
// @noreturn
.align 4
.balign 4
ape_grub_entry:
.code32
// cmp $GRUB_EAX,%eax
@ -1874,7 +1874,7 @@ ape_pad_text:
.type ape_pad_privileged,@object
.hidden ape_pad_privileged
ape_pad_privileged:
.align 4096
.balign 4096
.previous
.section .ape.pad.rodata,"a",@progbits

View file

@ -32,6 +32,7 @@
// @see ape/ape.lds
// @see winimp
.macro .imp dll:req fn:req actual:req hint
#ifdef __x86_64__
.dll "\dll"
.section ".piro.data.sort.iat.2.\dll\().2.\actual","aw",@progbits
.type \fn,@object
@ -49,18 +50,28 @@
.previous
.section ".idata.ro.hnt.\dll\().2.\actual","a",@progbits
"\dll\().\actual":
.ifnb \hint # hint i.e. guess function ordinal
.ifnb \hint // hint i.e. guess function ordinal
.short \hint
.else
.short 0
.endif
.asciz "\actual"
.align 2 # documented requirement
.align 2 // documented requirement
.globl "\dll\().\actual"
.hidden "\dll\().\actual"
.type "\dll\().\actual",@object
.size "\dll\().\actual",.-"\dll\().\actual"
.previous
#else
.section ".text.nt.\actual","ax",@progbits
.globl "\actual"
"\actual":
ret
.section ".data.nt.\actual","aw",@progbits
.globl "\fn"
.balign 8
"\fn": .quad "\actual"
#endif
.endm
// Defines DLL import.
@ -68,11 +79,11 @@
.macro .dll name:req
.section ".idata.ro.idt.2.\name","aG",@progbits,"\name",comdat
.equ ".Lidata.idt.\name",.
.long RVA("idata.ilt.\name") # ImportLookupTable
.long 0 # TimeDateStamp
.long 0 # ForwarderChain
.long RVA(".Lidata.str.\name") # DllNameRva
.long RVA("idata.iat.\name") # ImportAddressTable
.long RVA("idata.ilt.\name") // ImportLookupTable
.long 0 // TimeDateStamp
.long 0 // ForwarderChain
.long RVA(".Lidata.str.\name") // DllNameRva
.long RVA("idata.iat.\name") // ImportAddressTable
.type ".Lidata.idt.\name",@object
.size ".Lidata.idt.\name",.-".Lidata.idt.\name"
.previous

View file

@ -25,7 +25,7 @@
// APE Loader Executable Structure
// Linux, FreeBSD, NetBSD, OpenBSD
.align 8
.balign 8
ehdr: .ascii "\177ELF"
.byte ELFCLASS64
.byte ELFDATA2LSB
@ -47,7 +47,7 @@ ehdr: .ascii "\177ELF"
.word 0 # e_shstrndx
.endobj ehdr,globl
.align 8
.balign 8
phdrs: .long PT_LOAD # p_type
.long PF_R|PF_X # p_flags
.quad 0 # p_offset
@ -89,18 +89,18 @@ note: .long 2f-1f
.long 4f-3f
.long 1
1: .asciz "OpenBSD"
2: .align 4
2: .balign 4
3: .long 0
4: .long 2f-1f
.long 4f-3f
.long 1
1: .asciz "NetBSD"
2: .align 4
2: .balign 4
3: .long 901000000
4: .endobj note
notesize = . - note
.align 64,0 # for ape.S dd
.balign 64,0 # for ape.S dd
.org 0x180 # for ape.S dd
// APE Loader XNU Header
@ -197,7 +197,7 @@ macho: .long 0xFEEDFACE+1
60:
.endobj macho
.align 64,0 # for ape.S dd
.balign 64,0 # for ape.S dd
.org 0x400 # for ape.S dd
// Ape Loader Entrpoint

View file

@ -23,7 +23,7 @@
// APE Loader Executable Structure for XNU
.align 4096
.balign 4096
macho: .long 0xFEEDFACE+1
.long MAC_CPU_NEXGEN32E
.long MAC_CPU_NEXGEN32E_ALL
@ -112,7 +112,7 @@ macho: .long 0xFEEDFACE+1
60:
.endobj macho,globl
.align 64
.balign 64
_start:
// Hack for detecting M1 Rosetta environment.