mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Bring MODE=tiny binary sizes down to 20kb minimum
aarch64 binaries start at 4kb.
This commit is contained in:
parent
5f57fc1f59
commit
f312f706f4
8 changed files with 27 additions and 10 deletions
|
@ -1941,6 +1941,7 @@ __bss_start:
|
|||
__bss_end:
|
||||
.previous
|
||||
|
||||
#if !IsTiny()
|
||||
#ifdef APE_IS_SHELL_SCRIPT
|
||||
|
||||
.section .blink,"a",@progbits
|
||||
|
@ -1960,6 +1961,7 @@ blink_darwin_arm64_size = . - blink_darwin_arm64
|
|||
.previous
|
||||
|
||||
#endif /* APE_IS_SHELL_SCRIPT */
|
||||
#endif /* !IsTiny() */
|
||||
|
||||
.end
|
||||
|
|
@ -48,6 +48,8 @@
|
|||
#include "libc/thread/tls.h"
|
||||
#include "third_party/dlmalloc/dlmalloc.h"
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
STATIC_YOINK("_init_asan");
|
||||
|
||||
#if IsModeDbg()
|
||||
|
@ -1497,3 +1499,5 @@ __attribute__((__constructor__)) void __asan_init(int argc, char **argv,
|
|||
STRACE("/_/ \\_\\____/_/ \\_\\_| \\_|");
|
||||
STRACE("cosmopolitan memory safety module initialized");
|
||||
}
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "libc/intrin/extend.internal.h"
|
||||
#include "libc/intrin/pushpop.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/nt/runtime.h"
|
||||
#include "libc/runtime/memtrack.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
|
@ -34,6 +35,7 @@ STATIC_YOINK("_init_g_fds");
|
|||
#endif
|
||||
|
||||
struct Fds g_fds;
|
||||
static struct Fd g_fds_static[8];
|
||||
|
||||
static textwindows dontinline void SetupWinStd(struct Fds *fds, int i, int x) {
|
||||
int64_t h;
|
||||
|
@ -50,11 +52,17 @@ textstartup void InitializeFileDescriptors(void) {
|
|||
pthread_atfork(_weaken(__fds_lock), _weaken(__fds_unlock),
|
||||
_weaken(__fds_funlock));
|
||||
fds = VEIL("r", &g_fds);
|
||||
fds->p = fds->e = (void *)kMemtrackFdsStart;
|
||||
fds->n = 4;
|
||||
atomic_store_explicit(&fds->f, 3, memory_order_relaxed);
|
||||
fds->e = _extend(fds->p, fds->n * sizeof(*fds->p), fds->e, MAP_PRIVATE,
|
||||
kMemtrackFdsStart + kMemtrackFdsSize);
|
||||
if (_weaken(_extend)) {
|
||||
fds->p = fds->e = (void *)kMemtrackFdsStart;
|
||||
fds->e =
|
||||
_weaken(_extend)(fds->p, fds->n * sizeof(*fds->p), fds->e, MAP_PRIVATE,
|
||||
kMemtrackFdsStart + kMemtrackFdsSize);
|
||||
} else {
|
||||
fds->p = g_fds_static;
|
||||
fds->e = g_fds_static + ARRAYLEN(g_fds_static);
|
||||
}
|
||||
if (IsMetal()) {
|
||||
extern const char vga_console[];
|
||||
fds->f = 3;
|
||||
|
|
|
@ -162,7 +162,7 @@ extern const long __NR_setfsgid;
|
|||
extern const long __NR_capget;
|
||||
extern const long __NR_capset;
|
||||
extern const long __NR_sigtimedwait;
|
||||
extern const long __NR_rt_sigqueueinfo;
|
||||
extern const long __NR_sigqueueinfo;
|
||||
extern const long __NR_personality;
|
||||
extern const long __NR_ustat;
|
||||
extern const long __NR_sysfs;
|
||||
|
@ -285,7 +285,7 @@ extern const long __NR_epoll_pwait;
|
|||
extern const long __NR_epoll_create1;
|
||||
extern const long __NR_perf_event_open;
|
||||
extern const long __NR_inotify_init1;
|
||||
extern const long __NR_rt_tgsigqueueinfo;
|
||||
extern const long __NR_tgsigqueueinfo;
|
||||
extern const long __NR_signalfd;
|
||||
extern const long __NR_signalfd4;
|
||||
extern const long __NR_eventfd;
|
||||
|
@ -498,7 +498,7 @@ COSMOPOLITAN_C_END_
|
|||
#define __NR_capget SYMBOLIC(__NR_capget)
|
||||
#define __NR_capset SYMBOLIC(__NR_capset)
|
||||
#define __NR_sigtimedwait SYMBOLIC(__NR_sigtimedwait)
|
||||
#define __NR_rt_sigqueueinfo SYMBOLIC(__NR_rt_sigqueueinfo)
|
||||
#define __NR_sigqueueinfo SYMBOLIC(__NR_sigqueueinfo)
|
||||
#define __NR_personality SYMBOLIC(__NR_personality)
|
||||
#define __NR_ustat SYMBOLIC(__NR_ustat)
|
||||
#define __NR_sysfs SYMBOLIC(__NR_sysfs)
|
||||
|
@ -621,7 +621,7 @@ COSMOPOLITAN_C_END_
|
|||
#define __NR_epoll_create1 SYMBOLIC(__NR_epoll_create1)
|
||||
#define __NR_perf_event_open SYMBOLIC(__NR_perf_event_open)
|
||||
#define __NR_inotify_init1 SYMBOLIC(__NR_inotify_init1)
|
||||
#define __NR_rt_tgsigqueueinfo SYMBOLIC(__NR_rt_tgsigqueueinfo)
|
||||
#define __NR_tgsigqueueinfo SYMBOLIC(__NR_tgsigqueueinfo)
|
||||
#define __NR_signalfd SYMBOLIC(__NR_signalfd)
|
||||
#define __NR_signalfd4 SYMBOLIC(__NR_signalfd4)
|
||||
#define __NR_eventfd SYMBOLIC(__NR_eventfd)
|
||||
|
|
|
@ -20,6 +20,7 @@ TEST_LIBC_CALLS_BINS = \
|
|||
$(TEST_LIBC_CALLS_COMS:%=%.dbg) \
|
||||
o/$(MODE)/test/libc/calls/life-nomod.com \
|
||||
o/$(MODE)/test/libc/calls/life-classic.com \
|
||||
o/$(MODE)/test/libc/calls/zipread.com.dbg \
|
||||
o/$(MODE)/test/libc/calls/zipread.com
|
||||
|
||||
TEST_LIBC_CALLS_TESTS = \
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "tool/viz/lib/bilinearscale.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "tool/viz/lib/bilinearscale.h"
|
||||
#include "tool/viz/lib/graphic.h"
|
||||
|
||||
TEST(BilinearScale, testWindmill_1x1_to_2x2) {
|
||||
|
|
|
@ -100,7 +100,7 @@ static const struct Syscall {
|
|||
{&__NR_sigprocmask, "rt_sigprocmask", 4, 4, INT, {INT, SIGSET, SIGSET, LONG}},
|
||||
{&__NR_sigpending, "rt_sigpending", 2, 2, INT, {SIGSET, LONG}},
|
||||
{&__NR_sigsuspend, "rt_sigsuspend", 2, 2, INT, {SIGSET, LONG}},
|
||||
{&__NR_rt_sigqueueinfo, "rt_sigqueueinfo", 6, 6},
|
||||
{&__NR_sigqueueinfo, "rt_sigqueueinfo", 6, 6},
|
||||
{&__NR_ioctl, "ioctl", 3, 3, INT, {INT, ULONG, ULONG}},
|
||||
{&__NR_pread, "pread64", 4, 1, LONG, {INT, BUF, ULONG, ULONG}},
|
||||
{&__NR_pwrite, "pwrite64", 4, 4, LONG, {INT, BUF, ULONG, ULONG}},
|
||||
|
@ -361,7 +361,7 @@ static const struct Syscall {
|
|||
{&__NR_epoll_create1, "epoll_create1", 6, 6},
|
||||
{&__NR_perf_event_open, "perf_event_open", 6, 6},
|
||||
{&__NR_inotify_init1, "inotify_init1", 6, 6},
|
||||
{&__NR_rt_tgsigqueueinfo, "rt_tgsigqueueinfo", 6, 6},
|
||||
{&__NR_tgsigqueueinfo, "rt_tgsigqueueinfo", 6, 6},
|
||||
{&__NR_signalfd, "signalfd", 6, 6},
|
||||
{&__NR_signalfd4, "signalfd4", 6, 6},
|
||||
{&__NR_eventfd, "eventfd", 6, 6},
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "dsp/tty/quant.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
|
|
Loading…
Reference in a new issue