mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 11:18: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
|
@ -18,6 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/limits.h"
|
||||
#include "libc/runtime/internal.h"
|
||||
#include "libc/stdckdint.h"
|
||||
|
||||
/**
|
||||
* Returns -𝑥, aborting on overflow.
|
||||
|
@ -66,7 +67,7 @@ int128_t __negvti2(int128_t x) {
|
|||
*/
|
||||
int __addvsi3(int x, int y) {
|
||||
int z;
|
||||
if (__builtin_add_overflow(x, y, &z)) {
|
||||
if (ckd_add(&z, x, y)) {
|
||||
__on_arithmetic_overflow();
|
||||
}
|
||||
return z;
|
||||
|
@ -80,7 +81,7 @@ int __addvsi3(int x, int y) {
|
|||
*/
|
||||
long __addvdi3(long x, long y) {
|
||||
long z;
|
||||
if (__builtin_add_overflow(x, y, &z)) {
|
||||
if (ckd_add(&z, x, y)) {
|
||||
__on_arithmetic_overflow();
|
||||
}
|
||||
return z;
|
||||
|
@ -94,7 +95,7 @@ long __addvdi3(long x, long y) {
|
|||
*/
|
||||
int128_t __addvti3(int128_t x, int128_t y) {
|
||||
int128_t z;
|
||||
if (__builtin_add_overflow(x, y, &z)) {
|
||||
if (ckd_add(&z, x, y)) {
|
||||
__on_arithmetic_overflow();
|
||||
}
|
||||
return z;
|
||||
|
@ -108,7 +109,7 @@ int128_t __addvti3(int128_t x, int128_t y) {
|
|||
*/
|
||||
int __subvsi3(int x, int y) {
|
||||
int z;
|
||||
if (__builtin_sub_overflow(x, y, &z)) {
|
||||
if (ckd_sub(&z, x, y)) {
|
||||
__on_arithmetic_overflow();
|
||||
}
|
||||
return z;
|
||||
|
@ -122,7 +123,7 @@ int __subvsi3(int x, int y) {
|
|||
*/
|
||||
long __subvdi3(long x, long y) {
|
||||
long z;
|
||||
if (__builtin_sub_overflow(x, y, &z)) {
|
||||
if (ckd_sub(&z, x, y)) {
|
||||
__on_arithmetic_overflow();
|
||||
}
|
||||
return z;
|
||||
|
@ -136,7 +137,7 @@ long __subvdi3(long x, long y) {
|
|||
*/
|
||||
int128_t __subvti3(int128_t x, int128_t y) {
|
||||
int128_t z;
|
||||
if (__builtin_sub_overflow(x, y, &z)) {
|
||||
if (ckd_sub(&z, x, y)) {
|
||||
__on_arithmetic_overflow();
|
||||
}
|
||||
return z;
|
||||
|
@ -150,7 +151,7 @@ int128_t __subvti3(int128_t x, int128_t y) {
|
|||
*/
|
||||
int __mulvsi3(int x, int y) {
|
||||
int z;
|
||||
if (__builtin_mul_overflow(x, y, &z)) {
|
||||
if (ckd_mul(&z, x, y)) {
|
||||
__on_arithmetic_overflow();
|
||||
}
|
||||
return z;
|
||||
|
@ -164,7 +165,7 @@ int __mulvsi3(int x, int y) {
|
|||
*/
|
||||
long __mulvdi3(long x, long y) {
|
||||
long z;
|
||||
if (__builtin_mul_overflow(x, y, &z)) {
|
||||
if (ckd_mul(&z, x, y)) {
|
||||
__on_arithmetic_overflow();
|
||||
}
|
||||
return z;
|
||||
|
@ -178,7 +179,7 @@ long __mulvdi3(long x, long y) {
|
|||
*/
|
||||
int128_t __mulvti3(int128_t x, int128_t y) {
|
||||
int128_t z;
|
||||
if (__builtin_mul_overflow(x, y, &z)) {
|
||||
if (ckd_mul(&z, x, y)) {
|
||||
__on_arithmetic_overflow();
|
||||
}
|
||||
return z;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue