cosmopolitan/tool/build
Justine Tunney dd53f31147
Introduce post-linker that converts ELF to PE
If you build a static ELF executable in `ld -q` mode (which leaves rela
sections inside the binary) then you can run it through the elf2pe.com
program afterwards, which will turn it into a PE executable. We have a
new trick for defining WIN32 DLL imports in C without any assembly code.
This also achieves the optimally tiny and perfect PE binary structure.

We need this because it isn't possible to have a GNU ld linker script
generate a PE file where the virtual pointer and the file pointer can
drift apart. This post-linker can do that. One cool benefit is we can
now use a smaller 512-byte alignment in the file, and an even bigger
64kb alignment for the segment virtual addresses, and the executable
ends up being smaller.

Another program introduced by this change is pecheck.com which can do
extensive linting of PE static executables to help explain why Windows
won't load it.
2023-08-09 18:46:06 -07:00
..
dso Fix bugs in cosmocc toolchain 2023-06-08 23:44:03 -07:00
lib Support symbol tables with arch specific name 2023-07-29 23:50:15 -07:00
ar.c Do work on curl/mbedtls/zstd 2023-07-07 10:13:35 -07:00
assimilate.c Mint APE Loader v1.5 2023-07-26 13:54:49 -07:00
bigmul.c Run clang-format on most sources 2023-04-27 05:44:32 -07:00
build.mk Remove ELF binaries from tests 2023-07-28 07:20:57 -07:00
chmod.c Remove some dead code 2023-07-03 02:48:29 -07:00
cocmd.c Mint APE Loader v1.5 2023-07-26 13:54:49 -07:00
compile.c Support symbol tables with arch specific name 2023-07-29 23:50:15 -07:00
cp.c Make fixes and improvements 2023-07-09 05:21:11 -07:00
dd.c Reconfigure GitHub Actions 2023-07-10 12:17:18 -07:00
deltaify.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
dropcache.c Change license 2020-12-27 17:18:44 -08:00
echo.c Make build hermetic without shell scripts 2022-05-25 13:55:57 -07:00
elf2pe.c Introduce post-linker that converts ELF to PE 2023-08-09 18:46:06 -07:00
false.c Fix hermeticity issue with new test 2023-04-18 06:37:01 -07:00
fastdiff.c Clean up some code 2022-12-11 14:30:59 -08:00
fixupobj.c Fix a bunch of Windows bugs reported on Discord 2023-07-28 06:17:34 -07:00
gzip.c Remove some dead code 2023-07-03 02:48:29 -07:00
helpop.c Remove some dead code 2023-07-03 02:48:29 -07:00
lz4toasm.c Let lz4toasm accept LZ4 files that lack extracted-size field (#858) 2023-07-23 11:12:22 -07:00
mkdeps.c Fix the build 2023-07-11 05:48:39 -07:00
mkdir.c Remove some dead code 2023-07-03 02:48:29 -07:00
mv.c Make fixes and improvements 2023-07-09 05:21:11 -07:00
objbincopy.c Mint APE Loader v1.3 2023-07-23 17:08:14 -07:00
package.c Fix a bunch of Windows bugs reported on Discord 2023-07-28 06:17:34 -07:00
pecheck.c Introduce post-linker that converts ELF to PE 2023-08-09 18:46:06 -07:00
pledge.c Mint APE Loader v1.5 2023-07-26 13:54:49 -07:00
printf.c Remove some dead code 2023-07-03 02:48:29 -07:00
pwd.c Remove some dead code 2023-07-03 02:48:29 -07:00
rm.c Make fixes and improvements 2023-07-09 05:21:11 -07:00
rollup.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
runit.c Improve Windows Console I/O 2023-08-08 05:44:40 -07:00
runit.h Fix bugs and add security features to redbean 2022-04-18 00:01:26 -07:00
runitd.c Improve Windows Console I/O 2023-08-08 05:44:40 -07:00
sha256sum.c Mint APE Loader v1.5 2023-07-26 13:54:49 -07:00
summy.c Unbloat the build 2022-08-11 00:15:29 -07:00
symtab.c Switch public headers to getopt_long() entirely 2023-07-02 19:57:43 -07:00
touch.c Remove some dead code 2023-07-03 02:48:29 -07:00
unbuffer.c Make improvements 2023-07-11 04:41:50 -07:00
unbundle.c Make fixes and improvements 2023-07-09 05:21:11 -07:00
unveil.c Switch public headers to getopt_long() entirely 2023-07-02 19:57:43 -07:00
x86combos.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
zipcopy.c Fix the build 2023-07-11 05:48:39 -07:00
zipobj.c Fix a bunch of Windows bugs reported on Discord 2023-07-28 06:17:34 -07:00