mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 04:08:32 +00:00
Introduce new linker for fat ape binaries
This commit is contained in:
parent
e3c456d23a
commit
0105e3e2b6
44 changed files with 3140 additions and 867 deletions
|
@ -17,6 +17,7 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/nt/enum/status.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#ifdef __x86_64__
|
||||
|
||||
|
@ -40,19 +41,25 @@ kNtdllProcRvas:
|
|||
.init.start 202,_init_ntdll
|
||||
push %r12
|
||||
push %r13
|
||||
lea _ntdllmissingno(%rip),%r13
|
||||
lea __ntdll_not_found(%rip),%r13
|
||||
sub $32,%rsp
|
||||
xor %eax,%eax
|
||||
testb IsWindows()
|
||||
jz 7f
|
||||
loadstr "ntdll.dll",cx
|
||||
call *__imp_GetModuleHandleA(%rip)
|
||||
mov %rax,%r12
|
||||
7: mov %rax,%r12
|
||||
0: lodsq
|
||||
test %rax,%rax
|
||||
jz 1f
|
||||
.weak __executable_start
|
||||
lea __executable_start(%rax),%rdx
|
||||
xor %eax,%eax
|
||||
testb IsWindows()
|
||||
jz 7f
|
||||
mov %r12,%rcx
|
||||
call *__imp_GetProcAddress(%rip)
|
||||
test %rax,%rax
|
||||
7: test %rax,%rax
|
||||
cmovz %r13,%rax
|
||||
stosq
|
||||
jmp 0b
|
||||
|
@ -62,9 +69,13 @@ kNtdllProcRvas:
|
|||
.init.end 202,_init_ntdll,globl,hidden
|
||||
|
||||
.text.windows
|
||||
_ntdllmissingno:
|
||||
.ftrace1
|
||||
__ntdll_not_found:
|
||||
.ftrace2
|
||||
mov $kNtStatusDllNotFound,%eax
|
||||
ret
|
||||
.previous
|
||||
|
||||
.weak __hostos
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
|
|
@ -32,10 +32,10 @@
|
|||
#define kNtPe32bit 0x010b
|
||||
#define kNtPe64bit 0x020b
|
||||
|
||||
#define kNtPeSectionCntCode 0x000000020
|
||||
#define kNtPeSectionCntInitializedData 0x000000040
|
||||
#define kNtPeSectionCntUninitializedData 0x000000080
|
||||
#define kNtPeSectionGprel 0x000008000
|
||||
#define kNtPeSectionCntCode 0x00000020
|
||||
#define kNtPeSectionCntInitializedData 0x00000040
|
||||
#define kNtPeSectionCntUninitializedData 0x00000080
|
||||
#define kNtPeSectionGprel 0x00008000
|
||||
#define kNtPeSectionMemDiscardable 0x02000000
|
||||
#define kNtPeSectionMemNotCached 0x04000000
|
||||
#define kNtPeSectionMemNotPaged 0x08000000
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue