mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Decentralize Python native module linkage
We can now link even smaller Python binaries. For example, the hello.com program in the Python build directory is a compiled linked executable of hello.py which just prints hello world. Using decentralized sections, we can make that binary 1.9mb in size (noting that python.com is 6.3 megs!) This works for nontrivial programs too. For example, say we want an APE binary that's equivalent to python.com -m http.server. Our makefile now builds such a binary using the new launcher and it's only 3.2mb in size since Python sources get turned into ELF objects, which tell our linker that we need things like native hashing algorithm code.
This commit is contained in:
parent
dfa0359b50
commit
559b024e1d
129 changed files with 2798 additions and 13514 deletions
29
libc/str/blake2.h
Normal file
29
libc/str/blake2.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_STR_BLAKE2_H_
|
||||
#define COSMOPOLITAN_LIBC_STR_BLAKE2_H_
|
||||
|
||||
#define BLAKE2B256_DIGEST_LENGTH 32
|
||||
#define BLAKE2B_CBLOCK 128
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct Blake2b {
|
||||
uint64_t h[8];
|
||||
uint64_t t_low;
|
||||
uint64_t t_high;
|
||||
union {
|
||||
uint8_t bytes[BLAKE2B_CBLOCK];
|
||||
uint64_t words[16];
|
||||
} block;
|
||||
size_t block_used;
|
||||
};
|
||||
|
||||
int BLAKE2B256_Init(struct Blake2b *);
|
||||
int BLAKE2B256_Update(struct Blake2b *, const void *, size_t);
|
||||
int BLAKE2B256_Process(struct Blake2b *, const uint64_t[BLAKE2B_CBLOCK / 8]);
|
||||
int BLAKE2B256_Final(struct Blake2b *, uint8_t[BLAKE2B256_DIGEST_LENGTH]);
|
||||
int BLAKE2B256(const void *, size_t, uint8_t[BLAKE2B256_DIGEST_LENGTH]);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_STR_BLAKE2_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue