Decentralize Python native module linkage

We can now link even smaller Python binaries. For example, the hello.com
program in the Python build directory is a compiled linked executable of
hello.py which just prints hello world. Using decentralized sections, we
can make that binary 1.9mb in size (noting that python.com is 6.3 megs!)

This works for nontrivial programs too. For example, say we want an APE
binary that's equivalent to python.com -m http.server. Our makefile now
builds such a binary using the new launcher and it's only 3.2mb in size
since Python sources get turned into ELF objects, which tell our linker
that we need things like native hashing algorithm code.
This commit is contained in:
Justine Tunney 2021-09-07 11:40:11 -07:00
parent dfa0359b50
commit 559b024e1d
129 changed files with 2798 additions and 13514 deletions

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_CreateEventA,CreateEventA,0
.text.windows
CreateEventA:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_CreateEventA(%rip),%rax
jmp __sysv2nt
.endfn CreateEventA,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_CreateEventExA,CreateEventExA,0
.text.windows
CreateEventExA:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_CreateEventExA(%rip),%rax
jmp __sysv2nt
.endfn CreateEventExA,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_CreateEventExW,CreateEventExW,0
.text.windows
CreateEventEx:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_CreateEventExW(%rip),%rax
jmp __sysv2nt
.endfn CreateEventEx,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_CreateEventW,CreateEventW,0
.text.windows
CreateEvent:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_CreateEventW(%rip),%rax
jmp __sysv2nt
.endfn CreateEvent,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_GetOverlappedResult,GetOverlappedResult,0
.text.windows
GetOverlappedResult:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_GetOverlappedResult(%rip),%rax
jmp __sysv2nt
.endfn GetOverlappedResult,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_GetOverlappedResultEx,GetOverlappedResultEx,0
.text.windows
GetOverlappedResultEx:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_GetOverlappedResultEx(%rip),%rax
jmp __sysv2nt6
.endfn GetOverlappedResultEx,globl
.previous