mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-04 00:40:27 +00:00
Embed APE loader inside APE (#267)
The `ape-no-modify-self.o` bootloader now has an mmap-based payload that helps read-only APE binaries be load faster since it doesn't need to copy any files.
This commit is contained in:
parent
b5f743cdc3
commit
18ccfeb919
3 changed files with 39 additions and 3 deletions
12
ape/ape.lds
12
ape/ape.lds
|
@ -370,6 +370,15 @@ SECTIONS {
|
|||
} :Ram
|
||||
|
||||
/*END: file content that's loaded by o/s */
|
||||
/*BEGIN: payload (for now, only the APE loader) */
|
||||
.payload ALIGN(64) : {
|
||||
/* Loader */
|
||||
HIDDEN(ape_loader = .);
|
||||
KEEP(*(.ape.loader))
|
||||
. = ALIGN(64);
|
||||
HIDDEN(ape_loader_end = .);
|
||||
}
|
||||
/*END: payload */
|
||||
/*BEGIN: bss memory void */
|
||||
|
||||
.zip . : {
|
||||
|
@ -511,6 +520,9 @@ HIDDEN(ape_bss_filesz = 0);
|
|||
HIDDEN(ape_bss_memsz = SIZEOF(.bss));
|
||||
HIDDEN(ape_bss_align = PAGESIZE);
|
||||
|
||||
SHSTUB2(ape_loader_dd_skip, RVA(ape_loader) / 64);
|
||||
SHSTUB2(ape_loader_dd_count, (ape_loader_end - ape_loader) / 64);
|
||||
|
||||
#if SupportsXnu()
|
||||
SHSTUB2(ape_macho_dd_skip, RVA(ape_macho) / 8);
|
||||
SHSTUB2(ape_macho_dd_count, (ape_macho_end - ape_macho) / 8);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue