Exclude strace from MODE=tiny builds

This change gets o/tinylinux/examples/hello2.com back down to 8kb in
size which had been unintentionally bloated to 40kb in recent months

See #965
This commit is contained in:
Justine Tunney 2023-11-29 03:45:54 -08:00
parent b7e1dc81c2
commit 2b960bb249
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
18 changed files with 46 additions and 33 deletions

View file

@ -40,7 +40,7 @@ cosmo: push %rbp
mov %rdx,%r14
mov %rcx,%r15
#ifdef SYSDEBUG
#if SYSDEBUG
call __strace_init
mov %eax,%r12d
#endif /* SYSDEBUG */

View file

@ -163,7 +163,7 @@ wontreturn textstartup void cosmo(long *sp, struct Syslib *m1) {
_init();
// initialize program
#ifdef SYSDEBUG
#if SYSDEBUG
argc = __strace_init(argc, argv, envp, auxv);
#endif
for (init_f **fp = __init_array_end; fp-- > __init_array_start;) {

View file

@ -57,7 +57,7 @@ int __untrack_memory(struct MemoryIntervals *, int, int,
void (*)(struct MemoryIntervals *, int, int));
void __release_memory_nt(struct MemoryIntervals *, int, int);
int __untrack_memories(void *, size_t);
size_t __get_memtrack_size(struct MemoryIntervals *);
size_t __get_memtrack_size(struct MemoryIntervals *) nosideeffect;
#ifdef __x86_64__
/*

View file

@ -466,7 +466,7 @@ inline void *__mmap_unlocked(void *addr, size_t size, int prot, int flags,
*/
void *mmap(void *addr, size_t size, int prot, int flags, int fd, int64_t off) {
void *res;
#ifdef SYSDEBUG
#if SYSDEBUG
size_t toto = 0;
#if _KERNTRACE || _NTTRACE
if (IsWindows()) {
@ -487,9 +487,11 @@ void *mmap(void *addr, size_t size, int prot, int flags, int fd, int64_t off) {
toto = __strace > 0 ? __get_memtrack_size(&_mmi) : 0;
#endif
__mmi_unlock();
#if SYSDEBUG
STRACE("mmap(%p, %'zu, %s, %s, %d, %'ld) → %p% m (%'zu bytes total)", addr,
size, DescribeProtFlags(prot), DescribeMapFlags(flags), fd, off, res,
toto);
#endif
return res;
}

View file

@ -153,9 +153,7 @@ int munmap(void *p, size_t n) {
int rc;
__mmi_lock();
rc = __munmap_unlocked(p, n);
#if SYSDEBUG
size_t toto = __strace > 0 ? __get_memtrack_size(&_mmi) : 0;
#endif
__mmi_unlock();
STRACE("munmap(%.12p, %'zu) → %d% m (%'zu bytes total)", p, n, rc, toto);
return rc;

View file

@ -19,7 +19,6 @@
#include "libc/assert.h"
#include "libc/calls/internal.h"
#include "libc/calls/syscall_support-nt.internal.h"
#include "libc/serialize.h"
#include "libc/intrin/nomultics.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/limits.h"
@ -41,6 +40,7 @@
#include "libc/runtime/runtime.h"
#include "libc/runtime/stack.h"
#include "libc/runtime/winargs.internal.h"
#include "libc/serialize.h"
#include "libc/sock/internal.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/prot.h"
@ -271,7 +271,7 @@ abi int64_t WinMain(int64_t hInstance, int64_t hPrevInstance,
__umask = 077;
__pid = __imp_GetCurrentProcessId();
cmdline = MyCommandLine();
#ifdef SYSDEBUG
#if SYSDEBUG
// sloppy flag-only check for early initialization
if (StrStr(cmdline, u"--strace")) ++__strace;
#endif