2020-06-15 14:18:57 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_RUNTIME_INTERNAL_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_RUNTIME_INTERNAL_H_
|
2020-08-25 11:23:25 +00:00
|
|
|
#ifndef __STRICT_ANSI__
|
2020-06-15 14:18:57 +00:00
|
|
|
#include "libc/dce.h"
|
2020-11-25 16:19:00 +00:00
|
|
|
#include "libc/elf/struct/ehdr.h"
|
2020-12-27 15:02:35 +00:00
|
|
|
#include "libc/runtime/ezmap.internal.h"
|
2020-06-15 14:18:57 +00:00
|
|
|
#include "libc/runtime/runtime.h"
|
|
|
|
|
|
|
|
#define STACK_CEIL 0x700000000000ul
|
|
|
|
#define STACK_SIZE FRAMESIZE
|
|
|
|
|
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
|
2022-04-20 16:56:53 +00:00
|
|
|
extern int __pid;
|
2022-04-12 12:20:17 +00:00
|
|
|
extern uint32_t __ntconsolemode[3];
|
2021-02-27 20:53:51 +00:00
|
|
|
extern const char v_ntsubsystem[] __attribute__((__weak__));
|
|
|
|
extern const uintptr_t __fini_array_end[] __attribute__((__weak__));
|
|
|
|
extern const uintptr_t __fini_array_start[] __attribute__((__weak__));
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2023-05-19 02:05:08 +00:00
|
|
|
extern unsigned char _tdata_start[] __attribute__((__weak__));
|
|
|
|
extern unsigned char _tdata_end[] __attribute__((__weak__));
|
|
|
|
extern unsigned char _tdata_size[] __attribute__((__weak__));
|
|
|
|
extern unsigned char _tbss_start[] __attribute__((__weak__));
|
|
|
|
extern unsigned char _tbss_end[] __attribute__((__weak__));
|
|
|
|
extern unsigned char _tbss_size[] __attribute__((__weak__));
|
|
|
|
extern unsigned char _tbss_offset[] __attribute__((__weak__));
|
|
|
|
extern unsigned char _tls_size[] __attribute__((__weak__));
|
|
|
|
extern unsigned char _tls_content[] __attribute__((__weak__));
|
2022-05-27 20:25:46 +00:00
|
|
|
|
2022-11-08 19:39:50 +00:00
|
|
|
void _init(void) _Hide;
|
2022-11-02 05:36:03 +00:00
|
|
|
void __morph_tls(void);
|
2022-07-19 05:26:11 +00:00
|
|
|
void __enable_tls(void);
|
2022-11-08 19:39:50 +00:00
|
|
|
void __enable_threads(void) _Hide;
|
|
|
|
void *__cxa_finalize(void *) _Hide;
|
2020-12-05 20:20:41 +00:00
|
|
|
void __stack_chk_fail(void) wontreturn relegated;
|
2022-11-08 19:39:50 +00:00
|
|
|
void __stack_chk_fail_local(void) wontreturn relegated _Hide;
|
2023-05-12 02:56:33 +00:00
|
|
|
void __asan_init(int, char **, char **, intptr_t *) _Hide;
|
2022-11-08 19:39:50 +00:00
|
|
|
void _jmpstack(void *, void *, ...) _Hide wontreturn;
|
|
|
|
long _setstack(void *, void *, ...) _Hide;
|
2022-04-15 06:39:48 +00:00
|
|
|
int GetDosArgv(const char16_t *, char *, size_t, char **, size_t);
|
2022-11-08 19:39:50 +00:00
|
|
|
Elf64_Ehdr *MapElfRead(const char *, struct MappedFile *) _Hide;
|
2022-04-15 06:39:48 +00:00
|
|
|
int GetDosEnviron(const char16_t *, char *, size_t, char **, size_t);
|
Introduce --strace flag for system call tracing
This is similar to the --ftrace (c function call trace) flag, except
it's less noisy since it only logs system calls to stderr. Having this
flag is valuable because (1) system call tracing tells us a lot about
the behavior of complex programs and (2) it's usually very hard to get
system call tracing on various operating systems, e.g. strace, ktrace,
dtruss, truss, nttrace, etc. Especially on Apple platforms where even
with the special boot trick, debuggers still aren't guaranteed to work.
make -j8 o//examples
o//examples/hello.com --strace
This is enabled by default in MODE=, MODE=opt, and MODE=dbg. In MODE=dbg
extra information will be printed.
make -j8 MODE=dbg o/dbg/examples
o/dbg/examples/hello.com --strace |& less
This change also changes:
- Rename IsText() → _istext()
- Rename IsUtf8() → _isutf8()
- Fix madvise() on Windows NT
- Fix empty string case of inet_ntop()
- vfork() wrapper now saves and restores errno
- Update xsigaction() to yoink syscall support
2022-03-19 01:07:28 +00:00
|
|
|
bool __intercept_flag(int *, char *[], const char *);
|
2022-11-08 19:39:50 +00:00
|
|
|
int sys_mprotect_nt(void *, size_t, int) _Hide;
|
2022-05-29 15:14:55 +00:00
|
|
|
int __inflate(void *, size_t, const void *, size_t);
|
2023-05-19 02:05:08 +00:00
|
|
|
noasan void *_Mmap(void *, size_t, int, int, int, int64_t) _Hide;
|
2023-03-06 07:52:17 +00:00
|
|
|
noasan int _Munmap(char *, size_t) _Hide;
|
2023-05-10 08:10:28 +00:00
|
|
|
void InitializeFileDescriptors(void);
|
2023-05-14 16:32:15 +00:00
|
|
|
void __on_arithmetic_overflow(void);
|
2020-06-15 14:18:57 +00:00
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
2020-08-25 11:23:25 +00:00
|
|
|
#endif /* ANSI */
|
2020-06-15 14:18:57 +00:00
|
|
|
#endif /* COSMOPOLITAN_LIBC_RUNTIME_INTERNAL_H_ */
|