Skip to content

Commit

Permalink
Fix regression with Python linker eaxmples
Browse files Browse the repository at this point in the history
We can once again create 2mb statically-linked Python binaries:

    $ make -j8 m=tiny o/tiny/examples/pyapp/pyapp.com
    $ ls -hal o/tiny/examples/pyapp/pyapp.com
    -rwxr-xr-x 1 jart jart 2.1M May  1 14:04 o/tiny/examples/pyapp/pyapp.com
    $ o/tiny/examples/pyapp/pyapp.com
    cosmopolitan is cool!

The regression was caused by Python thread support in b15f9eb
  • Loading branch information
jart committed May 1, 2023
1 parent fc82f77 commit 909212b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 0 additions & 5 deletions third_party/python/Modules/_threadmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1519,8 +1519,3 @@ PyInit__thread(void)
PyThread_init_thread();
return m;
}

_Section(".rodata.pytab.1") const struct _inittab _PyImport_Inittab__thread = {
"_thread",
PyInit__thread,
};
2 changes: 2 additions & 0 deletions third_party/python/Modules/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ PyObject *PyInit__ast(void);
PyObject *PyInit_gc(void);
PyObject *_PyWarnings_Init(void);
PyObject *PyInit__string(void);
PyObject *PyInit__thread(void);

_Alignas(16) _Section(".rodata.pytab.0") const struct _inittab _PyImport_Inittab[0];
_Alignas(16) _Section(".rodata.pytab.2") const struct _inittab _PyImport_Inittab2[] = {
{"posix", PyInit_posix},
{"_codecs", PyInit__codecs},
{"itertools", PyInit_itertools},
{"_io", PyInit__io},
{"_thread", PyInit__thread},
{"_weakref", PyInit__weakref},
{"marshal", PyMarshal_Init},
{"_imp", PyInit_imp},
Expand Down

0 comments on commit 909212b

Please sign in to comment.