mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-24 19:40:28 +00:00
Improve dead code elimination
This commit is contained in:
parent
760db8c5ad
commit
0e36cb3ac4
6606 changed files with 9685 additions and 9854 deletions
76
ape/ape.S
76
ape/ape.S
|
@ -47,9 +47,6 @@
|
|||
|
||||
#define USE_SYMBOL_HACK 0
|
||||
|
||||
.source "NOTICE"
|
||||
.source "ape/ape.S"
|
||||
.source "ape/ape.lds"
|
||||
.section .text,"ax",@progbits
|
||||
.align __SIZEOF_POINTER__
|
||||
.previous
|
||||
|
@ -108,6 +105,8 @@ rlstr: .endobj rlstr,globl,hidden # ←for gdb readibility
|
|||
│ αcτµαlly pδrταblε εxεcµταblε § the old technology │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
|
||||
#if SupportsWindows() || SupportsXnu()
|
||||
|
||||
/ MZ Literally Executable Header
|
||||
/
|
||||
/ This is the beginning of the program file and it can serve as an
|
||||
|
@ -116,7 +115,7 @@ rlstr: .endobj rlstr,globl,hidden # ←for gdb readibility
|
|||
/ a machine, this header may need to morph itself to say the magic
|
||||
/ words, e.g. ⌂ELF, which also works fine as a generic entrypoint.
|
||||
/
|
||||
/ @see www.delorie.com/djgpp/doc/exe/
|
||||
/ @param dl is drive number
|
||||
/ @noreturn
|
||||
ape.mz: .ascii "MZ" # Mark 'Zibo' Joseph Zbikowski
|
||||
jno 2f # MZ: bytes on last page
|
||||
|
@ -136,10 +135,48 @@ ape.mz: .ascii "MZ" # Mark 'Zibo' Joseph Zbikowski
|
|||
.ascii "JT" # MZ: OEM identifier
|
||||
.short 0 # MZ: OEM information
|
||||
.org 0x40-4 # MZ: bytes reserved for you
|
||||
#if SupportsWindows()
|
||||
.long RVA(ape.pe) # PE: the new technology
|
||||
#else
|
||||
.long 0
|
||||
#endif
|
||||
.endfn ape.mz,globl,hidden
|
||||
|
||||
#else /* !(SupportsWindows() || SupportsXnu()) */
|
||||
|
||||
/ ELF Literally Executable Header
|
||||
/
|
||||
/ If we don't need to support Microsoft or Apple then we can
|
||||
/ produce a conventional executable without the shell script
|
||||
/
|
||||
/ @param dl is drive number
|
||||
/ @noreturn
|
||||
.ascii "\177ELF" # 0x0: ⌂ELF
|
||||
.byte ELFCLASS64 # 4: long mode
|
||||
.byte ELFDATA2LSB # 5: little endian
|
||||
.byte 1 # 6: elf v1.o
|
||||
.byte ELFOSABI_FREEBSD # 7: FreeBSD
|
||||
.byte 0 # 8: os/abi ver.
|
||||
.align 8,0 # 9: padding
|
||||
.short ET_EXEC # 10: εxεcµταblε
|
||||
.short EM_NEXGEN32E # 12: NexGen32e
|
||||
.long 1 # 14: elf v1.o
|
||||
.quad .Lape.elf.entry # 18: e_entry
|
||||
.quad .Lape.elf.phoff # 20: e_phoff
|
||||
.quad .Lape.elf.shoff # 28: e_shoff
|
||||
.long 0 # 30: e_flags
|
||||
.short 64 # 34: e_ehsize
|
||||
.short 56 # 36: e_phentsize
|
||||
.short .Lape.elf.phnum # 38: e_phnum
|
||||
.short 0 # 3a: e_shentsize
|
||||
.short .Lape.elf.shnum # 3c: e_shnum
|
||||
.short .Lape.elf.shstrndx # 3e: e_shstrndx
|
||||
|
||||
#endif /* SupportsWindows() || SupportsXnu() */
|
||||
|
||||
/ Disk Operating System Stub
|
||||
/
|
||||
/ @param dl is drive number
|
||||
/ @noreturn
|
||||
.org 0x40 # mz/elf header length
|
||||
stub: mov $0x40,%dl # *literally* dos
|
||||
|
@ -187,6 +224,7 @@ pc: cld
|
|||
xor %cx,%cx
|
||||
mov %cx,%es
|
||||
rlstack %di,%cx
|
||||
#if SupportsMetal()
|
||||
push %cs # memcpy() [relocate this page]
|
||||
pop %ds
|
||||
call 1f
|
||||
|
@ -391,6 +429,8 @@ ape_disk:
|
|||
.short BOOTSIG
|
||||
.endobj ape_disk
|
||||
|
||||
#endif /* SupportsMetal() */
|
||||
|
||||
/* ▄▄▄
|
||||
▄▄▄ ▀▓▓▒▄
|
||||
▄▓▒▒░ ▀▓▒▒▒▄
|
||||
|
@ -432,8 +472,10 @@ ape_disk:
|
|||
╚────────────────────────────────────────────────────────────────────────────│─╝
|
||||
the bourne executable & linkable format */
|
||||
|
||||
#if SupportsWindows() || SupportsXnu()
|
||||
apesh: .ascii "'\n#'\"\n" # sixth edition shebang
|
||||
.ascii "o=\"$(command -v \"$0\")\"\n"
|
||||
#if SupportsXnu()
|
||||
.ascii "if [ -d /Applications ]; then\n"
|
||||
.ascii "dd if=\"$o\""
|
||||
.ascii " of=\"$o\""
|
||||
|
@ -443,7 +485,9 @@ apesh: .ascii "'\n#'\"\n" # sixth edition shebang
|
|||
.ascii "\" count=\""
|
||||
.shstub .Lape.macho.dd.count,2
|
||||
.ascii "\" conv=notrunc 2>/dev/null\n"
|
||||
.ascii "elif exec 7<> \"$o\"; then\n"
|
||||
.ascii "el"
|
||||
#endif
|
||||
.ascii "if exec 7<> \"$o\"; then\n"
|
||||
.ascii "printf '"
|
||||
.ascii "\\177ELF" # 0x0: ⌂ELF
|
||||
.ascii "\\2" # 4: long mode
|
||||
|
@ -483,6 +527,7 @@ apesh: .ascii "'\n#'\"\n" # sixth edition shebang
|
|||
.ascii "fi\n"
|
||||
.ascii "exit $R\n"
|
||||
.endobj apesh
|
||||
#endif /* SupportsWindows() || SupportsXnu() */
|
||||
|
||||
.section .elf.phdrs,"a",@progbits
|
||||
.align __SIZEOF_POINTER__
|
||||
|
@ -506,6 +551,7 @@ ape.phdrs:
|
|||
.stub .Lape.ram.filesz,quad
|
||||
.stub .Lape.ram.memsz,quad
|
||||
.stub .Lape.ram.align,quad
|
||||
#if SupportsLinux()
|
||||
/ Linux ignores mprotect() and returns 0 without this lool
|
||||
/ It has nothing to do with the stack, which is still exec
|
||||
.align __SIZEOF_POINTER__
|
||||
|
@ -517,6 +563,8 @@ ape.phdrs:
|
|||
.quad 0 # p_filesz
|
||||
.quad 0 # p_memsz
|
||||
.quad 16 # p_align
|
||||
#endif
|
||||
#if SupportsOpenbsd() || SupportsNetbsd()
|
||||
.align __SIZEOF_POINTER__
|
||||
.long PT_NOTE # notes
|
||||
.long PF_R
|
||||
|
@ -526,8 +574,10 @@ ape.phdrs:
|
|||
.stub .Lape.note.filesz,quad
|
||||
.stub .Lape.note.memsz,quad
|
||||
.stub .Lape.note.align,quad
|
||||
#endif
|
||||
.previous
|
||||
|
||||
#if SupportsOpenbsd()
|
||||
.section .note.openbsd.ident,"a",@progbits
|
||||
.Lopenbsd.ident:
|
||||
.long 2f-1f
|
||||
|
@ -539,7 +589,9 @@ ape.phdrs:
|
|||
4: .size .Lopenbsd.ident,.-.Lopenbsd.ident
|
||||
.type .Lopenbsd.ident,@object
|
||||
.previous
|
||||
#endif /* SupportsOpenbsd() */
|
||||
|
||||
#if SupportsNetbsd()
|
||||
.section .note.netbsd.ident,"a",@progbits
|
||||
.Lnetbsd.ident:
|
||||
.long 2f-1f
|
||||
|
@ -551,6 +603,7 @@ ape.phdrs:
|
|||
4: .size .Lnetbsd.ident,.-.Lnetbsd.ident
|
||||
.type .Lnetbsd.ident,@object
|
||||
.previous
|
||||
#endif /* SupportsNetbsd() */
|
||||
|
||||
/* ▄▄███▄
|
||||
▄▄████████▄
|
||||
|
@ -583,6 +636,7 @@ ape.phdrs:
|
|||
@see System V Application Binary Interface NexGen32e Architecture
|
||||
Processor Supplement, Version 1.0, December 5th, 2018 */
|
||||
|
||||
#if SupportsXnu()
|
||||
.section .macho,"a",@progbits
|
||||
.align __SIZEOF_POINTER__
|
||||
|
||||
|
@ -654,8 +708,8 @@ ape.macho:
|
|||
.long 0,0,0 # reserved
|
||||
40: .long MAC_LC_UUID
|
||||
.long 50f-40b
|
||||
.stub uuid1_,quad
|
||||
.stub uuid2_,quad
|
||||
.stub .Lape.uuid1,quad
|
||||
.stub .Lape.uuid2,quad
|
||||
50: .long MAC_LC_UNIXTHREAD
|
||||
.long 60f-50b # cmdsize
|
||||
.long MAC_THREAD_NEXGEN32E # flavaflav
|
||||
|
@ -686,6 +740,7 @@ ape.macho:
|
|||
|
||||
.endobj ape.macho,globl,hidden
|
||||
.previous /* .macho */
|
||||
#endif /* SupportsXnu() */
|
||||
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
|
@ -763,6 +818,8 @@ ape.macho:
|
|||
.LPEDATA = 0b11000000000000000000000011000000
|
||||
.LPEIMPS = 0b11000000000000000000000001000000
|
||||
|
||||
#if SupportsWindows()
|
||||
|
||||
.section .pe.header,"a",@progbits
|
||||
.align __SIZEOF_POINTER__
|
||||
ape.pe: .ascin "PE",4
|
||||
|
@ -849,6 +906,8 @@ ape.pe: .ascin "PE",4
|
|||
.long .LPEDATA # Flags
|
||||
.previous
|
||||
|
||||
#endif /* SupportsWindows() */
|
||||
|
||||
.section .idata.ro.idt.1,"a",@progbits
|
||||
.type idata.idtend,@object
|
||||
.type idata.idt,@object
|
||||
|
@ -878,6 +937,7 @@ idata.iat:
|
|||
idata.iatend:
|
||||
.previous
|
||||
|
||||
#if SupportsMetal()
|
||||
/*─────────────────────────────────────────────────────────────────────────────╗
|
||||
│ αcτµαlly pδrταblε εxεcµταblε § early-stage read-only data │
|
||||
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||
|
@ -1486,6 +1546,8 @@ metal:
|
|||
jmp _start
|
||||
.endfn metal
|
||||
|
||||
#endif /* SupportsMetal() */
|
||||
|
||||
/ Avoid linker script variables appearing as code in objdump.
|
||||
.macro .ldsvar name:req
|
||||
.type \name,@object
|
||||
|
|
119
ape/ape.lds
119
ape/ape.lds
|
@ -176,6 +176,7 @@
|
|||
#ifdef __LINKER__
|
||||
#include "ape/macros.internal.h"
|
||||
#include "ape/config.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/nt/pedef.internal.h"
|
||||
#include "libc/zip.h"
|
||||
|
||||
|
@ -245,7 +246,7 @@ SECTIONS {
|
|||
. += 1;
|
||||
|
||||
KEEP(*(.ape.pad.head))
|
||||
. = ALIGN(4096); /* alignments only mandatory when impossible otherwise */
|
||||
. = ALIGN(SupportsWindows() ? PAGESIZE : 16);
|
||||
HIDDEN(_ehead = .);
|
||||
} AT>SmallCode :Head
|
||||
|
||||
|
@ -345,6 +346,22 @@ SECTIONS {
|
|||
KEEP(*(SORT_BY_NAME(.idata.ro.*)))
|
||||
. += 1;
|
||||
|
||||
. = ALIGN(__SIZEOF_POINTER__);
|
||||
PROVIDE_HIDDEN(__init_array_start = .);
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*)
|
||||
SORT_BY_INIT_PRIORITY(.ctors.*)))
|
||||
KEEP(*(SORT_NONE(.ctors)))
|
||||
KEEP(*(SORT_NONE(.init_array)))
|
||||
KEEP(*(SORT_NONE(.preinit_array)))
|
||||
PROVIDE_HIDDEN(__init_array_end = .);
|
||||
|
||||
. = ALIGN(__SIZEOF_POINTER__);
|
||||
PROVIDE_HIDDEN(__fini_array_start = .);
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY(.fini_array.*)
|
||||
SORT_BY_INIT_PRIORITY(.dtors.*)))
|
||||
KEEP(*(SORT_NONE(.dtors)))
|
||||
PROVIDE_HIDDEN(__fini_array_end = .);
|
||||
|
||||
/* Encoded Data Structures w/ Linear Initialization Order */
|
||||
KEEP(*(.initroprologue))
|
||||
KEEP(*(SORT_BY_NAME(.initro.*)))
|
||||
|
@ -379,24 +396,6 @@ SECTIONS {
|
|||
. = ALIGN(.Lape.piro.align);
|
||||
HIDDEN(__piro_start = .);
|
||||
|
||||
QUAD(IMAGE_BASE_VIRTUAL);
|
||||
|
||||
PROVIDE_HIDDEN(__init_array_start = .);
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*)
|
||||
SORT_BY_INIT_PRIORITY(.ctors.*)))
|
||||
KEEP(*(SORT_NONE(.ctors)))
|
||||
KEEP(*(SORT_NONE(.init_array)))
|
||||
KEEP(*(SORT_NONE(.preinit_array)))
|
||||
PROVIDE_HIDDEN(__init_array_end = .);
|
||||
|
||||
. += 1;
|
||||
. = ALIGN(__SIZEOF_POINTER__);
|
||||
PROVIDE_HIDDEN(__fini_array_start = .);
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY(.fini_array.*)
|
||||
SORT_BY_INIT_PRIORITY(.dtors.*)))
|
||||
KEEP(*(SORT_NONE(.dtors)))
|
||||
PROVIDE_HIDDEN(__fini_array_end = .);
|
||||
|
||||
KEEP(*(SORT_BY_NAME(.piro.relo.sort.*)))
|
||||
PROVIDE_HIDDEN(__relo_end = .);
|
||||
KEEP(*(SORT_BY_NAME(.piro.data.sort.*)))
|
||||
|
@ -481,25 +480,17 @@ PFSTUB8(.Lape.elf.shoff, 0);
|
|||
PFSTUB4(.Lape.elf.phnum, (.Lape.phdrs.end - ape.phdrs) / 56);
|
||||
PFSTUB4(.Lape.elf.shnum, 0);
|
||||
PFSTUB4(.Lape.elf.shstrndx, 0);
|
||||
SHSTUB2(.Lape.macho.dd.skip, RVA(ape.macho) / 8);
|
||||
SHSTUB2(.Lape.macho.dd.count, (.Lape.macho.end - ape.macho) / 8);
|
||||
PFSTUB4(.Lape.pe.offset, ape.pe - ape.mz);
|
||||
|
||||
HIDDEN(__privileged_addr = ROUNDDOWN(__privileged_start, PAGESIZE));
|
||||
HIDDEN(__privileged_size = (ROUNDUP(__privileged_end, PAGESIZE) -
|
||||
ROUNDDOWN(__privileged_start, PAGESIZE)));
|
||||
|
||||
HIDDEN(.Lape.pe.optsz = .Lape.pe.sections - (ape.pe + 24));
|
||||
HIDDEN(.Lape.pe.shnum = (.Lape.pe.sections_end - .Lape.pe.sections) / 40);
|
||||
HIDDEN(.Lidata.idtsize = idata.idtend - idata.idt);
|
||||
HIDDEN(.Lidata.iatsize = idata.iatend - idata.iat);
|
||||
|
||||
HIDDEN(.Lape.rom.offset = 0);
|
||||
HIDDEN(.Lape.rom.vaddr = ADDR(.head));
|
||||
HIDDEN(.Lape.rom.paddr = LOADADDR(.head));
|
||||
HIDDEN(.Lape.rom.filesz = LOADADDR(.data) - .Lape.rom.paddr);
|
||||
HIDDEN(.Lape.rom.memsz = ADDR(.data) - ADDR(.head));
|
||||
HIDDEN(.Lape.rom.align = 0x1000);
|
||||
HIDDEN(.Lape.rom.align = .Lape.data.align);
|
||||
HIDDEN(.Lape.rom.rva = RVA(.Lape.rom.vaddr));
|
||||
|
||||
HIDDEN(.Lape.ram.offset = .Lape.rom.offset + .Lape.rom.filesz);
|
||||
|
@ -507,7 +498,7 @@ HIDDEN(.Lape.ram.vaddr = ADDR(.data));
|
|||
HIDDEN(.Lape.ram.paddr = LOADADDR(.data));
|
||||
HIDDEN(.Lape.ram.filesz = LOADADDR(.bss) - LOADADDR(.data));
|
||||
HIDDEN(.Lape.ram.memsz = ADDR(.bss) + SIZEOF(.bss) - .Lape.ram.vaddr);
|
||||
HIDDEN(.Lape.ram.align = 0x1000);
|
||||
HIDDEN(.Lape.ram.align = .Lape.data.align);
|
||||
HIDDEN(.Lape.ram.rva = RVA(.Lape.ram.vaddr));
|
||||
|
||||
HIDDEN(.Lape.note.offset = .Lape.rom.offset + (.Lape.note - .Lape.rom.vaddr));
|
||||
|
@ -530,7 +521,7 @@ HIDDEN(.Lape.data.paddr = LOADADDR(.data));
|
|||
HIDDEN(.Lape.data.vaddr = ADDR(.data));
|
||||
HIDDEN(.Lape.data.filesz = SIZEOF(.data));
|
||||
HIDDEN(.Lape.data.memsz = SIZEOF(.data));
|
||||
HIDDEN(.Lape.data.align = 0x1000);
|
||||
HIDDEN(.Lape.data.align = .Lape.data.align);
|
||||
HIDDEN(.Lape.data.rva = RVA(.Lape.data.vaddr));
|
||||
|
||||
HIDDEN(.Lape.bss.offset = .Lape.ram.offset + LOADADDR(.bss) - .Lape.ram.paddr);
|
||||
|
@ -540,18 +531,30 @@ HIDDEN(.Lape.bss.filesz = 0);
|
|||
HIDDEN(.Lape.bss.memsz = SIZEOF(.bss));
|
||||
HIDDEN(.Lape.bss.align = .Lape.data.align);
|
||||
|
||||
/* Program Loader Auto-Tune */
|
||||
#if SupportsXnu()
|
||||
SHSTUB2(.Lape.macho.dd.skip, RVA(ape.macho) / 8);
|
||||
SHSTUB2(.Lape.macho.dd.count, (.Lape.macho.end - ape.macho) / 8);
|
||||
#endif
|
||||
|
||||
#if SupportsWindows()
|
||||
PFSTUB4(.Lape.pe.offset, ape.pe - ape.mz);
|
||||
HIDDEN(.Lape.pe.optsz = .Lape.pe.sections - (ape.pe + 24));
|
||||
HIDDEN(.Lape.pe.shnum = (.Lape.pe.sections_end - .Lape.pe.sections) / 40);
|
||||
HIDDEN(.Lidata.idtsize = idata.idtend - idata.idt);
|
||||
HIDDEN(.Lidata.iatsize = idata.iatend - idata.iat);
|
||||
HIDDEN(v_ntsubsystem = (DEFINED(GetMessage)
|
||||
? kNtImageSubsystemWindowsGui
|
||||
: kNtImageSubsystemWindowsCui));
|
||||
#endif
|
||||
|
||||
#if SupportsMetal()
|
||||
HIDDEN(v_ape_realsectors =
|
||||
MIN(REAL_SCRATCH_AREA - IMAGE_BASE_REAL,
|
||||
ROUNDUP(RVA(_edata), 4096)) / 512);
|
||||
HIDDEN(v_ape_realpages = v_ape_realsectors / (4096 / 512));
|
||||
HIDDEN(v_ape_highsectors =
|
||||
(ROUNDUP(RVA(_edata), 512) / 512) - v_ape_realsectors);
|
||||
|
||||
/* Windows NT Auto-Subsystem Embedding */
|
||||
HIDDEN(v_ntsubsystem = (DEFINED(GetMessage)
|
||||
? kNtImageSubsystemWindowsGui
|
||||
: kNtImageSubsystemWindowsCui));
|
||||
#endif
|
||||
|
||||
/* ZIP End of Central Directory header */
|
||||
#define ZIPCONST(NAME, VAL) HIDDEN(NAME = DEFINED(__zip_start) ? VAL : 0);
|
||||
|
@ -560,7 +563,8 @@ ZIPCONST(v_zip_cdirsize, __zip_end - __zip_start);
|
|||
ZIPCONST(v_zip_records, v_zip_cdirsize / kZipCdirHdrLinkableSize);
|
||||
ZIPCONST(v_zip_commentsize, _edata - __zip_end - kZipCdirHdrMinSize);
|
||||
|
||||
/* Generates deterministic ID for Mach-O. */
|
||||
#if SupportsXnu()
|
||||
/* Generates deterministic ID. */
|
||||
#define PHI 0x9e3779b9925d4c17
|
||||
#define XOR(X,Y) ((X | Y) - (X & Y))
|
||||
#define XORSHIFT(X,Y) \
|
||||
|
@ -573,14 +577,12 @@ ZIPCONST(v_zip_commentsize, _edata - __zip_end - kZipCdirHdrMinSize);
|
|||
X = (X + (Y >> 020) & 0xFF) * PHI; \
|
||||
X = (X + (Y >> 030) & 0xFF) * PHI
|
||||
#define CHURN(X) \
|
||||
XORSHIFT(uuid1_, X); \
|
||||
KMH(uuid1_, X); \
|
||||
XORSHIFT(uuid2_, X); \
|
||||
KMH(uuid2_, X)
|
||||
|
||||
HIDDEN(uuid1_ = 88172645463325252);
|
||||
HIDDEN(uuid2_ = 88172645463325252);
|
||||
|
||||
XORSHIFT(.Lape.uuid1, X); \
|
||||
KMH(.Lape.uuid1, X); \
|
||||
XORSHIFT(.Lape.uuid2, X); \
|
||||
KMH(.Lape.uuid2, X)
|
||||
HIDDEN(.Lape.uuid1 = 88172645463325252);
|
||||
HIDDEN(.Lape.uuid2 = 88172645463325252);
|
||||
CHURN(.Lape.bss.align);
|
||||
CHURN(.Lape.bss.filesz);
|
||||
CHURN(.Lape.bss.memsz);
|
||||
|
@ -608,12 +610,6 @@ CHURN(.Lape.note.memsz);
|
|||
CHURN(.Lape.note.offset);
|
||||
CHURN(.Lape.note.paddr);
|
||||
CHURN(.Lape.note.vaddr);
|
||||
CHURN(.Lape.pe.offset);
|
||||
CHURN(.Lape.pe.optsz);
|
||||
CHURN(.Lape.pe.sections);
|
||||
CHURN(.Lape.pe.sections_end);
|
||||
CHURN(.Lape.pe.shnum);
|
||||
CHURN(.Lape.phdrs.end);
|
||||
CHURN(.Lape.ram.align);
|
||||
CHURN(.Lape.ram.filesz);
|
||||
CHURN(.Lape.ram.memsz);
|
||||
|
@ -636,15 +632,28 @@ CHURN(.Lape.text.paddr);
|
|||
CHURN(.Lape.text.rva);
|
||||
CHURN(.Lape.text.vaddr);
|
||||
CHURN(ADDR(.bss));
|
||||
CHURN(WinMain);
|
||||
CHURN(_start);
|
||||
CHURN(ape.phdrs);
|
||||
#if SupportsMetal()
|
||||
CHURN(v_ape_realsectors);
|
||||
#endif
|
||||
#if SupportsXnu()
|
||||
CHURN(ape.macho);
|
||||
#endif
|
||||
#if SupportsWindows()
|
||||
CHURN(ape.mz);
|
||||
CHURN(ape.pe);
|
||||
CHURN(ape.phdrs);
|
||||
CHURN(v_ape_realsectors);
|
||||
CHURN(.Lape.pe.offset);
|
||||
CHURN(.Lape.pe.optsz);
|
||||
CHURN(.Lape.pe.sections);
|
||||
CHURN(.Lape.pe.sections_end);
|
||||
CHURN(.Lape.pe.shnum);
|
||||
CHURN(.Lape.phdrs.end);
|
||||
CHURN(WinMain);
|
||||
#endif /* SupportsWindows() */
|
||||
#endif /* SupportsXnu() */
|
||||
|
||||
ASSERT(ape.mz == IMAGE_BASE_VIRTUAL, "linker panic");
|
||||
ASSERT(DEFINED(ape.mz) ? ape.mz == IMAGE_BASE_VIRTUAL : 1, "linker panic");
|
||||
ASSERT((DEFINED(__init_bss_end) ? __init_bss_end : 0) % __SIZEOF_POINTER__ == 0,
|
||||
"__init_bss misalign");
|
||||
ASSERT(((DEFINED(__init_rodata_end) ? __init_rodata_end : 0) %
|
||||
|
|
|
@ -21,7 +21,7 @@ APE = $(APE_DEPS) \
|
|||
|
||||
APELINK = \
|
||||
ACTION=LINK.ape \
|
||||
$(MKDIR) $(@D) && \
|
||||
$(COMPILE) \
|
||||
$(LINK) \
|
||||
$(LINKARGS) \
|
||||
$(OUTPUT_OPTION) && \
|
||||
|
@ -39,6 +39,13 @@ APE_OBJS = $(APE_SRCS:%.S=o/$(MODE)/%.o)
|
|||
APE_DEPS = $(APE_LIB)
|
||||
APE_CHECKS = $(APE_HDRS:%=o/%.ok)
|
||||
|
||||
o/$(MODE)/ape/ape.lds: \
|
||||
ape/ape.lds \
|
||||
ape/config.h \
|
||||
ape/macros.internal.h \
|
||||
libc/dce.h \
|
||||
libc/zip.h
|
||||
|
||||
o/ape/idata.inc: \
|
||||
ape/idata.internal.h \
|
||||
ape/relocations.h
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue