mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Mint APE Loader v1.5
This change ports APE Loader to Linux AARCH64, so that Raspberry Pi users can run programs like redbean, without the executable needing to modify itself. Progress has also slipped into this change on the issue of making progress better conforming to user expectations and industry standards regarding which symbols we're allowed to declare
This commit is contained in:
parent
6843150e0c
commit
7e0a09feec
510 changed files with 1783 additions and 1483 deletions
|
@ -47,7 +47,7 @@ void *xloadzd(_Atomic(void *) *a, const void *p, size_t n, size_t m, size_t c,
|
|||
void *r, *g;
|
||||
int64_t x, y;
|
||||
if ((r = atomic_load_explicit(a, memory_order_acquire))) return r;
|
||||
_unassert(z == 2 || z == 4);
|
||||
unassert(z == 2 || z == 4);
|
||||
if (!(b = q = malloc(m))) return 0;
|
||||
if (__inflate(q, m, p, n)) {
|
||||
free(q);
|
||||
|
|
22
third_party/python/Modules/main.c
vendored
22
third_party/python/Modules/main.c
vendored
|
@ -8,8 +8,8 @@
|
|||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/str/locale.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
|
@ -29,16 +29,16 @@
|
|||
#include "third_party/python/pyconfig.h"
|
||||
/* clang-format off */
|
||||
|
||||
STATIC_YOINK("PyInit__codecs"); // for pylifecycle.o
|
||||
STATIC_YOINK("PyInit__collections"); // for pylifecycle.o
|
||||
STATIC_YOINK("PyInit__functools"); // for pylifecycle.o
|
||||
STATIC_YOINK("PyInit__locale"); // for pylifecycle.o
|
||||
STATIC_YOINK("PyInit__operator"); // for pylifecycle.o
|
||||
STATIC_YOINK("PyInit__signal"); // for pylifecycle.o
|
||||
STATIC_YOINK("PyInit__sre"); // for pylifecycle.o
|
||||
STATIC_YOINK("PyInit__stat"); // for pylifecycle.o
|
||||
STATIC_YOINK("PyInit_errno"); // for pylifecycle.o
|
||||
STATIC_YOINK("PyInit_itertools"); // for pylifecycle.o
|
||||
__static_yoink("PyInit__codecs"); // for pylifecycle.o
|
||||
__static_yoink("PyInit__collections"); // for pylifecycle.o
|
||||
__static_yoink("PyInit__functools"); // for pylifecycle.o
|
||||
__static_yoink("PyInit__locale"); // for pylifecycle.o
|
||||
__static_yoink("PyInit__operator"); // for pylifecycle.o
|
||||
__static_yoink("PyInit__signal"); // for pylifecycle.o
|
||||
__static_yoink("PyInit__sre"); // for pylifecycle.o
|
||||
__static_yoink("PyInit__stat"); // for pylifecycle.o
|
||||
__static_yoink("PyInit_errno"); // for pylifecycle.o
|
||||
__static_yoink("PyInit_itertools"); // for pylifecycle.o
|
||||
|
||||
PYTHON_YOINK("site"); // for pylifecycle.o
|
||||
PYTHON_YOINK("struct"); // for memoryobject.o
|
||||
|
|
4
third_party/python/Objects/object.c
vendored
4
third_party/python/Objects/object.c
vendored
|
@ -4,6 +4,7 @@
|
|||
│ Python 3 │
|
||||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "libc/intrin/likely.h"
|
||||
#include "libc/log/countbranch.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
|
@ -28,7 +29,6 @@
|
|||
#include "third_party/python/Include/memoryobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/namespaceobject.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/odictobject.h"
|
||||
#include "third_party/python/Include/pycapsule.h"
|
||||
|
@ -1897,7 +1897,7 @@ _Py_NewReference(PyObject *op)
|
|||
_Py_INC_TPALLOCS(op);
|
||||
}
|
||||
|
||||
noasan void
|
||||
dontasan void
|
||||
_Py_ForgetReference(PyObject *op)
|
||||
{
|
||||
#ifdef SLOW_UNREF_CHECK
|
||||
|
|
12
third_party/python/Objects/obmalloc.c
vendored
12
third_party/python/Objects/obmalloc.c
vendored
|
@ -5,11 +5,11 @@
|
|||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/sysv/consts/map.h"
|
||||
|
@ -1910,13 +1910,13 @@ bumpserialno(void)
|
|||
|
||||
#define SST SIZEOF_SIZE_T
|
||||
|
||||
static inline optimizespeed noasan size_t
|
||||
static inline optimizespeed dontasan size_t
|
||||
read_size_t(const void *p)
|
||||
{
|
||||
return READ64BE(p);
|
||||
}
|
||||
|
||||
static inline optimizespeed noasan void
|
||||
static inline optimizespeed dontasan void
|
||||
write_size_t(void *p, size_t n)
|
||||
{
|
||||
WRITE64BE((char *)p, n);
|
||||
|
@ -2049,7 +2049,7 @@ _PyMem_DebugRawFree(void *ctx, void *p)
|
|||
api->alloc.free(api->alloc.ctx, q);
|
||||
}
|
||||
|
||||
static noasan void *
|
||||
static dontasan void *
|
||||
_PyMem_DebugRawRealloc(void *ctx, void *p, size_t nbytes)
|
||||
{
|
||||
_Static_assert(sizeof(size_t) == 8, "");
|
||||
|
@ -2138,7 +2138,7 @@ _PyMem_DebugRealloc(void *ctx, void *ptr, size_t nbytes)
|
|||
* and call Py_FatalError to kill the program.
|
||||
* The API id, is also checked.
|
||||
*/
|
||||
static noasan void
|
||||
static dontasan void
|
||||
_PyMem_DebugCheckAddress(char api, const void *p)
|
||||
{
|
||||
const uint8_t *q = (const uint8_t *)p;
|
||||
|
@ -2191,7 +2191,7 @@ error:
|
|||
}
|
||||
|
||||
/* Display info to stderr about the memory block at p. */
|
||||
static noasan void
|
||||
static dontasan void
|
||||
_PyObject_DebugDumpAddress(const void *p)
|
||||
{
|
||||
const uint8_t *q = (const uint8_t *)p;
|
||||
|
|
4
third_party/python/Python/pystate.c
vendored
4
third_party/python/Python/pystate.c
vendored
|
@ -4,6 +4,7 @@
|
|||
│ Python 3 │
|
||||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "third_party/python/Include/pystate.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/pushpop.internal.h"
|
||||
#include "libc/runtime/dlfcn.h"
|
||||
|
@ -15,11 +16,10 @@
|
|||
#include "third_party/python/Include/pydebug.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymem.h"
|
||||
#include "third_party/python/Include/pystate.h"
|
||||
/* clang-format off */
|
||||
|
||||
#if defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_UNDEFINED__)
|
||||
STATIC_YOINK("__die"); /* to guarantee backtraces */
|
||||
__static_yoink("__die"); /* to guarantee backtraces */
|
||||
#endif
|
||||
|
||||
/* Thread and interpreter state structures and their interfaces */
|
||||
|
|
2
third_party/python/launch.c
vendored
2
third_party/python/launch.c
vendored
|
@ -41,7 +41,7 @@
|
|||
|
||||
#define USE_COSMO_CRASH MODE_DBG + 0
|
||||
|
||||
STATIC_YOINK("zipos");
|
||||
__static_yoink("zipos");
|
||||
PYTHON_YOINK("_bootlocale");
|
||||
PYTHON_YOINK("_locale");
|
||||
PYTHON_YOINK("encodings.aliases");
|
||||
|
|
2
third_party/python/pycomp.c
vendored
2
third_party/python/pycomp.c
vendored
|
@ -44,7 +44,7 @@
|
|||
#include "tool/build/lib/stripcomponents.h"
|
||||
/* clang-format off */
|
||||
|
||||
STATIC_YOINK("_PyUnicode_GetCode");
|
||||
__static_yoink("_PyUnicode_GetCode");
|
||||
|
||||
#define MANUAL "\
|
||||
SYNOPSIS\n\
|
||||
|
|
2
third_party/python/pyobj.c
vendored
2
third_party/python/pyobj.c
vendored
|
@ -64,7 +64,7 @@
|
|||
#include "tool/build/lib/stripcomponents.h"
|
||||
/* clang-format off */
|
||||
|
||||
STATIC_YOINK("_PyUnicode_GetCode");
|
||||
__static_yoink("_PyUnicode_GetCode");
|
||||
|
||||
#define MANUAL "\
|
||||
SYNOPSIS\n\
|
||||
|
|
98
third_party/python/python.c
vendored
98
third_party/python/python.c
vendored
|
@ -137,58 +137,58 @@ PYTHON_YOINK("encodings.utf_7");
|
|||
|
||||
#ifndef TINY
|
||||
PYTHON_YOINK("pydoc_data.topics");
|
||||
STATIC_YOINK(".python/pydoc_data/_pydoc.css");
|
||||
__static_yoink(".python/pydoc_data/_pydoc.css");
|
||||
#endif
|
||||
|
||||
/* todo(jart): delete nonessential yoinks */
|
||||
|
||||
STATIC_YOINK("_PyImport_Inittab__bisect");
|
||||
STATIC_YOINK("_PyImport_Inittab__codecs_cn");
|
||||
STATIC_YOINK("_PyImport_Inittab__codecs_hk");
|
||||
STATIC_YOINK("_PyImport_Inittab__codecs_iso2022");
|
||||
STATIC_YOINK("_PyImport_Inittab__codecs_jp");
|
||||
STATIC_YOINK("_PyImport_Inittab__codecs_kr");
|
||||
STATIC_YOINK("_PyImport_Inittab__codecs_tw");
|
||||
STATIC_YOINK("_PyImport_Inittab__csv");
|
||||
STATIC_YOINK("_PyImport_Inittab__datetime");
|
||||
STATIC_YOINK("_PyImport_Inittab__decimal");
|
||||
STATIC_YOINK("_PyImport_Inittab__elementtree");
|
||||
STATIC_YOINK("_PyImport_Inittab__json");
|
||||
STATIC_YOINK("_PyImport_Inittab__lsprof");
|
||||
STATIC_YOINK("_PyImport_Inittab__multibytecodec");
|
||||
STATIC_YOINK("_PyImport_Inittab__multiprocessing");
|
||||
STATIC_YOINK("_PyImport_Inittab__opcode");
|
||||
STATIC_YOINK("_PyImport_Inittab__pickle");
|
||||
STATIC_YOINK("_PyImport_Inittab__posixsubprocess");
|
||||
STATIC_YOINK("_PyImport_Inittab__random");
|
||||
STATIC_YOINK("_PyImport_Inittab__socket");
|
||||
STATIC_YOINK("_PyImport_Inittab__sqlite3");
|
||||
STATIC_YOINK("_PyImport_Inittab__stat");
|
||||
STATIC_YOINK("_PyImport_Inittab__struct");
|
||||
STATIC_YOINK("_PyImport_Inittab__symtable");
|
||||
STATIC_YOINK("_PyImport_Inittab__testcapi");
|
||||
STATIC_YOINK("_PyImport_Inittab__tracemalloc");
|
||||
STATIC_YOINK("_PyImport_Inittab_array");
|
||||
STATIC_YOINK("_PyImport_Inittab_atexit");
|
||||
STATIC_YOINK("_PyImport_Inittab_audioop");
|
||||
STATIC_YOINK("_PyImport_Inittab_binascii");
|
||||
STATIC_YOINK("_PyImport_Inittab_cmath");
|
||||
STATIC_YOINK("_PyImport_Inittab_faulthandler");
|
||||
STATIC_YOINK("_PyImport_Inittab_fcntl");
|
||||
STATIC_YOINK("_PyImport_Inittab_fpectl");
|
||||
STATIC_YOINK("_PyImport_Inittab_grp");
|
||||
STATIC_YOINK("_PyImport_Inittab_math");
|
||||
STATIC_YOINK("_PyImport_Inittab_mmap");
|
||||
STATIC_YOINK("_PyImport_Inittab_parser");
|
||||
STATIC_YOINK("_PyImport_Inittab_pwd");
|
||||
STATIC_YOINK("_PyImport_Inittab_pyexpat");
|
||||
STATIC_YOINK("_PyImport_Inittab_resource");
|
||||
STATIC_YOINK("_PyImport_Inittab_select");
|
||||
STATIC_YOINK("_PyImport_Inittab_syslog");
|
||||
STATIC_YOINK("_PyImport_Inittab_termios");
|
||||
STATIC_YOINK("_PyImport_Inittab_time");
|
||||
STATIC_YOINK("_PyImport_Inittab_unicodedata");
|
||||
STATIC_YOINK("_PyImport_Inittab_zipimport");
|
||||
__static_yoink("_PyImport_Inittab__bisect");
|
||||
__static_yoink("_PyImport_Inittab__codecs_cn");
|
||||
__static_yoink("_PyImport_Inittab__codecs_hk");
|
||||
__static_yoink("_PyImport_Inittab__codecs_iso2022");
|
||||
__static_yoink("_PyImport_Inittab__codecs_jp");
|
||||
__static_yoink("_PyImport_Inittab__codecs_kr");
|
||||
__static_yoink("_PyImport_Inittab__codecs_tw");
|
||||
__static_yoink("_PyImport_Inittab__csv");
|
||||
__static_yoink("_PyImport_Inittab__datetime");
|
||||
__static_yoink("_PyImport_Inittab__decimal");
|
||||
__static_yoink("_PyImport_Inittab__elementtree");
|
||||
__static_yoink("_PyImport_Inittab__json");
|
||||
__static_yoink("_PyImport_Inittab__lsprof");
|
||||
__static_yoink("_PyImport_Inittab__multibytecodec");
|
||||
__static_yoink("_PyImport_Inittab__multiprocessing");
|
||||
__static_yoink("_PyImport_Inittab__opcode");
|
||||
__static_yoink("_PyImport_Inittab__pickle");
|
||||
__static_yoink("_PyImport_Inittab__posixsubprocess");
|
||||
__static_yoink("_PyImport_Inittab__random");
|
||||
__static_yoink("_PyImport_Inittab__socket");
|
||||
__static_yoink("_PyImport_Inittab__sqlite3");
|
||||
__static_yoink("_PyImport_Inittab__stat");
|
||||
__static_yoink("_PyImport_Inittab__struct");
|
||||
__static_yoink("_PyImport_Inittab__symtable");
|
||||
__static_yoink("_PyImport_Inittab__testcapi");
|
||||
__static_yoink("_PyImport_Inittab__tracemalloc");
|
||||
__static_yoink("_PyImport_Inittab_array");
|
||||
__static_yoink("_PyImport_Inittab_atexit");
|
||||
__static_yoink("_PyImport_Inittab_audioop");
|
||||
__static_yoink("_PyImport_Inittab_binascii");
|
||||
__static_yoink("_PyImport_Inittab_cmath");
|
||||
__static_yoink("_PyImport_Inittab_faulthandler");
|
||||
__static_yoink("_PyImport_Inittab_fcntl");
|
||||
__static_yoink("_PyImport_Inittab_fpectl");
|
||||
__static_yoink("_PyImport_Inittab_grp");
|
||||
__static_yoink("_PyImport_Inittab_math");
|
||||
__static_yoink("_PyImport_Inittab_mmap");
|
||||
__static_yoink("_PyImport_Inittab_parser");
|
||||
__static_yoink("_PyImport_Inittab_pwd");
|
||||
__static_yoink("_PyImport_Inittab_pyexpat");
|
||||
__static_yoink("_PyImport_Inittab_resource");
|
||||
__static_yoink("_PyImport_Inittab_select");
|
||||
__static_yoink("_PyImport_Inittab_syslog");
|
||||
__static_yoink("_PyImport_Inittab_termios");
|
||||
__static_yoink("_PyImport_Inittab_time");
|
||||
__static_yoink("_PyImport_Inittab_unicodedata");
|
||||
__static_yoink("_PyImport_Inittab_zipimport");
|
||||
|
||||
PYTHON_YOINK("__future__");
|
||||
PYTHON_YOINK("_bootlocale");
|
||||
|
@ -397,7 +397,7 @@ PYTHON_YOINK("email.parser");
|
|||
PYTHON_YOINK("email.policy");
|
||||
PYTHON_YOINK("email.quoprimime");
|
||||
PYTHON_YOINK("email.utils");
|
||||
STATIC_YOINK(".python/email/architecture.rst");
|
||||
__static_yoink(".python/email/architecture.rst");
|
||||
|
||||
PYTHON_YOINK("importlib");
|
||||
PYTHON_YOINK("importlib.abc");
|
||||
|
|
4
third_party/python/runpythonmodule.c
vendored
4
third_party/python/runpythonmodule.c
vendored
|
@ -54,8 +54,8 @@
|
|||
|
||||
STATIC_STACK_SIZE(0x100000);
|
||||
|
||||
STATIC_YOINK("__die");
|
||||
STATIC_YOINK("zipos");
|
||||
__static_yoink("__die");
|
||||
__static_yoink("zipos");
|
||||
|
||||
PYTHON_YOINK("cosmo");
|
||||
PYTHON_YOINK("_locale");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue