cosmopolitan/libc/runtime
Justine Tunney db0d8dd806 Support Linux binfmt_misc and APE loading on Apple
The "no modify self" variant of Actually Portable Executable is now
supported on all platforms. If you use `$(APE_NO_MODIFY_SELF)` then
ld.bfd will embed a 4096 byte ELF binary and a 4096 byte Macho file
which are installed on the fly to ${TMPDIR:-/tmp}, which enables us
launch the executable, without needing to copy the whole executable

To prevent it from copying a tiny executable to your temp directory
you need to install the `ape` command (renamed from ape-loader), to
a system path. For example:

    # FreeBSD / NetBSD / OpenBSD
    make -j8 o//ape/ape
    cp o//ape/ape /usr/bin/ape

    # Mac OS
    # make -j8 o//ape/ape.macho
    curl https://justine.lol/ape.macho >/usr/bin/ape
    chmod +x /usr/bin/ape

On Linux you can get even more performance with the new binfmt_misc
support which makes launching non-modifying APE binaries as fast as
launching ELF executables. Running the following command:

    # Linux
    ape/apeinstall.sh

Will copy APE loader to /usr/bin/ape and register with binfmt_misc
Lastly, this change also fixes a really interesting race condition
with OpenBSD thread joining.
2022-05-21 09:28:25 -07:00
..
abort.greg.c Improve locks and signals 2022-04-12 05:20:17 -07:00
arch_prctl.c Support thread local storage 2022-05-16 13:20:08 -07:00
arememoryintervalsok.c Make some systemic improvements 2022-05-18 16:52:36 -07:00
brk.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
buffer.h Initial import 2020-06-15 07:18:57 -07:00
clearenv.c Introduce --strace flag for system call tracing 2022-03-18 18:07:28 -07:00
clktck.c Change noinline to dontinline (#312) 2021-11-12 15:12:18 -08:00
clktck.h Make major improvements to redbean and libraries 2021-04-18 12:34:15 -07:00
clone.c Support Linux binfmt_misc and APE loading on Apple 2022-05-21 09:28:25 -07:00
close_s.c Improve locks and signals 2022-04-12 05:20:17 -07:00
closesymboltable.c Make numerous improvements 2021-09-28 01:52:34 -07:00
construct.S Clean old .source directive out of asm code 2022-03-18 12:43:21 -07:00
cosmo.S Fix many thread and file descriptor issues on Windows 2022-05-20 20:57:19 -07:00
cxaatexit.internal.h Implement raw system call for redbean lua code 2022-04-13 08:53:24 -07:00
directmap.internal.h Improve signals and memory protection 2022-04-12 22:11:00 -07:00
dlfcn.h Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
dsohandle.S Introduce --strace flag for system call tracing 2022-03-18 18:07:28 -07:00
e820.internal.h Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
efimain.greg.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
exit.c Get life.com in MODE=tiny back down to 12kb 2022-03-23 08:09:01 -07:00
exit2.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
ezmap.c Make numerous improvements 2021-09-28 01:52:34 -07:00
ezmap.internal.h Improve documentation 2020-12-27 07:02:35 -08:00
fegetround.c Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
fenv.c Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
fenv.h Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
fesetround.c Fix issues revealed by ECMAScript test262 2021-04-10 17:15:35 -07:00
findcombinary.c Make improvements 2022-04-28 09:57:07 -07:00
finddebugbinary.c Make improvements 2022-04-28 09:57:07 -07:00
fltrounds.c Fix issues revealed by ECMAScript test262 2021-04-10 17:15:35 -07:00
fork-nt.c Make some systemic improvements 2022-05-18 16:52:36 -07:00
fork.c Fix bugs and make improvements 2022-04-20 10:05:34 -07:00
fpreset.S Clean old .source directive out of asm code 2022-03-18 12:43:21 -07:00
free_s.c Improve locks and signals 2022-04-12 05:20:17 -07:00
ftrace-hook.S Make some systemic improvements 2022-05-18 16:52:36 -07:00
ftraceinit.greg.c Make some systemic improvements 2022-05-18 16:52:36 -07:00
ftracer.c Support Linux binfmt_misc and APE loading on Apple 2022-05-21 09:28:25 -07:00
gc.h Import C++ Standard Template Library 2022-03-22 06:41:54 -07:00
gc.internal.h Fix regression in _gclongjmp() 2021-08-19 09:34:24 -07:00
getargmax.c Make improvements 2022-04-28 09:57:07 -07:00
getcpucount.c Wrap sched_getaffinity 2022-05-12 07:22:57 -07:00
getdosargv.c Improve synchronization 2022-04-15 15:31:55 -07:00
getdosenviron.c Make improvements 2022-03-16 13:40:10 -07:00
getinstructionlengths.c Support thread local storage 2022-05-16 13:20:08 -07:00
getinterpreterexecutablename.c Make improvements 2022-04-26 16:46:15 -07:00
getmaxfd.c Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
getpagesize.S Clean old .source directive out of asm code 2022-03-18 12:43:21 -07:00
getresourcelimit.c Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
getsymbolname.c Improve memory safety 2021-10-13 17:27:13 -07:00
getsymboltable.c Fix many thread and file descriptor issues on Windows 2022-05-20 20:57:19 -07:00
grow.c Make numerous improvements 2021-09-28 01:52:34 -07:00
hook.greg.c Fix many thread and file descriptor issues on Windows 2022-05-20 20:57:19 -07:00
init.S Add ASAN guards to some asm data structures 2022-03-18 13:02:57 -07:00
interceptflag.greg.c Improve synchronization 2022-04-15 15:31:55 -07:00
internal.h Make improvements 2022-04-24 10:06:05 -07:00
interruptiblecall.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
interruptiblecall.h Initial import 2020-06-15 07:18:57 -07:00
isheap.c Improve memory safety 2021-10-13 17:27:13 -07:00
ismemtracked.greg.c Make improvements 2022-04-24 10:06:05 -07:00
issetugid.c Change license 2020-12-27 17:18:44 -08:00
jmpstack.S Improve signals and memory protection 2022-04-12 22:11:00 -07:00
ldso.c Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
mapanon.c Improve synchronization 2022-04-15 15:31:55 -07:00
mapelfread.c Change license 2020-12-27 17:18:44 -08:00
memtrack.greg.c Make fixes and improvements 2022-05-19 16:57:49 -07:00
memtrack.internal.h Make fixes and improvements 2022-05-19 16:57:49 -07:00
memtracknt.c Make improvements 2022-04-07 00:15:35 -07:00
metalprintf.greg.c Improve synchronization 2022-04-15 15:31:55 -07:00
metalprintf.internal.h Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
mman.internal.h Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
mmap.c Make fixes and improvements 2022-05-19 16:57:49 -07:00
mmi.c Make mappings unlimited on NT 2021-09-04 13:20:47 -07:00
mmi.init.S Make mappings unlimited on NT 2021-09-04 13:20:47 -07:00
morph.greg.c Support thread local storage 2022-05-16 13:20:08 -07:00
mprotect-nt.greg.c Make improvements 2022-04-28 09:57:07 -07:00
mprotect.greg.c Support thread local storage 2022-05-16 13:20:08 -07:00
mremap.c Fix bugs with recent change 2022-04-16 10:40:23 -07:00
msync-nt.c Make improvements 2022-04-24 10:06:05 -07:00
msync.c Fix more things 2022-03-24 00:12:29 -07:00
munmap.c Make some systemic improvements 2022-05-18 16:52:36 -07:00
openexecutable.S Fix Redbean when file is read-only (#365) 2022-03-14 17:13:28 -07:00
opensymboltable.greg.c Fix bugs and make improvements 2022-04-20 10:05:34 -07:00
paginate.c Add syscalls to Blinkenlights and fix bugs 2022-05-13 13:31:21 -07:00
pc.internal.h Add syscalls to Blinkenlights and fix bugs 2022-05-13 13:31:21 -07:00
peekall.S Add MODE=optlinux build mode (#141) 2021-10-14 19:36:49 -07:00
printargs.greg.c Make fixes and improvements 2022-05-19 16:57:49 -07:00
printmaps.c Make fixes and improvements 2022-05-19 16:57:49 -07:00
printmemoryintervals.c Make some systemic improvements 2022-05-18 16:52:36 -07:00
progname.S Clean old .source directive out of asm code 2022-03-18 12:43:21 -07:00
program_invocation_short_name.S Add syscalls to Blinkenlights and fix bugs 2022-05-13 13:31:21 -07:00
pthread.c Improve locks and signals 2022-04-12 05:20:17 -07:00
runtime.h Make fixes and improvements 2022-05-19 16:57:49 -07:00
runtime.mk Make fixes and improvements 2022-05-19 16:57:49 -07:00
setstack.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
stack.h Make fixes and improvements 2022-05-19 16:57:49 -07:00
stackchkfail.c Expose public garbage collector API for C language 2021-03-08 10:59:34 -08:00
stackchkfaillocal.c Change license 2020-12-27 17:18:44 -08:00
stackuse.c Make some systemic improvements 2022-05-18 16:52:36 -07:00
straceinit.greg.c Add support for symbol table in .com files 2022-03-23 06:34:46 -07:00
symbolic.h wip on intellisense (again) 2021-02-02 11:14:45 -05:00
symbols.c Fix many thread and file descriptor issues on Windows 2022-05-20 20:57:19 -07:00
symbols.internal.h Add support for symbol table in .com files 2022-03-23 06:34:46 -07:00
sysconf.c Make improvements 2022-04-28 09:57:07 -07:00
sysconf.h Fix a few more Python tests 2021-08-16 23:47:47 -07:00
untrackmemoryintervals.c Make some systemic improvements 2022-05-18 16:52:36 -07:00
valist.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
valist.h Further refine documentation 2020-12-27 17:05:03 -08:00
vfork.S Support thread local storage 2022-05-16 13:20:08 -07:00
weakfree.c Expose public garbage collector API for C language 2021-03-08 10:59:34 -08:00
winmain.greg.c Make some systemic improvements 2022-05-18 16:52:36 -07:00
winthreadlaunch.S Make fixes and improvements 2022-05-19 16:57:49 -07:00