mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 15:28:30 +00:00
Rewrite .zip.o file linker
This change takes an entirely new approach to the incremental linking of pkzip executables. The assets created by zipobj.com are now treated like debug data. After a .com.dbg is compiled, fixupobj.com should be run, so it can apply fixups to the offsets and move the zip directory to the end of the file. Since debug data doesn't get objcopy'd, a new tool has been introduced called zipcopy.com which should be run after objcopy whenever a .com file is created. This is all automated by the `cosmocc` toolchain which is rapidly becoming the new recommended approach. This change also introduces the new C23 checked arithmetic macros.
This commit is contained in:
parent
f6407d5f7c
commit
8ff48201ca
125 changed files with 1056 additions and 928 deletions
|
@ -300,3 +300,20 @@ uint32_t elfwriter_relatype_abs32(const struct ElfWriter *elf) {
|
|||
notpossible;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t elfwriter_relatype_pc32(const struct ElfWriter *elf) {
|
||||
switch (elf->ehdr->e_machine) {
|
||||
case EM_NEXGEN32E:
|
||||
return R_X86_64_PC32;
|
||||
case EM_AARCH64:
|
||||
return R_AARCH64_PREL32;
|
||||
case EM_PPC64:
|
||||
return R_PPC64_REL32;
|
||||
case EM_RISCV:
|
||||
return R_RISCV_RELATIVE;
|
||||
case EM_S390:
|
||||
return R_390_PC32;
|
||||
default:
|
||||
notpossible;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue