cosmopolitan/libc/runtime
Justine Tunney 94afa982c3 Fix zip executables on MacOS
Here's why we got those `Killed: 11` failures on MacOS after modifying
the contentns of the redbean.com executable. If you were inserting a
small file, such as a HelloWorld.html file, then InfoZIP might have
decreased the size of the executable to less than what the Mach-O
section had been expecting.

That's because when zipobj.com put things like time zone data in the
executable, it aligned each zip file entry on a 64-byte boundary, simply
for the sake of readability in binary dumps. But when InfoZIP edited the
file it would rewrite every entry using ZIP's usual 2-byte alignment.
Thus causing shrinkage.

The solution was to reconfigure the linker script so that zip file bits
that get put into the executable at link-time, such as timezone data,
aren't officially part of the executable image, i.e. we don't want the
operating system to load that part.

The original decision to put the linked zip files into the .data section
was mostly made so that when the executable was run in its .com.dbg form
it would still have the zip entries be accessible, even though there was
tons of GNU debug data following the central directory. We're not going
to be able to do that. The .com executable should be the canonical
executable. We have really good tools for automatically attaching and
configuring GDB correctly with debug symbols even when the .com is run.
We'll have to rely on those in cases where zip embedding is used.

See #53
See #54
See #68
2021-02-27 18:16:59 -08:00
..
abort-nt.c Improve signal handling and math 2021-02-25 18:33:33 -08:00
abort.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
arch_prctl.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
arememoryintervalsok.c Eliminate some flakes 2021-02-03 06:25:27 -08:00
assertfail.c Elevate .text.syscall to .privileged 2021-02-06 04:49:22 -08:00
atexit.c Change license 2020-12-27 17:18:44 -08:00
brk.c Work towards improving signals and processes 2021-01-27 19:34:02 -08:00
buffer.h Initial import 2020-06-15 07:18:57 -07:00
carsort.h Add x86_64-linux-gnu emulator 2020-08-25 04:43:42 -07:00
carsort100.c Change license 2020-12-27 17:18:44 -08:00
carsort1000.c Change license 2020-12-27 17:18:44 -08:00
clearenv.c Change license 2020-12-27 17:18:44 -08:00
close_s.c Change license 2020-12-27 17:18:44 -08:00
closesymboltable.c Change license 2020-12-27 17:18:44 -08:00
construct.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
cosmo.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
cxaatexit.c Eliminate some flakes 2021-02-03 06:25:27 -08:00
describeos.c Change license 2020-12-27 17:18:44 -08:00
directmap-metal.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
directmap-nt.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
directmap.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
directmap.internal.h Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
dsohandle.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
e820.internal.h Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
efimain.greg.c Perform some code cleanup 2021-02-27 10:33:32 -08:00
exit.c Restore Windows command prompt mode on exit 2021-02-27 12:53:51 -08:00
exit2.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
exit3.c Perform some code cleanup 2021-02-27 10:33:32 -08:00
ezmap.c Change license 2020-12-27 17:18:44 -08:00
ezmap.internal.h Improve documentation 2020-12-27 07:02:35 -08:00
findcombinary.c Change license 2020-12-27 17:18:44 -08:00
finddebugbinary.c Fix some more build issues (#43) 2021-02-20 12:39:39 -08:00
findmemoryinterval.c Eliminate some flakes 2021-02-03 06:25:27 -08:00
fork-nt.c Use unsigned leb128 for magnums 2021-02-24 04:00:38 -08:00
fork.c Apply some touchups 2021-02-07 07:02:46 -08:00
fpreset.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
free_s.c Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
ftrace-hook.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
ftrace.c Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
g_argc.S Improve signal handling and math 2021-02-25 18:33:33 -08:00
gc.h wip vscode intellisense support 2021-02-02 07:29:00 -05:00
getdosargv.c Eliminate some flakes 2021-02-03 06:25:27 -08:00
getdosenviron.c Eliminate some flakes 2021-02-03 06:25:27 -08:00
getpagesize.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
grow.c Change license 2020-12-27 17:18:44 -08:00
hook.greg.c Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
init.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
internal.h Restore Windows command prompt mode on exit 2021-02-27 12:53:51 -08:00
interruptiblecall.c Improve dead code elimination 2021-02-08 04:04:42 -08:00
interruptiblecall.h Initial import 2020-06-15 07:18:57 -07:00
isheap.c Change license 2020-12-27 17:18:44 -08:00
issetugid.c Change license 2020-12-27 17:18:44 -08:00
jmpstack.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
ldso.c Work towards improving signals and processes 2021-01-27 19:34:02 -08:00
mapanon.c Change license 2020-12-27 17:18:44 -08:00
mapelfread.c Change license 2020-12-27 17:18:44 -08:00
memtrack.c Eliminate some flakes 2021-02-03 06:25:27 -08:00
memtrack.h Make Cosmopolitan ANSI C89 compatible 2021-02-03 17:48:59 -08:00
memtracknt.c Eliminate some flakes 2021-02-03 06:25:27 -08:00
metalprintf.greg.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
metalprintf.internal.h Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
mman.greg.c Fix zip executables on MacOS 2021-02-27 18:16:59 -08:00
mman.internal.h Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
mmap.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
mmi.c Change license 2020-12-27 17:18:44 -08:00
mremap.c Change license 2020-12-27 17:18:44 -08:00
msync-nt.c Remove dollars from system call support symbols 2021-02-03 19:35:29 -08:00
msync.c Remove dollars from system call support symbols 2021-02-03 19:35:29 -08:00
munmap-metal.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
munmap.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
opensymboltable.c Change license 2020-12-27 17:18:44 -08:00
pc.internal.h Improve signal handling and math 2021-02-25 18:33:33 -08:00
peekall.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
print.greg.c Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
printmemoryintervals.c Change license 2020-12-27 17:18:44 -08:00
progname.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
program_invocation_short_name.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
pthread.c Work towards improving signals and processes 2021-01-27 19:34:02 -08:00
runtime.h Use unsigned leb128 for magnums 2021-02-24 04:00:38 -08:00
runtime.mk Perform some code cleanup 2021-02-27 10:33:32 -08:00
setstack.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
stackchkfail.c Elevate .text.syscall to .privileged 2021-02-06 04:49:22 -08:00
stackchkfaillocal.c Change license 2020-12-27 17:18:44 -08:00
symbolic.h wip on intellisense (again) 2021-02-02 11:14:45 -05:00
symbols.internal.h Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
sysconf.c Change license 2020-12-27 17:18:44 -08:00
sysconf.h Add x86_64-linux-gnu emulator 2020-08-25 04:43:42 -07:00
untrackmemoryintervals.c Improve dead code elimination 2021-02-08 04:04:42 -08:00
valist.c Change license 2020-12-27 17:18:44 -08:00
valist.h Further refine documentation 2020-12-27 17:05:03 -08:00
vfork.S Trim down executable sizes 2021-02-11 08:37:18 -08:00
weakfree.S Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
winmain.greg.c Fix memzoom on Windows 2021-02-27 15:01:00 -08:00