cosmopolitan/build
Justine Tunney face6b61d5 Add APE support for 32-bit programs
This is an experimental proof of concept demo:

    make -j8 o//examples/i386.i386.com
    o//examples/i386.i386.com --32
    echo $?  # <-- prints main32's argc parameter

Please note there's no libc support at the moment. This change is just
for fun and shouldn't be interpreted as intent to support. Having this
project on the whole support i386 would be tough because the calling
conventions are so different. There really isn't much in the way of low
hanging fruit opportunities to do something like NOP out REX prefixes
and call it a day. It'd likely need disjoint builds or possibly better
yet really cleverly crafted code generation in //third_party/chibicc!

Another challenge is is that Linux changed its SYSCALL ordinals when it
migrated from i386 to x86_64. Linux used to use the same magic numbers
as everyone else for functions like exit/write/read/etc. BSDs on the
other hand didn't pointlessly renumber things. So we'd need to find a
way to define the ordinals in libc/sysv/syscalls.sh twice for Linux. The
same goes for other ISAs too. Especially MIPS. For the Linux Kernel
alone, syscall magic numbers and data structure layouts are totally
different, and that's likely the case for other ISAs on other operating
systems too. Probably because ISA code historically got contributed to
open source by the companies that made the chips. Ulrich Drepper wrote
an amusing essay on the subject some years back.
2021-02-20 15:58:48 -08:00
..
bootstrap Add APE support for 32-bit programs 2021-02-20 15:58:48 -08:00
actuallynice Add binfmt_misc workaround detector to builds 2020-08-31 20:09:23 -07:00
bochs-debugger Add binfmt_misc workaround detector to builds 2020-08-31 20:09:23 -07:00
bochs-scriptable Initial import 2020-06-15 07:18:57 -07:00
catcode Add binfmt_misc workaround detector to builds 2020-08-31 20:09:23 -07:00
config.mk Remove support vector config shortcuts 2021-02-19 17:16:17 -08:00
definitions.mk Add APE support for 32-bit programs 2021-02-20 15:58:48 -08:00
findtmp Apply some touchups 2021-02-07 07:02:46 -08:00
functions.mk Initial import 2020-06-15 07:18:57 -07:00
getccversion Add binfmt_misc workaround detector to builds 2020-08-31 20:09:23 -07:00
getcompile Improve build system 2021-02-19 23:03:34 -08:00
hello Improve build system 2021-02-19 23:03:34 -08:00
htags Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
i386ify.sh Add APE support for 32-bit programs 2021-02-20 15:58:48 -08:00
includeall Add binfmt_misc workaround detector to builds 2020-08-31 20:09:23 -07:00
online.mk Improve build system 2021-02-19 23:03:34 -08:00
realify.sed Add minor improvements and cleanup 2020-10-27 03:39:46 -07:00
realify.sh Make more improvements 2020-09-28 01:20:34 -07:00
rle.py Fix XNU / FreeBSD / OpenBSD / RHEL5 / NT bugs 2021-01-25 18:31:17 -08:00
rollup Add binfmt_misc workaround detector to builds 2020-08-31 20:09:23 -07:00
rules.mk Add APE support for 32-bit programs 2021-02-20 15:58:48 -08:00
sanitycheck Add binfmt_misc workaround detector to builds 2020-08-31 20:09:23 -07:00
sanitycheck2 Fix bug in code written a priori 2020-08-31 21:02:14 -07:00
ssh Add binfmt_misc workaround detector to builds 2020-08-31 20:09:23 -07:00