Implement tree-shaking for Python sources

This commit is contained in:
Justine Tunney 2021-09-05 01:20:03 -07:00
parent 81287b7ec0
commit 44c87b83ff
110 changed files with 899 additions and 1922 deletions

View file

@ -275,7 +275,6 @@ PyObject * _PyErr_FormatFromCause(
);
#endif
#ifdef MS_WINDOWS
PyObject * PyErr_SetFromWindowsErrWithFilename(
int ierr,
const char *filename /* decoded from the filesystem encoding */
@ -302,7 +301,6 @@ PyObject * PyErr_SetExcFromWindowsErrWithUnicodeFilename(
PyObject *,int, const Py_UNICODE *);
#endif
PyObject * PyErr_SetExcFromWindowsErr(PyObject *, int);
#endif /* MS_WINDOWS */
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
PyObject * PyErr_SetImportErrorSubclass(PyObject *, PyObject *,

View file

@ -1,10 +1,15 @@
#ifndef COSMOPOLITAN_THIRD_PARTY_PYTHON_INCLUDE_YOINK_H_
#define COSMOPOLITAN_THIRD_PARTY_PYTHON_INCLUDE_YOINK_H_
#include "libc/dce.h"
#define PYTHON_YOINK(s) \
__asm__(".section .yoink\n\t" \
"nopl\t\"py:" s "\"\n\t" \
#define PYTHON_YOINK(s) \
__asm__(".section .yoink\n\t" \
"nopl\t\"pyc:" s "\"\n\t" \
".previous")
#define PYTHON_PROVIDE(s) \
__asm__(".section .yoink\n" \
"\"pyc:" s "\":\n\t" \
".globl\t\"pyc:" s "\"\n\t" \
".previous")
#endif /* COSMOPOLITAN_THIRD_PARTY_PYTHON_INCLUDE_YOINK_H_ */