mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-12 01:08:00 +00:00
Improve cosmocc toolchain
- Decouple zlib from libc - Add some underscores to mostly internal names
This commit is contained in:
parent
713d4424c6
commit
ba180e754d
25 changed files with 128 additions and 42 deletions
3
Makefile
3
Makefile
|
@ -121,6 +121,7 @@ include libc/tinymath/tinymath.mk # │ You can issue raw system calls
|
||||||
include third_party/compiler_rt/compiler_rt.mk # │
|
include third_party/compiler_rt/compiler_rt.mk # │
|
||||||
include libc/str/str.mk # │
|
include libc/str/str.mk # │
|
||||||
include third_party/xed/xed.mk # │
|
include third_party/xed/xed.mk # │
|
||||||
|
include third_party/puff/puff.mk # │
|
||||||
include third_party/zlib/zlib.mk # │
|
include third_party/zlib/zlib.mk # │
|
||||||
include third_party/double-conversion/dc.mk # │
|
include third_party/double-conversion/dc.mk # │
|
||||||
include libc/elf/elf.mk # │
|
include libc/elf/elf.mk # │
|
||||||
|
@ -309,7 +310,6 @@ COSMOPOLITAN_OBJECTS = \
|
||||||
LIBC_LOG \
|
LIBC_LOG \
|
||||||
LIBC_TIME \
|
LIBC_TIME \
|
||||||
LIBC_ZIPOS \
|
LIBC_ZIPOS \
|
||||||
THIRD_PARTY_ZLIB \
|
|
||||||
THIRD_PARTY_MUSL \
|
THIRD_PARTY_MUSL \
|
||||||
LIBC_STDIO \
|
LIBC_STDIO \
|
||||||
THIRD_PARTY_GDTOA \
|
THIRD_PARTY_GDTOA \
|
||||||
|
@ -335,6 +335,7 @@ COSMOPOLITAN_OBJECTS = \
|
||||||
LIBC_NT_ADVAPI32 \
|
LIBC_NT_ADVAPI32 \
|
||||||
LIBC_NT_SYNCHRONIZATION \
|
LIBC_NT_SYNCHRONIZATION \
|
||||||
LIBC_FMT \
|
LIBC_FMT \
|
||||||
|
THIRD_PARTY_PUFF \
|
||||||
THIRD_PARTY_COMPILER_RT \
|
THIRD_PARTY_COMPILER_RT \
|
||||||
LIBC_TINYMATH \
|
LIBC_TINYMATH \
|
||||||
THIRD_PARTY_XED \
|
THIRD_PARTY_XED \
|
||||||
|
|
21
examples/getdomainname.c
Normal file
21
examples/getdomainname.c
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#if 0
|
||||||
|
/*─────────────────────────────────────────────────────────────────╗
|
||||||
|
│ To the extent possible under law, Justine Tunney has waived │
|
||||||
|
│ all copyright and related or neighboring rights to this file, │
|
||||||
|
│ as it is written in the following disclaimers: │
|
||||||
|
│ • http://unlicense.org/ │
|
||||||
|
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||||
|
╚─────────────────────────────────────────────────────────────────*/
|
||||||
|
#endif
|
||||||
|
#include "libc/calls/calls.h"
|
||||||
|
#include "libc/stdio/stdio.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
char buf[256];
|
||||||
|
if (!getdomainname(buf, sizeof(buf))) {
|
||||||
|
printf("%s\n", buf);
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
4
libc/isystem/sys/vfs.h
Normal file
4
libc/isystem/sys/vfs.h
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_VFS_H_
|
||||||
|
#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_VFS_H_
|
||||||
|
#include "libc/calls/struct/statfs.h"
|
||||||
|
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_VFS_H_ */
|
|
@ -1,4 +0,0 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_ZLIB_H_
|
|
||||||
#define COSMOPOLITAN_LIBC_ISYSTEM_ZLIB_H_
|
|
||||||
#include "third_party/zlib/zlib.h"
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_ZLIB_H_ */
|
|
|
@ -26,12 +26,12 @@
|
||||||
/**
|
/**
|
||||||
* Returns maximum number of open files.
|
* Returns maximum number of open files.
|
||||||
*/
|
*/
|
||||||
long GetMaxFd(void) {
|
long _GetMaxFd(void) {
|
||||||
int rc;
|
int rc;
|
||||||
if (IsNetbsd()) {
|
if (IsNetbsd()) {
|
||||||
if ((rc = __sys_fcntl(0, F_MAXFD, 0)) != -1) {
|
if ((rc = __sys_fcntl(0, F_MAXFD, 0)) != -1) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return GetResourceLimit(RLIMIT_NOFILE);
|
return _GetResourceLimit(RLIMIT_NOFILE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/sysv/consts/rlim.h"
|
#include "libc/sysv/consts/rlim.h"
|
||||||
|
|
||||||
long GetResourceLimit(int resource) {
|
long _GetResourceLimit(int resource) {
|
||||||
struct rlimit rl;
|
struct rlimit rl;
|
||||||
getrlimit(resource, &rl);
|
getrlimit(resource, &rl);
|
||||||
if (rl.rlim_cur == RLIM_INFINITY) return -1;
|
if (rl.rlim_cur == RLIM_INFINITY) return -1;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/x.h"
|
||||||
#include "libc/zip.h"
|
#include "libc/zip.h"
|
||||||
#include "libc/zipos/zipos.internal.h"
|
#include "libc/zipos/zipos.internal.h"
|
||||||
#include "third_party/zlib/puff.h"
|
#include "third_party/puff/puff.h"
|
||||||
|
|
||||||
static pthread_spinlock_t g_lock;
|
static pthread_spinlock_t g_lock;
|
||||||
_Hide struct SymbolTable *__symtab; // for kprintf
|
_Hide struct SymbolTable *__symtab; // for kprintf
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "third_party/zlib/puff.h"
|
#include "third_party/puff/puff.h"
|
||||||
#include "third_party/zlib/zlib.h"
|
#include "third_party/zlib/zlib.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,7 +54,7 @@ int __inflate(void *out, size_t outsize, const void *in, size_t insize) {
|
||||||
rc = rc;
|
rc = rc;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rc = puff(out, &outsize, in, &insize);
|
rc = _puff(out, &outsize, in, &insize);
|
||||||
}
|
}
|
||||||
STRACE("inflate([%#.*hhs%s], %'zu, %#.*hhs%s, %'zu) → %d", MIN(40, outsize),
|
STRACE("inflate([%#.*hhs%s], %'zu, %#.*hhs%s, %'zu) → %d", MIN(40, outsize),
|
||||||
out, outsize > 40 ? "..." : "", outsize, MIN(40, insize), in,
|
out, outsize > 40 ? "..." : "", outsize, MIN(40, insize), in,
|
||||||
|
|
|
@ -44,9 +44,9 @@ int GetDosEnviron(const char16_t *, char *, size_t, char **, size_t);
|
||||||
bool __intercept_flag(int *, char *[], const char *);
|
bool __intercept_flag(int *, char *[], const char *);
|
||||||
int sys_mprotect_nt(void *, size_t, int) _Hide;
|
int sys_mprotect_nt(void *, size_t, int) _Hide;
|
||||||
int __inflate(void *, size_t, const void *, size_t);
|
int __inflate(void *, size_t, const void *, size_t);
|
||||||
noasan void *Mmap(void *addr, size_t size, int prot, int flags, int fd,
|
noasan void *_Mmap(void *addr, size_t size, int prot, int flags, int fd,
|
||||||
int64_t off) _Hide;
|
int64_t off) _Hide;
|
||||||
noasan int Munmap(char *, size_t) _Hide;
|
noasan int _Munmap(char *, size_t) _Hide;
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
/**
|
/**
|
||||||
* Returns true if ELF executable uses dynamic loading magic.
|
* Returns true if ELF executable uses dynamic loading magic.
|
||||||
*/
|
*/
|
||||||
bool IsDynamicExecutable(const char *prog) {
|
bool _IsDynamicExecutable(const char *prog) {
|
||||||
bool res;
|
bool res;
|
||||||
Elf64_Ehdr *e;
|
Elf64_Ehdr *e;
|
||||||
Elf64_Phdr *p;
|
Elf64_Phdr *p;
|
||||||
|
|
|
@ -238,7 +238,7 @@ static textwindows dontinline noasan void *MapMemories(char *addr, size_t size,
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
noasan inline void *Mmap(void *addr, size_t size, int prot, int flags, int fd,
|
noasan inline void *_Mmap(void *addr, size_t size, int prot, int flags, int fd,
|
||||||
int64_t off) {
|
int64_t off) {
|
||||||
char *p = addr;
|
char *p = addr;
|
||||||
struct DirectMap dm;
|
struct DirectMap dm;
|
||||||
|
@ -494,7 +494,7 @@ void *mmap(void *addr, size_t size, int prot, int flags, int fd, int64_t off) {
|
||||||
#endif
|
#endif
|
||||||
__mmi_lock();
|
__mmi_lock();
|
||||||
if (!__isfdkind(fd, kFdZip)) {
|
if (!__isfdkind(fd, kFdZip)) {
|
||||||
res = Mmap(addr, size, prot, flags, fd, off);
|
res = _Mmap(addr, size, prot, flags, fd, off);
|
||||||
} else {
|
} else {
|
||||||
res = _weaken(__zipos_Mmap)(
|
res = _weaken(__zipos_Mmap)(
|
||||||
addr, size, prot, flags,
|
addr, size, prot, flags,
|
||||||
|
|
|
@ -53,7 +53,7 @@ static noasan void MunmapShadow(char *p, size_t n) {
|
||||||
// to be >1mb since we can only unmap it if it's aligned, and
|
// to be >1mb since we can only unmap it if it's aligned, and
|
||||||
// as such we poison the edges if there are any.
|
// as such we poison the edges if there are any.
|
||||||
__repstosb((void *)a, kAsanUnmapped, x - a);
|
__repstosb((void *)a, kAsanUnmapped, x - a);
|
||||||
Munmap((void *)x, y - x);
|
_Munmap((void *)x, y - x);
|
||||||
__repstosb((void *)y, kAsanUnmapped, b - y);
|
__repstosb((void *)y, kAsanUnmapped, b - y);
|
||||||
} else {
|
} else {
|
||||||
// otherwise just poison and assume reuse
|
// otherwise just poison and assume reuse
|
||||||
|
@ -113,7 +113,7 @@ static noasan void MunmapImpl(char *p, size_t n) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
noasan int Munmap(char *p, size_t n) {
|
noasan int _Munmap(char *p, size_t n) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
char poison;
|
char poison;
|
||||||
intptr_t a, b, x, y;
|
intptr_t a, b, x, y;
|
||||||
|
@ -157,7 +157,7 @@ int munmap(void *p, size_t n) {
|
||||||
int rc;
|
int rc;
|
||||||
size_t toto;
|
size_t toto;
|
||||||
__mmi_lock();
|
__mmi_lock();
|
||||||
rc = Munmap(p, n);
|
rc = _Munmap(p, n);
|
||||||
#if SYSDEBUG
|
#if SYSDEBUG
|
||||||
toto = __strace > 0 ? GetMemtrackSize(&_mmi) : 0;
|
toto = __strace > 0 ? GetMemtrackSize(&_mmi) : 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
// @return file descriptor
|
// @return file descriptor
|
||||||
// @note only works on .com binary (not .com.dbg)
|
// @note only works on .com binary (not .com.dbg)
|
||||||
// @note only supports linux, freebsd, openbsd, and netbsd
|
// @note only supports linux, freebsd, openbsd, and netbsd
|
||||||
OpenExecutable:
|
_OpenExecutable:
|
||||||
push %rbp
|
push %rbp
|
||||||
mov %rsp,%rbp
|
mov %rsp,%rbp
|
||||||
pushq __NR_open(%rip) # -0x08(%rbp)
|
pushq __NR_open(%rip) # -0x08(%rbp)
|
||||||
|
@ -198,7 +198,7 @@ OpenExecutable:
|
||||||
pop %rbx
|
pop %rbx
|
||||||
leave
|
leave
|
||||||
ret
|
ret
|
||||||
9: .endfn OpenExecutable,globl
|
9: .endfn _OpenExecutable,globl
|
||||||
|
|
||||||
.weak ape_rom_vaddr
|
.weak ape_rom_vaddr
|
||||||
.weak ape_rom_filesz
|
.weak ape_rom_filesz
|
||||||
|
|
|
@ -94,12 +94,12 @@ void _peekall(void);
|
||||||
void _savexmm(void *);
|
void _savexmm(void *);
|
||||||
void _weakfree(void *);
|
void _weakfree(void *);
|
||||||
void free_s(void *) paramsnonnull() libcesque;
|
void free_s(void *) paramsnonnull() libcesque;
|
||||||
int OpenExecutable(void);
|
int _OpenExecutable(void);
|
||||||
int ftrace_install(void);
|
int ftrace_install(void);
|
||||||
int ftrace_enabled(int);
|
int ftrace_enabled(int);
|
||||||
int strace_enabled(int);
|
int strace_enabled(int);
|
||||||
long GetResourceLimit(int);
|
long _GetResourceLimit(int);
|
||||||
long GetMaxFd(void);
|
long _GetMaxFd(void);
|
||||||
char *GetProgramExecutableName(void);
|
char *GetProgramExecutableName(void);
|
||||||
char *GetInterpreterExecutableName(char *, size_t);
|
char *GetInterpreterExecutableName(char *, size_t);
|
||||||
void __printargs(const char *);
|
void __printargs(const char *);
|
||||||
|
@ -108,7 +108,7 @@ int __arg_max(void);
|
||||||
void __print_maps(void);
|
void __print_maps(void);
|
||||||
void __warn_if_powersave(void);
|
void __warn_if_powersave(void);
|
||||||
const char *__describe_os(void);
|
const char *__describe_os(void);
|
||||||
bool IsDynamicExecutable(const char *);
|
bool _IsDynamicExecutable(const char *);
|
||||||
void _restorewintty(void);
|
void _restorewintty(void);
|
||||||
const char *GetCpuidOs(void);
|
const char *GetCpuidOs(void);
|
||||||
const char *GetCpuidEmulator(void);
|
const char *GetCpuidEmulator(void);
|
||||||
|
|
|
@ -45,7 +45,7 @@ LIBC_RUNTIME_A_DIRECTDEPS = \
|
||||||
LIBC_STUBS \
|
LIBC_STUBS \
|
||||||
LIBC_SYSV \
|
LIBC_SYSV \
|
||||||
LIBC_SYSV_CALLS \
|
LIBC_SYSV_CALLS \
|
||||||
THIRD_PARTY_ZLIB \
|
THIRD_PARTY_PUFF \
|
||||||
THIRD_PARTY_XED
|
THIRD_PARTY_XED
|
||||||
|
|
||||||
LIBC_RUNTIME_A_DEPS := \
|
LIBC_RUNTIME_A_DEPS := \
|
||||||
|
|
|
@ -41,11 +41,11 @@ long sysconf(int name) {
|
||||||
case _SC_ARG_MAX:
|
case _SC_ARG_MAX:
|
||||||
return _ARG_MAX;
|
return _ARG_MAX;
|
||||||
case _SC_CHILD_MAX:
|
case _SC_CHILD_MAX:
|
||||||
return GetResourceLimit(RLIMIT_NPROC);
|
return _GetResourceLimit(RLIMIT_NPROC);
|
||||||
case _SC_CLK_TCK:
|
case _SC_CLK_TCK:
|
||||||
return CLK_TCK;
|
return CLK_TCK;
|
||||||
case _SC_OPEN_MAX:
|
case _SC_OPEN_MAX:
|
||||||
return GetMaxFd();
|
return _GetMaxFd();
|
||||||
case _SC_PAGESIZE:
|
case _SC_PAGESIZE:
|
||||||
return FRAMESIZE;
|
return FRAMESIZE;
|
||||||
case _SC_NPROCESSORS_ONLN:
|
case _SC_NPROCESSORS_ONLN:
|
||||||
|
|
|
@ -64,7 +64,7 @@ noasan void *__zipos_Mmap(void *addr, size_t size, int prot, int flags,
|
||||||
|
|
||||||
const int tempProt = !IsXnu() ? prot | PROT_WRITE : PROT_WRITE;
|
const int tempProt = !IsXnu() ? prot | PROT_WRITE : PROT_WRITE;
|
||||||
void *outAddr =
|
void *outAddr =
|
||||||
Mmap(addr, size, tempProt, (flags & (~MAP_FILE)) | MAP_ANONYMOUS, -1, 0);
|
_Mmap(addr, size, tempProt, (flags & (~MAP_FILE)) | MAP_ANONYMOUS, -1, 0);
|
||||||
if (outAddr == MAP_FAILED) {
|
if (outAddr == MAP_FAILED) {
|
||||||
return MAP_FAILED;
|
return MAP_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ noasan void *__zipos_Mmap(void *addr, size_t size, int prot, int flags,
|
||||||
return outAddr;
|
return outAddr;
|
||||||
} while (0);
|
} while (0);
|
||||||
const int e = errno;
|
const int e = errno;
|
||||||
Munmap(outAddr, size);
|
_Munmap(outAddr, size);
|
||||||
errno = e;
|
errno = e;
|
||||||
strace_enabled(+1);
|
strace_enabled(+1);
|
||||||
return MAP_FAILED;
|
return MAP_FAILED;
|
||||||
|
|
|
@ -40,7 +40,7 @@ LIBC_ZIPOS_A_DIRECTDEPS = \
|
||||||
LIBC_STUBS \
|
LIBC_STUBS \
|
||||||
LIBC_SYSV_CALLS \
|
LIBC_SYSV_CALLS \
|
||||||
LIBC_NT_KERNEL32 \
|
LIBC_NT_KERNEL32 \
|
||||||
THIRD_PARTY_ZLIB
|
THIRD_PARTY_PUFF
|
||||||
|
|
||||||
LIBC_ZIPOS_A_DEPS := \
|
LIBC_ZIPOS_A_DEPS := \
|
||||||
$(call uniq,$(foreach zipos,$(LIBC_ZIPOS_A_DIRECTDEPS),$($(zipos))))
|
$(call uniq,$(foreach zipos,$(LIBC_ZIPOS_A_DIRECTDEPS),$($(zipos))))
|
||||||
|
|
18
third_party/puff/README.cosmo
vendored
Normal file
18
third_party/puff/README.cosmo
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
puff is a tiny implementation of deflate decompression
|
||||||
|
|
||||||
|
LICENSE
|
||||||
|
|
||||||
|
zlib license
|
||||||
|
|
||||||
|
ORIGIN
|
||||||
|
|
||||||
|
Origin: git@github.com:madler/zlib.git
|
||||||
|
Commit: 03614c56ad299f9b238c75aa1e66f0c08fc4fc8b
|
||||||
|
Author: Mark Adler <madler@alumni.caltech.edu>
|
||||||
|
Date: Sun Oct 30 08:36:13 2016 -0700
|
||||||
|
|
||||||
|
LOCAL CHANGES
|
||||||
|
|
||||||
|
None.
|
|
@ -23,7 +23,7 @@
|
||||||
│ Mark Adler madler@alumni.caltech.edu │
|
│ Mark Adler madler@alumni.caltech.edu │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "third_party/zlib/puff.h"
|
#include "third_party/puff/puff.h"
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
||||||
asm(".ident\t\"\\n\\n\
|
asm(".ident\t\"\\n\\n\
|
||||||
|
@ -825,7 +825,7 @@ local int dynamic(struct state *s)
|
||||||
* block (if it was a fixed or dynamic block) are undefined and have no
|
* block (if it was a fixed or dynamic block) are undefined and have no
|
||||||
* expected values to check.
|
* expected values to check.
|
||||||
*/
|
*/
|
||||||
int puff(unsigned char *dest, /* pointer to destination pointer */
|
int _puff(unsigned char *dest, /* pointer to destination pointer */
|
||||||
unsigned long *destlen, /* amount of output space */
|
unsigned long *destlen, /* amount of output space */
|
||||||
const unsigned char *source, /* pointer to source data pointer */
|
const unsigned char *source, /* pointer to source data pointer */
|
||||||
unsigned long *sourcelen) /* amount of input available */
|
unsigned long *sourcelen) /* amount of input available */
|
|
@ -7,7 +7,7 @@ COSMOPOLITAN_C_START_
|
||||||
#define NIL ((unsigned char *)0) /* for no output option */
|
#define NIL ((unsigned char *)0) /* for no output option */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int puff(unsigned char *dest, unsigned long *destlen,
|
int _puff(unsigned char *dest, unsigned long *destlen,
|
||||||
const unsigned char *source, unsigned long *sourcelen);
|
const unsigned char *source, unsigned long *sourcelen);
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
45
third_party/puff/puff.mk
vendored
Normal file
45
third_party/puff/puff.mk
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
|
||||||
|
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
|
||||||
|
|
||||||
|
PKGS += THIRD_PARTY_PUFF
|
||||||
|
|
||||||
|
THIRD_PARTY_PUFF_ARTIFACTS += THIRD_PARTY_PUFF_A
|
||||||
|
THIRD_PARTY_PUFF = $(THIRD_PARTY_PUFF_A_DEPS) $(THIRD_PARTY_PUFF_A)
|
||||||
|
THIRD_PARTY_PUFF_A = o/$(MODE)/third_party/puff/puff.a
|
||||||
|
THIRD_PARTY_PUFF_A_FILES := $(wildcard third_party/puff/*)
|
||||||
|
THIRD_PARTY_PUFF_A_HDRS = $(filter %.h,$(THIRD_PARTY_PUFF_A_FILES))
|
||||||
|
THIRD_PARTY_PUFF_A_SRCS = $(filter %.c,$(THIRD_PARTY_PUFF_A_FILES))
|
||||||
|
|
||||||
|
THIRD_PARTY_PUFF_A_OBJS = \
|
||||||
|
$(THIRD_PARTY_PUFF_A_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
|
THIRD_PARTY_PUFF_A_CHECKS = \
|
||||||
|
$(THIRD_PARTY_PUFF_A).pkg \
|
||||||
|
$(THIRD_PARTY_PUFF_A_HDRS:%=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
|
THIRD_PARTY_PUFF_A_DIRECTDEPS = \
|
||||||
|
LIBC_INTRIN \
|
||||||
|
LIBC_NEXGEN32E \
|
||||||
|
LIBC_STUBS
|
||||||
|
|
||||||
|
THIRD_PARTY_PUFF_A_DEPS := \
|
||||||
|
$(call uniq,$(foreach x,$(THIRD_PARTY_PUFF_A_DIRECTDEPS),$($(x))))
|
||||||
|
|
||||||
|
$(THIRD_PARTY_PUFF_A): \
|
||||||
|
third_party/puff/ \
|
||||||
|
$(THIRD_PARTY_PUFF_A).pkg \
|
||||||
|
$(THIRD_PARTY_PUFF_A_OBJS)
|
||||||
|
|
||||||
|
$(THIRD_PARTY_PUFF_A).pkg: \
|
||||||
|
$(THIRD_PARTY_PUFF_A_OBJS) \
|
||||||
|
$(foreach x,$(THIRD_PARTY_PUFF_A_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
|
THIRD_PARTY_PUFF_LIBS = $(foreach x,$(THIRD_PARTY_PUFF_ARTIFACTS),$($(x)))
|
||||||
|
THIRD_PARTY_PUFF_SRCS = $(foreach x,$(THIRD_PARTY_PUFF_ARTIFACTS),$($(x)_SRCS))
|
||||||
|
THIRD_PARTY_PUFF_HDRS = $(foreach x,$(THIRD_PARTY_PUFF_ARTIFACTS),$($(x)_HDRS))
|
||||||
|
THIRD_PARTY_PUFF_CHECKS = $(foreach x,$(THIRD_PARTY_PUFF_ARTIFACTS),$($(x)_CHECKS))
|
||||||
|
THIRD_PARTY_PUFF_OBJS = $(foreach x,$(THIRD_PARTY_PUFF_ARTIFACTS),$($(x)_OBJS))
|
||||||
|
|
||||||
|
.PHONY: o/$(MODE)/third_party/puff
|
||||||
|
o/$(MODE)/third_party/puff: \
|
||||||
|
$(THIRD_PARTY_PUFF_CHECKS)
|
1
third_party/third_party.mk
vendored
1
third_party/third_party.mk
vendored
|
@ -23,6 +23,7 @@ o/$(MODE)/third_party: \
|
||||||
o/$(MODE)/third_party/mbedtls \
|
o/$(MODE)/third_party/mbedtls \
|
||||||
o/$(MODE)/third_party/musl \
|
o/$(MODE)/third_party/musl \
|
||||||
o/$(MODE)/third_party/nsync \
|
o/$(MODE)/third_party/nsync \
|
||||||
|
o/$(MODE)/third_party/puff \
|
||||||
o/$(MODE)/third_party/python \
|
o/$(MODE)/third_party/python \
|
||||||
o/$(MODE)/third_party/quickjs \
|
o/$(MODE)/third_party/quickjs \
|
||||||
o/$(MODE)/third_party/regex \
|
o/$(MODE)/third_party/regex \
|
||||||
|
|
|
@ -673,7 +673,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// figure out where we want the dso
|
// figure out where we want the dso
|
||||||
if (IsDynamicExecutable(prog)) {
|
if (_IsDynamicExecutable(prog)) {
|
||||||
isdynamic = true;
|
isdynamic = true;
|
||||||
if ((s = getenv("TMPDIR")) || //
|
if ((s = getenv("TMPDIR")) || //
|
||||||
(s = getenv("HOME")) || //
|
(s = getenv("HOME")) || //
|
||||||
|
|
|
@ -6893,7 +6893,7 @@ static void MakeExecutableModifiable(void) {
|
||||||
if (_endswith(zpath, ".com.dbg")) return;
|
if (_endswith(zpath, ".com.dbg")) return;
|
||||||
close(zfd);
|
close(zfd);
|
||||||
ft = ftrace_enabled(0);
|
ft = ftrace_enabled(0);
|
||||||
if ((zfd = OpenExecutable()) == -1) {
|
if ((zfd = _OpenExecutable()) == -1) {
|
||||||
WARNF("(srvr) can't open executable for modification: %m");
|
WARNF("(srvr) can't open executable for modification: %m");
|
||||||
}
|
}
|
||||||
if (ft > 0) {
|
if (ft > 0) {
|
||||||
|
|
Loading…
Reference in a new issue