cosmopolitan/tool/build
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
..
emubin Improve dead code elimination 2021-02-08 04:04:42 -08:00
emucrt Change license 2020-12-27 17:18:44 -08:00
lib Perform some code cleanup 2021-02-27 10:33:32 -08:00
ar.c Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
blinkenlights.c Improve signal handling and math 2021-02-25 18:33:33 -08:00
build.mk Improve build system 2021-02-19 23:03:34 -08:00
calculator.c Make C memory safe like Rust 2021-02-01 03:58:46 -08:00
calculator.ctest Add chibicc 2020-12-06 16:20:21 -08:00
calculator.inc Further refine documentation 2020-12-27 17:05:03 -08:00
compile.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
dis.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
dropcache.c Change license 2020-12-27 17:18:44 -08:00
helpop.c Change license 2020-12-27 17:18:44 -08:00
lz4toasm.c Change license 2020-12-27 17:18:44 -08:00
mkdeps.c Change license 2020-12-27 17:18:44 -08:00
package.c Fix some more build issues (#43) 2021-02-20 12:39:39 -08:00
pstrace.c Add tool for parsing strace output 2021-02-20 10:45:55 -08:00
refactor.c Change license 2020-12-27 17:18:44 -08:00
rle.c Change license 2020-12-27 17:18:44 -08:00
rollup.c Change license 2020-12-27 17:18:44 -08:00
runit.c Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
runit.h Initial import 2020-06-15 07:18:57 -07:00
runitd.c Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
summy.c Change license 2020-12-27 17:18:44 -08:00
tinyemu.c Fix our remarkable 184kb x86_64 emulator 2021-01-27 20:02:23 -08:00
x86combos.c Change license 2020-12-27 17:18:44 -08:00
zipobj.c Fix zip executables on MacOS 2021-02-27 18:16:59 -08:00