diff --git a/dsp/tty/windex-avx2.S b/dsp/tty/windex-avx2.S index a59360981..9dbafc038 100644 --- a/dsp/tty/windex-avx2.S +++ b/dsp/tty/windex-avx2.S @@ -24,7 +24,7 @@ / @param rdi points to nonempty array / @param rsi is item count divisible by 16 / @note needs avx2 (haswell+) -windex$avx2: +windex_avx2: push %rbp mov %rsp,%rbp .profilable @@ -64,7 +64,7 @@ windex$avx2: 5: vzeroupper leave ret - .endfn windex$avx2,globl + .endfn windex_avx2,globl .rodata.cst32 .Lidx: .short 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 diff --git a/dsp/tty/windex-k8.c b/dsp/tty/windex-k8.c index 5f348b8cc..e1e65cc22 100644 --- a/dsp/tty/windex-k8.c +++ b/dsp/tty/windex-k8.c @@ -19,7 +19,7 @@ #include "dsp/tty/tty.h" #include "libc/assert.h" -unsigned windex$k8(short *a, size_t n) { +unsigned windex_k8(short *a, size_t n) { unsigned short min, res, i; res = 0; min = a[0]; diff --git a/dsp/tty/windex-sse4.S b/dsp/tty/windex-sse4.S index e82f28d22..82630fd04 100644 --- a/dsp/tty/windex-sse4.S +++ b/dsp/tty/windex-sse4.S @@ -24,7 +24,7 @@ / @param rdi points to nonempty array / @param esi is 16-byte aligned 8+ / 8 multiple array item count / @note needs sse4 (nehalem+) -windex$sse4: +windex_sse4: push %rbp mov %rsp,%rbp .profilable @@ -54,7 +54,7 @@ windex$sse4: movzwl -32(%rbp,%rax,2),%eax leave ret - .endfn windex$sse4,globl + .endfn windex_sse4,globl .rodata.cst16 .Lidx: .short 0,1,2,3,4,5,6,7 diff --git a/dsp/tty/windex.S b/dsp/tty/windex.S index c4c6ab152..aa761ed06 100644 --- a/dsp/tty/windex.S +++ b/dsp/tty/windex.S @@ -27,14 +27,14 @@ windex: .quad 0 .previous .init.start 300,_init_windex - ezlea windex$avx2,ax + ezlea windex_avx2,ax #if !X86_NEED(AVX2) - ezlea windex$sse4,dx + ezlea windex_sse4,dx testb X86_HAVE(AVX2)+kCpuids(%rip) cmovz %rdx,%rax #endif /* AVX2 */ #if !X86_NEED(SSE4_2) - ezlea windex$k8,dx + ezlea windex_k8,dx testb X86_HAVE(SSE4_2)+kCpuids(%rip) cmovz %rdx,%rax #endif /* SSE4 */ diff --git a/libc/calls/fstat-metal.c b/libc/calls/fstat-metal.c index e46dc0d7d..951e8c620 100644 --- a/libc/calls/fstat-metal.c +++ b/libc/calls/fstat-metal.c @@ -22,7 +22,7 @@ #include "libc/sysv/consts/s.h" #include "libc/sysv/errfuns.h" -int fstat$metal(int fd, struct stat *st) { +int fstat_metal(int fd, struct stat *st) { if (fd < 0) return einval(); if (fd < g_fds.n && g_fds.p[fd].kind == kFdSerial) { memset(st, 0, sizeof(*st)); diff --git a/libc/calls/fstat.c b/libc/calls/fstat.c index 7e0bff932..d58efd96b 100644 --- a/libc/calls/fstat.c +++ b/libc/calls/fstat.c @@ -35,7 +35,7 @@ int fstat(int fd, struct stat *st) { if (!IsMetal()) { return sys_fstat(fd, st); } else { - return fstat$metal(fd, st); + return fstat_metal(fd, st); } } else { if (!__isfdkind(fd, kFdFile)) return ebadf(); diff --git a/libc/calls/internal.h b/libc/calls/internal.h index 473b2cd20..0a6593570 100644 --- a/libc/calls/internal.h +++ b/libc/calls/internal.h @@ -290,14 +290,14 @@ unsigned __wincrash_nt(struct NtExceptionPointers *); │ cosmopolitan § syscalls » metal ─╬─│┼ ╚────────────────────────────────────────────────────────────────────────────│*/ -int fstat$metal(int, struct stat *); +int fstat_metal(int, struct stat *); /*───────────────────────────────────────────────────────────────────────────│─╗ │ cosmopolitan § syscalls » drivers ─╬─│┼ ╚────────────────────────────────────────────────────────────────────────────│*/ -ssize_t readv$serial(struct Fd *, const struct iovec *, int) hidden; -ssize_t writev$serial(struct Fd *, const struct iovec *, int) hidden; +ssize_t readv_serial(struct Fd *, const struct iovec *, int) hidden; +ssize_t writev_serial(struct Fd *, const struct iovec *, int) hidden; #undef sigset #undef i32 diff --git a/libc/calls/ioctl-default.c b/libc/calls/ioctl-default.c index 9cb782aac..cbd4913f9 100644 --- a/libc/calls/ioctl-default.c +++ b/libc/calls/ioctl-default.c @@ -23,7 +23,7 @@ #include "libc/sock/internal.h" #include "libc/sysv/errfuns.h" -int ioctl$default(int fd, uint64_t request, void *memory) { +int ioctl_default(int fd, uint64_t request, void *memory) { int rc; int64_t handle; if (!IsWindows()) { diff --git a/libc/calls/ioctl-tcgets-nt.c b/libc/calls/ioctl-tcgets-nt.c index 7c5828542..17fc30609 100644 --- a/libc/calls/ioctl-tcgets-nt.c +++ b/libc/calls/ioctl-tcgets-nt.c @@ -27,7 +27,7 @@ #include "libc/sysv/consts/termios.h" #include "libc/sysv/errfuns.h" -textwindows int ioctl$sys_tcgets_nt(int ignored, struct termios *tio) { +textwindows int ioctl_tcgets_nt(int ignored, struct termios *tio) { int64_t in, out; bool32 inok, outok; uint32_t inmode, outmode; diff --git a/libc/calls/ioctl-tcgets.c b/libc/calls/ioctl-tcgets.c index 1a168fed4..262e93e6e 100644 --- a/libc/calls/ioctl-tcgets.c +++ b/libc/calls/ioctl-tcgets.c @@ -21,9 +21,9 @@ #include "libc/calls/termios.internal.h" #include "libc/sysv/consts/termios.h" -int ioctl$sys_tcgets_nt(int, struct termios *); +int ioctl_tcgets_nt(int, struct termios *) hidden; -static int ioctl$sys_tcgets(int fd, struct termios *tio) { +static int ioctl_tcgets_sysv(int fd, struct termios *tio) { int rc; union metatermios t; if ((rc = sys_ioctl(fd, TCGETS, &t)) != -1) { @@ -39,10 +39,10 @@ static int ioctl$sys_tcgets(int fd, struct termios *tio) { * @see ioctl(fd, TCGETS, tio) dispatches here * @see ioctl(fd, TIOCGETA, tio) dispatches here */ -int ioctl$tcgets(int fd, struct termios *tio) { +int ioctl_tcgets(int fd, struct termios *tio) { if (!IsWindows()) { - return ioctl$sys_tcgets(fd, tio); + return ioctl_tcgets_sysv(fd, tio); } else { - return ioctl$sys_tcgets_nt(fd, tio); + return ioctl_tcgets_nt(fd, tio); } } diff --git a/libc/calls/ioctl-tcsets-nt.c b/libc/calls/ioctl-tcsets-nt.c index 51bccad9d..98d0af630 100644 --- a/libc/calls/ioctl-tcsets-nt.c +++ b/libc/calls/ioctl-tcsets-nt.c @@ -26,7 +26,7 @@ #include "libc/sysv/consts/termios.h" #include "libc/sysv/errfuns.h" -textwindows int ioctl$sys_tcsets_nt(int ignored, uint64_t request, +textwindows int ioctl_tcsets_nt(int ignored, uint64_t request, const struct termios *tio) { int64_t in, out; bool32 inok, outok; diff --git a/libc/calls/ioctl-tcsets.c b/libc/calls/ioctl-tcsets.c index ff347efa7..141b3b85f 100644 --- a/libc/calls/ioctl-tcsets.c +++ b/libc/calls/ioctl-tcsets.c @@ -22,9 +22,9 @@ #include "libc/dce.h" #include "libc/sysv/consts/termios.h" -int ioctl$sys_tcsets_nt(int, uint64_t, const struct termios *); +int ioctl_tcsets_nt(int, uint64_t, const struct termios *); -static int ioctl$sys_tcsets(int fd, uint64_t request, +static int ioctl_tcsets_sysv(int fd, uint64_t request, const struct termios *tio) { union metatermios t; return sys_ioctl(fd, request, termios2host(&t, tio)); @@ -37,10 +37,10 @@ static int ioctl$sys_tcsets(int fd, uint64_t request, * @see ioctl(fd, TCSETS{,W,F}, tio) dispatches here * @see ioctl(fd, TIOCGETA{,W,F}, tio) dispatches here */ -int ioctl$tcsets(int fd, uint64_t request, const struct termios *tio) { +int ioctl_tcsets(int fd, uint64_t request, const struct termios *tio) { if (!IsWindows()) { - return ioctl$sys_tcsets(fd, request, tio); + return ioctl_tcsets_sysv(fd, request, tio); } else { - return ioctl$sys_tcsets_nt(fd, request, tio); + return ioctl_tcsets_nt(fd, request, tio); } } diff --git a/libc/calls/ioctl-tiocgwinsz-nt.c b/libc/calls/ioctl-tiocgwinsz-nt.c index fab5c541b..7a5758381 100644 --- a/libc/calls/ioctl-tiocgwinsz-nt.c +++ b/libc/calls/ioctl-tiocgwinsz-nt.c @@ -26,7 +26,7 @@ #include "libc/str/str.h" #include "libc/sysv/errfuns.h" -textwindows int ioctl$sys_tiocgwinsz_nt(int fd, struct winsize *ws) { +textwindows int ioctl_tiocgwinsz_nt(int fd, struct winsize *ws) { int i, fds[3]; uint32_t mode; struct NtConsoleScreenBufferInfoEx sbinfo; diff --git a/libc/calls/ioctl-tiocgwinsz.c b/libc/calls/ioctl-tiocgwinsz.c index f76204df9..6428fa60f 100644 --- a/libc/calls/ioctl-tiocgwinsz.c +++ b/libc/calls/ioctl-tiocgwinsz.c @@ -21,17 +21,17 @@ #include "libc/dce.h" #include "libc/sysv/consts/termios.h" -int ioctl$sys_tiocgwinsz_nt(int, struct winsize *); +int ioctl_tiocgwinsz_nt(int, struct winsize *); /** * Returns width and height of terminal. * * @see ioctl(fd, TIOCGWINSZ, ws) dispatches here */ -int ioctl$tiocgwinsz(int fd, struct winsize *ws) { +int ioctl_tiocgwinsz(int fd, struct winsize *ws) { if (!IsWindows()) { return sys_ioctl(fd, TIOCGWINSZ, ws); } else { - return ioctl$sys_tiocgwinsz_nt(fd, ws); + return ioctl_tiocgwinsz_nt(fd, ws); } } diff --git a/libc/calls/ioctl-tiocswinsz-nt.c b/libc/calls/ioctl-tiocswinsz-nt.c index 0d7a87957..bf87f4181 100644 --- a/libc/calls/ioctl-tiocswinsz-nt.c +++ b/libc/calls/ioctl-tiocswinsz-nt.c @@ -24,7 +24,7 @@ #include "libc/str/str.h" #include "libc/sysv/errfuns.h" -textwindows int ioctl$sys_tiocswinsz_nt(int fd, const struct winsize *ws) { +textwindows int ioctl_tiocswinsz_nt(int fd, const struct winsize *ws) { uint32_t mode; struct NtCoord coord; if (!ws) return efault(); diff --git a/libc/calls/ioctl-tiocswinsz.c b/libc/calls/ioctl-tiocswinsz.c index 922a1cfd7..3b5f8f93d 100644 --- a/libc/calls/ioctl-tiocswinsz.c +++ b/libc/calls/ioctl-tiocswinsz.c @@ -21,17 +21,17 @@ #include "libc/dce.h" #include "libc/sysv/consts/termios.h" -int ioctl$sys_tiocswinsz_nt(int, const struct winsize *); +int ioctl_tiocswinsz_nt(int, const struct winsize *); /** * Returns width and height of terminal. * * @see ioctl(fd, TIOCSWINSZ, ws) dispatches here */ -int ioctl$tiocswinsz(int fd, const struct winsize *ws) { +int ioctl_tiocswinsz(int fd, const struct winsize *ws) { if (!IsWindows()) { return sys_ioctl(fd, TIOCSWINSZ, ws); } else { - return ioctl$sys_tiocswinsz_nt(fd, ws); + return ioctl_tiocswinsz_nt(fd, ws); } } diff --git a/libc/calls/ioctl.c b/libc/calls/ioctl.c index 4b3e5f864..258b1ba66 100644 --- a/libc/calls/ioctl.c +++ b/libc/calls/ioctl.c @@ -29,5 +29,5 @@ */ int(ioctl)(int fd, uint64_t request, void *memory) { __IOCTL_DISPATCH(EQUAL, fd, request, memory); - return ioctl$default(fd, request, memory); + return ioctl_default(fd, request, memory); } diff --git a/libc/calls/ioctl.h b/libc/calls/ioctl.h index d04132a04..9236e7828 100644 --- a/libc/calls/ioctl.h +++ b/libc/calls/ioctl.h @@ -16,31 +16,31 @@ int ioctl(int, uint64_t, void *); ╚────────────────────────────────────────────────────────────────────────────│*/ #if defined(__GNUC__) && !defined(__STRICT_ANSI__) -#define ioctl(FD, REQUEST, MEMORY) ioctl$dispatch(FD, REQUEST, MEMORY) +#define ioctl(FD, REQUEST, MEMORY) ioctl_dispatch(FD, REQUEST, MEMORY) #define __IOCTL_DISPATCH(CMP, FD, REQUEST, MEMORY) \ do { \ - if (CMP(request, TIOCGWINSZ)) return ioctl$tiocgwinsz(FD, MEMORY); \ - if (CMP(request, TIOCSWINSZ)) return ioctl$tiocswinsz(FD, MEMORY); \ - if (CMP(request, TCGETS)) return ioctl$tcgets(FD, MEMORY); \ - if (CMP(request, TCSETS)) return ioctl$tcsets(FD, REQUEST, MEMORY); \ - if (CMP(request, TCSETSW)) return ioctl$tcsets(FD, REQUEST, MEMORY); \ - if (CMP(request, TCSETSF)) return ioctl$tcsets(FD, REQUEST, MEMORY); \ + if (CMP(request, TIOCGWINSZ)) return ioctl_tiocgwinsz(FD, MEMORY); \ + if (CMP(request, TIOCSWINSZ)) return ioctl_tiocswinsz(FD, MEMORY); \ + if (CMP(request, TCGETS)) return ioctl_tcgets(FD, MEMORY); \ + if (CMP(request, TCSETS)) return ioctl_tcsets(FD, REQUEST, MEMORY); \ + if (CMP(request, TCSETSW)) return ioctl_tcsets(FD, REQUEST, MEMORY); \ + if (CMP(request, TCSETSF)) return ioctl_tcsets(FD, REQUEST, MEMORY); \ } while (0) -int ioctl$tcgets(int, void *); -int ioctl$sys_tcgets_nt(int, void *); -int ioctl$tcsets(int, uint64_t, void *); -int ioctl$sys_tcsets_nt(int, uint64_t, void *); -int ioctl$tiocgwinsz(int, void *); -int ioctl$sys_tiocgwinsz_nt(int, void *); -int ioctl$tiocswinsz(int, void *); -int ioctl$sys_tiocswinsz_nt(int, void *); -int ioctl$default(int, uint64_t, void *); +int ioctl_tcgets(int, void *); +int ioctl_tcgets_nt(int, void *); +int ioctl_tcsets(int, uint64_t, void *); +int ioctl_tcsets_nt(int, uint64_t, void *); +int ioctl_tiocgwinsz(int, void *); +int ioctl_tiocgwinsz_nt(int, void *); +int ioctl_tiocswinsz(int, void *); +int ioctl_tiocswinsz_nt(int, void *); +int ioctl_default(int, uint64_t, void *); -forceinline int ioctl$dispatch(int fd, uint64_t request, void *memory) { +forceinline int ioctl_dispatch(int fd, uint64_t request, void *memory) { __IOCTL_DISPATCH(EQUIVALENT, fd, request, memory); - return ioctl$default(fd, request, memory); + return ioctl_default(fd, request, memory); } #endif /* GNUC && !ANSI */ diff --git a/libc/calls/now.c b/libc/calls/now.c index 2e4cf360d..acaaaed3d 100644 --- a/libc/calls/now.c +++ b/libc/calls/now.c @@ -73,11 +73,11 @@ static long double ConvertTicksToSeconds(uint64_t ticks) { return 1 / 1e9 * ConvertTicksToNanos(ticks); } -long double nowl$sys(void) { +long double nowl_sys(void) { return dtime(CLOCK_REALTIME); } -long double nowl$art(void) { +long double nowl_art(void) { uint64_t ticks; if (!g_now.once) InitTime(); ticks = unsignedsubtract(rdtsc(), g_now.k0); diff --git a/libc/calls/nowl.S b/libc/calls/nowl.S index 621ea764f..32c6f4a89 100644 --- a/libc/calls/nowl.S +++ b/libc/calls/nowl.S @@ -29,8 +29,8 @@ nowl: .quad 0 .previous .init.start 202,_init_nowl - ezlea nowl$sys,ax - ezlea nowl$art,cx + ezlea nowl_sys,ax + ezlea nowl_art,cx testb X86_HAVE(INVTSC)+kCpuids(%rip) cmovnz %rcx,%rax stosq diff --git a/libc/calls/open-nt.c b/libc/calls/open-nt.c index 167dad94f..b29e70871 100644 --- a/libc/calls/open-nt.c +++ b/libc/calls/open-nt.c @@ -35,8 +35,8 @@ #include "libc/sysv/consts/o.h" #include "libc/sysv/errfuns.h" -static textwindows int64_t sys_open_nt$impl(int dirfd, const char *path, - uint32_t flags, int32_t mode) { +static textwindows int64_t sys_open_nt_impl(int dirfd, const char *path, + uint32_t flags, int32_t mode) { uint32_t br; int64_t handle; char16_t path16[PATH_MAX]; @@ -76,19 +76,19 @@ static textwindows int64_t sys_open_nt$impl(int dirfd, const char *path, } } -static textwindows ssize_t sys_open_nt$console(int dirfd, - const struct NtMagicPaths *mp, - uint32_t flags, int32_t mode, - size_t fd) { +static textwindows ssize_t sys_open_nt_console(int dirfd, + const struct NtMagicPaths *mp, + uint32_t flags, int32_t mode, + size_t fd) { if (GetFileType(g_fds.p[STDIN_FILENO].handle) == kNtFileTypeChar && GetFileType(g_fds.p[STDOUT_FILENO].handle) == kNtFileTypeChar) { g_fds.p[fd].handle = g_fds.p[STDIN_FILENO].handle; g_fds.p[fd].extra = g_fds.p[STDOUT_FILENO].handle; - } else if ((g_fds.p[fd].handle = sys_open_nt$impl( + } else if ((g_fds.p[fd].handle = sys_open_nt_impl( dirfd, mp->conin, (flags & ~O_ACCMODE) | O_RDONLY, mode)) != -1) { - g_fds.p[fd].extra = - sys_open_nt$impl(dirfd, mp->conout, (flags & ~O_ACCMODE) | O_WRONLY, mode); + g_fds.p[fd].extra = sys_open_nt_impl(dirfd, mp->conout, + (flags & ~O_ACCMODE) | O_WRONLY, mode); assert(g_fds.p[fd].extra != -1); } else { return -1; @@ -98,10 +98,10 @@ static textwindows ssize_t sys_open_nt$console(int dirfd, return fd; } -static textwindows ssize_t sys_open_nt$file(int dirfd, const char *file, - uint32_t flags, int32_t mode, - size_t fd) { - if ((g_fds.p[fd].handle = sys_open_nt$impl(dirfd, file, flags, mode)) != -1) { +static textwindows ssize_t sys_open_nt_file(int dirfd, const char *file, + uint32_t flags, int32_t mode, + size_t fd) { + if ((g_fds.p[fd].handle = sys_open_nt_impl(dirfd, file, flags, mode)) != -1) { g_fds.p[fd].kind = kFdFile; g_fds.p[fd].flags = flags; return fd; @@ -111,14 +111,14 @@ static textwindows ssize_t sys_open_nt$file(int dirfd, const char *file, } textwindows ssize_t sys_open_nt(int dirfd, const char *file, uint32_t flags, - int32_t mode) { + int32_t mode) { int fd; ssize_t rc; if ((fd = __reservefd()) == -1) return -1; if ((flags & O_ACCMODE) == O_RDWR && !strcmp(file, kNtMagicPaths.devtty)) { - rc = sys_open_nt$console(dirfd, &kNtMagicPaths, flags, mode, fd); + rc = sys_open_nt_console(dirfd, &kNtMagicPaths, flags, mode, fd); } else { - rc = sys_open_nt$file(dirfd, file, flags, mode, fd); + rc = sys_open_nt_file(dirfd, file, flags, mode, fd); } if (rc == -1) { __releasefd(fd); diff --git a/libc/calls/openanon.c b/libc/calls/openanon.c index aff3a67a8..056f68653 100644 --- a/libc/calls/openanon.c +++ b/libc/calls/openanon.c @@ -34,7 +34,7 @@ static struct OpenAnon { int count; } g_openanon; -static void openanon$genpath(const char *name, struct OpenAnon *state, +static void openanon_genpath(const char *name, struct OpenAnon *state, char pathbuf[hasatleast PATH_MAX]) { char c; size_t i; @@ -55,11 +55,11 @@ static void openanon$genpath(const char *name, struct OpenAnon *state, assert(p < pe); } -static int openanon$impl(const char *name, unsigned flags, +static int openanon_impl(const char *name, unsigned flags, struct OpenAnon *state, char pathbuf[hasatleast PATH_MAX]) { int fd; - openanon$genpath(name, state, pathbuf); + openanon_genpath(name, state, pathbuf); flags |= O_RDWR | O_CREAT | O_EXCL | O_TRUNC; if (!IsWindows()) { if ((fd = sys_openat(AT_FDCWD, pathbuf, flags, 0600)) != -1) { @@ -95,5 +95,5 @@ static int openanon$impl(const char *name, unsigned flags, */ int openanon(char *name, unsigned flags) { char pathbuf[PATH_MAX]; - return openanon$impl(name, flags, &g_openanon, pathbuf); + return openanon_impl(name, flags, &g_openanon, pathbuf); } diff --git a/libc/calls/readv-serial.c b/libc/calls/readv-serial.c index c62ca47ca..a09090b4d 100644 --- a/libc/calls/readv-serial.c +++ b/libc/calls/readv-serial.c @@ -34,7 +34,7 @@ static int GetFirstIov(struct iovec *iov, int iovlen) { return -1; } -ssize_t readv$serial(struct Fd *fd, const struct iovec *iov, int iovlen) { +ssize_t readv_serial(struct Fd *fd, const struct iovec *iov, int iovlen) { size_t i, j, got = 0; if ((i = GetFirstIov(iov, iovlen)) != -1) { while (!IsDataAvailable(fd)) asm("pause"); diff --git a/libc/calls/readv.c b/libc/calls/readv.c index 6fc7d21f7..32e655289 100644 --- a/libc/calls/readv.c +++ b/libc/calls/readv.c @@ -37,7 +37,7 @@ ssize_t readv(int fd, const struct iovec *iov, int iovlen) { return weaken(__zipos_read)( (struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, iov, iovlen, -1); } else if (fd < g_fds.n && g_fds.p[fd].kind == kFdSerial) { - return readv$serial(&g_fds.p[fd], iov, iovlen); + return readv_serial(&g_fds.p[fd], iov, iovlen); } else if (!IsWindows()) { return sys_readv(fd, iov, iovlen); } else if (fd < g_fds.n && diff --git a/libc/calls/termios.h b/libc/calls/termios.h index 029a232d2..9a6d67177 100644 --- a/libc/calls/termios.h +++ b/libc/calls/termios.h @@ -32,16 +32,16 @@ int posix_openpt(int) nodiscard; ╚────────────────────────────────────────────────────────────────────────────│*/ #if defined(__GNUC__) && !defined(__STRICT_ANSI__) -#define tcsetattr(FD, OPT, TIO) tcsetattr$dispatch(FD, OPT, TIO) -forceinline int tcsetattr$dispatch(int fd, int opt, const struct termios *tio) { +#define tcsetattr(FD, OPT, TIO) tcsetattr_dispatch(FD, OPT, TIO) +forceinline int tcsetattr_dispatch(int fd, int opt, const struct termios *tio) { if (EQUIVALENT(opt, TCSANOW)) return ioctl(fd, TCSETS, (void *)tio); if (EQUIVALENT(opt, TCSADRAIN)) return ioctl(fd, TCSETSW, (void *)tio); if (EQUIVALENT(opt, TCSAFLUSH)) return ioctl(fd, TCSETSF, (void *)tio); return (tcsetattr)(fd, opt, tio); } -#define tcgetattr(FD, TIO) tcgetattr$dispatch(FD, TIO) -forceinline int tcgetattr$dispatch(int fd, const struct termios *tio) { +#define tcgetattr(FD, TIO) tcgetattr_dispatch(FD, TIO) +forceinline int tcgetattr_dispatch(int fd, const struct termios *tio) { return ioctl(fd, TCGETS, (void *)tio); } diff --git a/libc/calls/writev-serial.c b/libc/calls/writev-serial.c index e1ddeca97..634a12075 100644 --- a/libc/calls/writev-serial.c +++ b/libc/calls/writev-serial.c @@ -20,7 +20,7 @@ #include "libc/calls/internal.h" #include "libc/nexgen32e/uart.internal.h" -ssize_t writev$serial(struct Fd *fd, const struct iovec *iov, int iovlen) { +ssize_t writev_serial(struct Fd *fd, const struct iovec *iov, int iovlen) { size_t i, j, wrote = 0; for (i = 0; i < iovlen; ++i) { for (j = 0; j < iov[i].iov_len; ++j) { diff --git a/libc/calls/writev.c b/libc/calls/writev.c index 9bbc68fae..b44bdad12 100644 --- a/libc/calls/writev.c +++ b/libc/calls/writev.c @@ -40,7 +40,7 @@ ssize_t writev(int fd, const struct iovec *iov, int iovlen) { return weaken(__zipos_write)( (struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, iov, iovlen, -1); } else if (fd < g_fds.n && g_fds.p[fd].kind == kFdSerial) { - return writev$serial(&g_fds.p[fd], iov, iovlen); + return writev_serial(&g_fds.p[fd], iov, iovlen); } else if (!IsWindows()) { return sys_writev(fd, iov, iovlen); } else if (fd < g_fds.n && diff --git a/libc/crypto/rijndael.c b/libc/crypto/rijndael.c index 082e255c9..8efc81b28 100644 --- a/libc/crypto/rijndael.c +++ b/libc/crypto/rijndael.c @@ -20,7 +20,7 @@ #include "libc/crypto/rijndael.h" #include "libc/nexgen32e/x86feature.h" -forceinline aes_block_t rijndael$westmere(uint32_t n, aes_block_t x, +forceinline aes_block_t rijndael_westmere(uint32_t n, aes_block_t x, const struct Rijndael *ctx) { uint32_t i; x ^= ctx->rk[0].xmm; @@ -31,7 +31,7 @@ forceinline aes_block_t rijndael$westmere(uint32_t n, aes_block_t x, return x; } -static noinline aes_block_t rijndael$pure(uint32_t n, aes_block_t x, +static noinline aes_block_t rijndael_pure(uint32_t n, aes_block_t x, const struct Rijndael *ctx) { uint32_t i, j; __v16qu b1, b2; @@ -65,8 +65,8 @@ static noinline aes_block_t rijndael$pure(uint32_t n, aes_block_t x, */ aes_block_t rijndael(uint32_t n, aes_block_t x, const struct Rijndael *ctx) { if (X86_HAVE(AES)) { - return rijndael$westmere(n, x, ctx); + return rijndael_westmere(n, x, ctx); } else { - return rijndael$pure(n, x, ctx); + return rijndael_pure(n, x, ctx); } } diff --git a/libc/crypto/unrijndael.c b/libc/crypto/unrijndael.c index d97f1839c..eb8d6da32 100644 --- a/libc/crypto/unrijndael.c +++ b/libc/crypto/unrijndael.c @@ -20,7 +20,7 @@ #include "libc/crypto/rijndael.h" #include "libc/nexgen32e/x86feature.h" -forceinline aes_block_t unrijndael$westmere(uint32_t n, aes_block_t x, +forceinline aes_block_t unrijndael_westmere(uint32_t n, aes_block_t x, const struct Rijndael *ctx) { x ^= ctx->rk[n--].xmm; do { @@ -30,7 +30,7 @@ forceinline aes_block_t unrijndael$westmere(uint32_t n, aes_block_t x, return x; } -static noinline aes_block_t unrijndael$pure(uint32_t n, aes_block_t x, +static noinline aes_block_t unrijndael_pure(uint32_t n, aes_block_t x, const struct Rijndael *ctx) { uint32_t j; __v16qu b1, b2; @@ -57,8 +57,8 @@ static noinline aes_block_t unrijndael$pure(uint32_t n, aes_block_t x, */ aes_block_t unrijndael(uint32_t n, aes_block_t x, const struct Rijndael *ctx) { if (X86_HAVE(AES)) { - return unrijndael$westmere(n, x, ctx); + return unrijndael_westmere(n, x, ctx); } else { - return unrijndael$pure(n, x, ctx); + return unrijndael_pure(n, x, ctx); } } diff --git a/libc/crypto/unrijndaelinit.c b/libc/crypto/unrijndaelinit.c index 461c46e2e..af7c5239f 100644 --- a/libc/crypto/unrijndaelinit.c +++ b/libc/crypto/unrijndaelinit.c @@ -21,7 +21,7 @@ #include "libc/crypto/rijndael.h" #include "libc/nexgen32e/x86feature.h" -static void unrijndaelinit$westmere(struct Rijndael *ctx, uint32_t n, +static void unrijndaelinit_westmere(struct Rijndael *ctx, uint32_t n, aes_block_t k1, aes_block_t k2) { uint32_t i; aes_block_t x; @@ -36,7 +36,7 @@ static void unrijndaelinit$westmere(struct Rijndael *ctx, uint32_t n, XMM_DESTROY(x); } -static relegated noinline void unrijndaelinit$pure(struct Rijndael *ctx, +static relegated noinline void unrijndaelinit_pure(struct Rijndael *ctx, uint32_t n, aes_block_t k1, aes_block_t k2) { uint32_t i; @@ -62,8 +62,8 @@ static relegated noinline void unrijndaelinit$pure(struct Rijndael *ctx, void unrijndaelinit(struct Rijndael *ctx, uint32_t n, aes_block_t k1, aes_block_t k2) { if (X86_HAVE(AES)) { - return unrijndaelinit$westmere(ctx, n, k1, k2); + return unrijndaelinit_westmere(ctx, n, k1, k2); } else { - return unrijndaelinit$pure(ctx, n, k1, k2); + return unrijndaelinit_pure(ctx, n, k1, k2); } } diff --git a/libc/fmt/pflink.h b/libc/fmt/pflink.h index 67f142748..434289042 100644 --- a/libc/fmt/pflink.h +++ b/libc/fmt/pflink.h @@ -66,17 +66,17 @@ #define SFLINK(FMT) FMT #ifdef __GNUC__ __asm__(".section .yoink\n\t" - "nop\tntoa(%rip)\n\t" - "nop\tftoa(%rip)\n\t" - "nop\tkCp437(%rip)\n\t" - "nop\tstrerror(%rip)\n\t" - "nop\tstrnwidth(%rip)\n\t" - "nop\tstrnwidth16(%rip)\n\t" - "nop\twcsnwidth(%rip)\n\t" - "nop\tmalloc(%rip)\n\t" - "nop\tcalloc(%rip)\n\t" - "nop\tfree_s(%rip)\n\t" - "nop\t__grow(%rip)\n\t" + "nopl\tntoa(%rip)\n\t" + "nopl\tftoa(%rip)\n\t" + "nopl\tkCp437(%rip)\n\t" + "nopl\tstrerror(%rip)\n\t" + "nopl\tstrnwidth(%rip)\n\t" + "nopl\tstrnwidth16(%rip)\n\t" + "nopl\twcsnwidth(%rip)\n\t" + "nopl\tmalloc(%rip)\n\t" + "nopl\tcalloc(%rip)\n\t" + "nopl\tfree_s(%rip)\n\t" + "nopl\t__grow(%rip)\n\t" ".previous"); #else #include "libc/fmt/palandprintf.internal.h" diff --git a/libc/intrin/asan.c b/libc/intrin/asan.c index 3d029d2dd..d36b744a9 100644 --- a/libc/intrin/asan.c +++ b/libc/intrin/asan.c @@ -25,7 +25,7 @@ #include "libc/intrin/asan.internal.h" #include "libc/log/log.h" #include "libc/macros.h" -#include "libc/mem/hook/hook.h" +#include "libc/mem/hook/hook.internal.h" #include "libc/nt/enum/version.h" #include "libc/nt/runtime.h" #include "libc/runtime/directmap.h" @@ -711,15 +711,15 @@ void *__asan_get_current_fake_stack(void) { } void __asan_install_malloc_hooks(void) { - HOOK(hook$free, __asan_free); - HOOK(hook$malloc, __asan_malloc); - HOOK(hook$calloc, __asan_calloc); - HOOK(hook$valloc, __asan_valloc); - HOOK(hook$pvalloc, __asan_pvalloc); - HOOK(hook$realloc, __asan_realloc); - HOOK(hook$memalign, __asan_memalign); - HOOK(hook$malloc_trim, __asan_malloc_trim); - HOOK(hook$malloc_usable_size, __asan_malloc_usable_size); + HOOK(hook_free, __asan_free); + HOOK(hook_malloc, __asan_malloc); + HOOK(hook_calloc, __asan_calloc); + HOOK(hook_valloc, __asan_valloc); + HOOK(hook_pvalloc, __asan_pvalloc); + HOOK(hook_realloc, __asan_realloc); + HOOK(hook_memalign, __asan_memalign); + HOOK(hook_malloc_trim, __asan_malloc_trim); + HOOK(hook_malloc_usable_size, __asan_malloc_usable_size); } static bool __asan_is_mapped(int x) { @@ -813,9 +813,9 @@ textstartup void __asan_init(int argc, char **argv, char **envp, REQUIRE(MAP_ANONYMOUS); REQUIRE(FindMemoryInterval); REQUIRE(TrackMemoryInterval); - if (weaken(hook$malloc) || weaken(hook$calloc) || weaken(hook$realloc) || - weaken(hook$pvalloc) || weaken(hook$valloc) || weaken(hook$free) || - weaken(hook$malloc_usable_size)) { + if (weaken(hook_malloc) || weaken(hook_calloc) || weaken(hook_realloc) || + weaken(hook_pvalloc) || weaken(hook_valloc) || weaken(hook_free) || + weaken(hook_malloc_usable_size)) { REQUIRE(dlmemalign); REQUIRE(dlmalloc_usable_size); } diff --git a/libc/mem/calloc.S b/libc/mem/calloc.S index a2f442afa..d13393180 100644 --- a/libc/mem/calloc.S +++ b/libc/mem/calloc.S @@ -27,5 +27,5 @@ / @return rax is memory address, or NULL w/ errno / @note overreliance on memalign is a sure way to fragment space / @see dlcalloc() -calloc: jmp *hook$calloc(%rip) +calloc: jmp *hook_calloc(%rip) .endfn calloc,globl diff --git a/libc/mem/cxx/free.S b/libc/mem/cxx/free.S index 74fc95e2c..8143ef0ea 100644 --- a/libc/mem/cxx/free.S +++ b/libc/mem/cxx/free.S @@ -81,5 +81,5 @@ _ZdaPv: .endfn _ZdaPv,weak _ZdlPv: / operator delete(void*) - jmp *hook$free(%rip) + jmp *hook_free(%rip) .endfn _ZdlPv,weak diff --git a/libc/mem/cxx/malloc.S b/libc/mem/cxx/malloc.S index 7f9d8ef16..4f865a29a 100644 --- a/libc/mem/cxx/malloc.S +++ b/libc/mem/cxx/malloc.S @@ -44,5 +44,5 @@ _Znwm: test %rdi,%rdi jne 1f mov $1,%edi -1: jmp *hook$malloc(%rip) +1: jmp *hook_malloc(%rip) .endfn _Znwm,weak diff --git a/libc/mem/cxx/memalign.S b/libc/mem/cxx/memalign.S index 002a1f3c4..5974ebfd8 100644 --- a/libc/mem/cxx/memalign.S +++ b/libc/mem/cxx/memalign.S @@ -49,5 +49,5 @@ _ZnamSt11align_val_t: cmp %rax,%rsi cmovb %rax,%rsi xchg %rdi,%rsi - jmp *hook$memalign(%rip) + jmp *hook_memalign(%rip) .endfn _ZnamSt11align_val_t,weak diff --git a/libc/mem/free.S b/libc/mem/free.S index 0007da423..fed9155f9 100644 --- a/libc/mem/free.S +++ b/libc/mem/free.S @@ -29,5 +29,5 @@ / / @param rdi is allocation address, which may be NULL / @see dlfree() -free: jmp *hook$free(%rip) +free: jmp *hook_free(%rip) .endfn free,globl diff --git a/libc/mem/hook/calloc.S b/libc/mem/hook/calloc.S index 3024e3d84..9512139d5 100644 --- a/libc/mem/hook/calloc.S +++ b/libc/mem/hook/calloc.S @@ -20,9 +20,9 @@ .source __FILE__ .initbss 202,_init_calloc -hook$calloc: +hook_calloc: .quad 0 - .endobj hook$calloc,globl,hidden + .endobj hook_calloc,globl,hidden .previous .init.start 202,_init_calloc diff --git a/libc/mem/hook/free.S b/libc/mem/hook/free.S index dd68efd7d..89aca147b 100644 --- a/libc/mem/hook/free.S +++ b/libc/mem/hook/free.S @@ -20,9 +20,9 @@ .source __FILE__ .initbss 202,_init_free -hook$free: +hook_free: .quad 0 - .endobj hook$free,globl,hidden + .endobj hook_free,globl,hidden .previous .init.start 202,_init_free diff --git a/libc/mem/hook/hook.h b/libc/mem/hook/hook.h deleted file mode 100644 index 8d0216984..000000000 --- a/libc/mem/hook/hook.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_MEM_HOOK_HOOK_H_ -#define COSMOPOLITAN_LIBC_MEM_HOOK_HOOK_H_ -#if !(__ASSEMBLER__ + __LINKER__ + 0) -COSMOPOLITAN_C_START_ - -extern void (*hook$free)(void *); -extern void *(*hook$malloc)(size_t); -extern void *(*hook$calloc)(size_t, size_t); -extern void *(*hook$memalign)(size_t, size_t); -extern void *(*hook$realloc)(void *, size_t); -extern void *(*hook$realloc_in_place)(void *, size_t); -extern void *(*hook$valloc)(size_t); -extern void *(*hook$pvalloc)(size_t); -extern int (*hook$malloc_trim)(size_t); -extern size_t (*hook$malloc_usable_size)(const void *); - -COSMOPOLITAN_C_END_ -#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ -#endif /* COSMOPOLITAN_LIBC_MEM_HOOK_HOOK_H_ */ diff --git a/libc/mem/hook/hook.internal.h b/libc/mem/hook/hook.internal.h new file mode 100644 index 000000000..54b5284db --- /dev/null +++ b/libc/mem/hook/hook.internal.h @@ -0,0 +1,19 @@ +#ifndef COSMOPOLITAN_LIBC_MEM_HOOK_HOOK_H_ +#define COSMOPOLITAN_LIBC_MEM_HOOK_HOOK_H_ +#if !(__ASSEMBLER__ + __LINKER__ + 0) +COSMOPOLITAN_C_START_ + +extern void (*hook_free)(void *); +extern void *(*hook_malloc)(size_t); +extern void *(*hook_calloc)(size_t, size_t); +extern void *(*hook_memalign)(size_t, size_t); +extern void *(*hook_realloc)(void *, size_t); +extern void *(*hook_realloc_in_place)(void *, size_t); +extern void *(*hook_valloc)(size_t); +extern void *(*hook_pvalloc)(size_t); +extern int (*hook_malloc_trim)(size_t); +extern size_t (*hook_malloc_usable_size)(const void *); + +COSMOPOLITAN_C_END_ +#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ +#endif /* COSMOPOLITAN_LIBC_MEM_HOOK_HOOK_H_ */ diff --git a/libc/mem/hook/malloc.S b/libc/mem/hook/malloc.S index 3a2ffd2fe..d17d2a9ff 100644 --- a/libc/mem/hook/malloc.S +++ b/libc/mem/hook/malloc.S @@ -20,9 +20,9 @@ .source __FILE__ .initbss 202,_init_malloc -hook$malloc: +hook_malloc: .quad 0 - .endobj hook$malloc,globl,hidden + .endobj hook_malloc,globl,hidden .previous .init.start 202,_init_malloc diff --git a/libc/mem/hook/malloc_trim.S b/libc/mem/hook/malloc_trim.S index 46530b335..82a795bfb 100644 --- a/libc/mem/hook/malloc_trim.S +++ b/libc/mem/hook/malloc_trim.S @@ -20,9 +20,9 @@ .source __FILE__ .initbss 202,_init_malloc_trim -hook$malloc_trim: +hook_malloc_trim: .quad 0 - .endobj hook$malloc_trim,globl,hidden + .endobj hook_malloc_trim,globl,hidden .previous .init.start 202,_init_malloc_trim diff --git a/libc/mem/hook/malloc_usable_size.S b/libc/mem/hook/malloc_usable_size.S index e2bca209b..78ce01b5d 100644 --- a/libc/mem/hook/malloc_usable_size.S +++ b/libc/mem/hook/malloc_usable_size.S @@ -20,9 +20,9 @@ .source __FILE__ .initbss 202,_init_malloc_usable_size -hook$malloc_usable_size: +hook_malloc_usable_size: .quad 0 - .endobj hook$malloc_usable_size,globl,hidden + .endobj hook_malloc_usable_size,globl,hidden .previous .init.start 202,_init_malloc_usable_size diff --git a/libc/mem/hook/memalign.S b/libc/mem/hook/memalign.S index fd37c85b8..e48fd9451 100644 --- a/libc/mem/hook/memalign.S +++ b/libc/mem/hook/memalign.S @@ -20,9 +20,9 @@ .source __FILE__ .initbss 202,_init_memalign -hook$memalign: +hook_memalign: .quad 0 - .endobj hook$memalign,globl,hidden + .endobj hook_memalign,globl,hidden .previous .init.start 202,_init_memalign diff --git a/libc/mem/hook/posix_memalign.S b/libc/mem/hook/posix_memalign.S index 1ee8954f6..d928f7096 100644 --- a/libc/mem/hook/posix_memalign.S +++ b/libc/mem/hook/posix_memalign.S @@ -20,9 +20,9 @@ .source __FILE__ .initbss 202,_init_posix_memalign -hook$posix_memalign: +hook_posix_memalign: .quad 0 - .endobj hook$posix_memalign,globl,hidden + .endobj hook_posix_memalign,globl,hidden .previous .init.start 202,_init_posix_memalign diff --git a/libc/mem/hook/pvalloc.S b/libc/mem/hook/pvalloc.S index d831ab060..07ef0c09f 100644 --- a/libc/mem/hook/pvalloc.S +++ b/libc/mem/hook/pvalloc.S @@ -20,9 +20,9 @@ .source __FILE__ .initbss 202,_init_pvalloc -hook$pvalloc: +hook_pvalloc: .quad 0 - .endobj hook$pvalloc,globl,hidden + .endobj hook_pvalloc,globl,hidden .previous .init.start 202,_init_pvalloc diff --git a/libc/mem/hook/realloc.S b/libc/mem/hook/realloc.S index fcf140c63..d9655685b 100644 --- a/libc/mem/hook/realloc.S +++ b/libc/mem/hook/realloc.S @@ -20,9 +20,9 @@ .source __FILE__ .initbss 202,_init_realloc -hook$realloc: +hook_realloc: .quad 0 - .endobj hook$realloc,globl,hidden + .endobj hook_realloc,globl,hidden .previous .init.start 202,_init_realloc diff --git a/libc/mem/hook/realloc_in_place.S b/libc/mem/hook/realloc_in_place.S index 9c1c6e0a4..18ebf39d3 100644 --- a/libc/mem/hook/realloc_in_place.S +++ b/libc/mem/hook/realloc_in_place.S @@ -20,9 +20,9 @@ .source __FILE__ .initbss 202,_init_realloc_in_place -hook$realloc_in_place: +hook_realloc_in_place: .quad 0 - .endobj hook$realloc_in_place,globl,hidden + .endobj hook_realloc_in_place,globl,hidden .previous .init.start 202,_init_realloc_in_place diff --git a/libc/mem/hook/valloc.S b/libc/mem/hook/valloc.S index ef2665984..05f75e3fe 100644 --- a/libc/mem/hook/valloc.S +++ b/libc/mem/hook/valloc.S @@ -20,9 +20,9 @@ .source __FILE__ .initbss 202,_init_valloc -hook$valloc: +hook_valloc: .quad 0 - .endobj hook$valloc,globl,hidden + .endobj hook_valloc,globl,hidden .previous .init.start 202,_init_valloc diff --git a/libc/mem/malloc.S b/libc/mem/malloc.S index 728bfef82..921ca4f86 100644 --- a/libc/mem/malloc.S +++ b/libc/mem/malloc.S @@ -36,5 +36,5 @@ / @return new memory, or NULL w/ errno / @note malloc(0) → malloc(32) / @see dlmalloc() -malloc: jmp *hook$malloc(%rip) +malloc: jmp *hook_malloc(%rip) .endfn malloc,globl diff --git a/libc/mem/malloc_trim.S b/libc/mem/malloc_trim.S index 44d0d1fd8..f0f167438 100644 --- a/libc/mem/malloc_trim.S +++ b/libc/mem/malloc_trim.S @@ -23,5 +23,5 @@ / @param rdi specifies bytes of memory to leave available / @return 1 if it actually released any memory, else 0 malloc_trim: - jmp *hook$malloc_trim(%rip) + jmp *hook_malloc_trim(%rip) .endfn malloc_trim,globl diff --git a/libc/mem/malloc_usable_size.S b/libc/mem/malloc_usable_size.S index f862ca14b..ea1b760c9 100644 --- a/libc/mem/malloc_usable_size.S +++ b/libc/mem/malloc_usable_size.S @@ -37,5 +37,5 @@ / @return rax is total number of bytes / @see dlmalloc_usable_size() malloc_usable_size: - jmp *hook$malloc_usable_size(%rip) + jmp *hook_malloc_usable_size(%rip) .endfn malloc_usable_size,globl diff --git a/libc/mem/memalign.S b/libc/mem/memalign.S index c5ac25866..34d360914 100644 --- a/libc/mem/memalign.S +++ b/libc/mem/memalign.S @@ -35,5 +35,5 @@ / @note overreliance on memalign is a sure way to fragment space / @see dlmemalign() memalign: - jmp *hook$memalign(%rip) + jmp *hook_memalign(%rip) .endfn memalign,globl diff --git a/libc/mem/posix_memalign.S b/libc/mem/posix_memalign.S index f58d6a2e0..3e7548052 100644 --- a/libc/mem/posix_memalign.S +++ b/libc/mem/posix_memalign.S @@ -32,5 +32,5 @@ / @param rdx is size_t size / @return eax posix_memalign: - jmp *hook$posix_memalign(%rip) + jmp *hook_posix_memalign(%rip) .endfn posix_memalign,globl diff --git a/libc/mem/pvalloc.S b/libc/mem/pvalloc.S index ec7310041..d15143025 100644 --- a/libc/mem/pvalloc.S +++ b/libc/mem/pvalloc.S @@ -26,5 +26,5 @@ / @param rdi is number of bytes needed / @return rax is memory address, or NULL w/ errno / @see dlpvalloc() -pvalloc:jmp *hook$pvalloc(%rip) +pvalloc:jmp *hook_pvalloc(%rip) .endfn pvalloc,globl diff --git a/libc/mem/realloc.S b/libc/mem/realloc.S index 74bcd99b7..3842e34fd 100644 --- a/libc/mem/realloc.S +++ b/libc/mem/realloc.S @@ -55,5 +55,5 @@ / @note realloc(p≠0, n=0) → free(p) / @see dlrealloc() realloc: - jmp *hook$realloc(%rip) + jmp *hook_realloc(%rip) .endfn realloc,globl diff --git a/libc/mem/realloc_in_place.S b/libc/mem/realloc_in_place.S index 71b9e103d..acc0a49a3 100644 --- a/libc/mem/realloc_in_place.S +++ b/libc/mem/realloc_in_place.S @@ -34,5 +34,5 @@ / @return rax is result, or NULL w/ errno / @see dlrealloc_in_place() realloc_in_place: - jmp *hook$realloc_in_place(%rip) + jmp *hook_realloc_in_place(%rip) .endfn realloc_in_place,globl diff --git a/libc/mem/valloc.S b/libc/mem/valloc.S index a6c4f925e..dce6a467a 100644 --- a/libc/mem/valloc.S +++ b/libc/mem/valloc.S @@ -25,5 +25,5 @@ / @param rdi is number of bytes needed / @return rax is memory address, or NULL w/ errno / @see dlvalloc() -valloc: jmp *hook$valloc(%rip) +valloc: jmp *hook_valloc(%rip) .endfn valloc,globl diff --git a/libc/nexgen32e/crc32-pclmul.S b/libc/nexgen32e/crc32-pclmul.S index 060937041..6beeced67 100644 --- a/libc/nexgen32e/crc32-pclmul.S +++ b/libc/nexgen32e/crc32-pclmul.S @@ -30,7 +30,7 @@ / @see “Fast CRC Computation for Generic Polynomials Using / PCLMULQDQ Instruction” V. Gopal, E. Ozturk, et al., / 2009, intel.ly/2ySEwL0 -crc32$pclmul: +crc32_pclmul: .leafprologue .profilable movdqu (%rsi),%xmm7 @@ -136,7 +136,8 @@ crc32$pclmul: pxor %xmm1,%xmm0 pextrd $1,%xmm0,%eax .leafepilogue - .endfn crc32$pclmul,globl,hidden + .endfn crc32_pclmul,globl,hidden + .source __FILE__ / Definitions of the bit-reflected domain constants k1,k2,k3, etc. / and the CRC32+Barrett polynomials given at the end of the paper. @@ -259,4 +260,3 @@ crc32$pclmul: 4194304 7.025 7.059 7.030 462 8388607 7.082 6.980 6.997 464 8388608 7.051 6.985 6.999 464 */ - .source __FILE__ diff --git a/libc/nexgen32e/crc32.h b/libc/nexgen32e/crc32.h index 0d209012f..0a711fc0f 100644 --- a/libc/nexgen32e/crc32.h +++ b/libc/nexgen32e/crc32.h @@ -6,9 +6,9 @@ COSMOPOLITAN_C_START_ void crc32init(uint32_t[hasatleast 256], uint32_t); uint32_t crc32_z(uint32_t, const void *, size_t); extern uint32_t (*const crc32c)(uint32_t, const void *, size_t); -uint32_t crc32c$pure(uint32_t, const void *, size_t) strlenesque hidden; -uint32_t crc32c$sse42(uint32_t, const void *, size_t) strlenesque hidden; -uint32_t crc32$pclmul(uint32_t, const void *, size_t) hidden; +uint32_t crc32c_pure(uint32_t, const void *, size_t) strlenesque hidden; +uint32_t crc32c_sse42(uint32_t, const void *, size_t) strlenesque hidden; +uint32_t crc32_pclmul(uint32_t, const void *, size_t) hidden; COSMOPOLITAN_C_END_ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ diff --git a/libc/nexgen32e/djbsort-avx2.S b/libc/nexgen32e/djbsort-avx2.S index a263a3dcd..d7631125b 100644 --- a/libc/nexgen32e/djbsort-avx2.S +++ b/libc/nexgen32e/djbsort-avx2.S @@ -7,7 +7,7 @@ / @param rsi is number of elements in rdi / @note public domain / @see en.wikipedia.org/wiki/Sorting_network -djbsort$avx2: +djbsort_avx2: push %rbp mov %rsp,%rbp push %r15 @@ -275,7 +275,7 @@ djbsort$avx2: call int32_sort_2power lea (%r12,%rbx,4),%rdi mov %r14,%rsi - call djbsort$avx2 + call djbsort_avx2 .L175: mov %rbx,%r14 mov %r13,%rsi mov %r12,%rdi @@ -798,7 +798,7 @@ djbsort$avx2: pop %r15 pop %rbp ret - .endfn djbsort$avx2,globl,hidden + .endfn djbsort_avx2,globl,hidden minmax_vector: cmp $7,%rdx diff --git a/libc/nexgen32e/doc/strcmp-avx2.c b/libc/nexgen32e/doc/strcmp-avx2.c index 9067b293f..7d5c5e307 100644 --- a/libc/nexgen32e/doc/strcmp-avx2.c +++ b/libc/nexgen32e/doc/strcmp-avx2.c @@ -27,7 +27,7 @@ typedef uint32_t vbitmask_t; /** * Returns how many bytes the utf16 string would be as utf8. */ -int strcmp$avx2(const char *s1, const char *s2) { +int strcmp_avx2(const char *s1, const char *s2) { if (s1 == s2) return 0; const unsigned char *p1 = (const unsigned char *)s1; const unsigned char *p2 = (const unsigned char *)s2; diff --git a/libc/nexgen32e/strstr-sse42.S b/libc/nexgen32e/strstr-sse42.S index c66653f90..6476df1ba 100644 --- a/libc/nexgen32e/strstr-sse42.S +++ b/libc/nexgen32e/strstr-sse42.S @@ -21,7 +21,7 @@ #include "libc/nexgen32e/strstr.inc" / TODO(jart): Fix me. -strstr$sse42: +strstr_sse42: .leafprologue mov %rdi,%rax xor %ecx,%ecx @@ -38,5 +38,5 @@ strstr$sse42: jmp 5f # youtu.be/nVk1DjMtLWs 4: xor %eax,%eax 5: .leafepilogue - .endfn strstr$sse42,globl,hidden + .endfn strstr_sse42,globl,hidden .source __FILE__ diff --git a/libc/sock/sendfile.c b/libc/sock/sendfile.c index 65a065e2c..8bdb3ab3a 100644 --- a/libc/sock/sendfile.c +++ b/libc/sock/sendfile.c @@ -51,10 +51,10 @@ static textwindows ssize_t sendfile_linux2nt(int outfd, int infd, static ssize_t sendfile_linux2netflix(int outfd, int infd, int64_t *inout_opt_inoffset, size_t uptobytes) { - int sendfile$netflix(int32_t infd, int32_t outfd, int64_t offset, - size_t nbytes, const void *opt_hdtr, - int64_t *out_opt_sbytes, - int32_t flags) asm("sys_sendfile") hidden; + int sys_sendfile_netflix(int32_t infd, int32_t outfd, int64_t offset, + size_t nbytes, const void *opt_hdtr, + int64_t *out_opt_sbytes, + int32_t flags) asm("sys_sendfile") hidden; int rc; int64_t offset, sbytes; if (inout_opt_inoffset) { @@ -62,8 +62,8 @@ static ssize_t sendfile_linux2netflix(int outfd, int infd, } else if ((offset = sys_lseek(infd, 0, SEEK_CUR)) == -1) { return -1; } - if ((rc = sendfile$netflix(infd, outfd, offset, uptobytes, NULL, &sbytes, - 0)) != -1) { + if ((rc = sys_sendfile_netflix(infd, outfd, offset, uptobytes, NULL, &sbytes, + 0)) != -1) { if (inout_opt_inoffset) *inout_opt_inoffset += sbytes; return sbytes; } else { diff --git a/libc/str/crc32c-pure.c b/libc/str/crc32c-pure.c index 696b08eaa..df67d6ee5 100644 --- a/libc/str/crc32c-pure.c +++ b/libc/str/crc32c-pure.c @@ -23,7 +23,7 @@ extern const uint32_t kCrc32cTab[256]; /** * Computes Castagnoli CRC-32 on old computers. */ -uint32_t crc32c$pure(uint32_t init, const void *data, size_t size) { +uint32_t crc32c_pure(uint32_t init, const void *data, size_t size) { const unsigned char *p = data; uint32_t h = init ^ 0xffffffff; unsigned i; @@ -34,7 +34,7 @@ uint32_t crc32c$pure(uint32_t init, const void *data, size_t size) { } /* - bench_crc32c$pure for #c per n where c ≈ 0.293ns + bench_crc32c_pure for #c per n where c ≈ 0.293ns N x1 x8 x64 mBps ------------------------------------------------------------ 1 4305.000 91.375 44.203 74 diff --git a/libc/str/crc32c-sse42.c b/libc/str/crc32c-sse42.c index 705bd8036..7cb706974 100644 --- a/libc/str/crc32c-sse42.c +++ b/libc/str/crc32c-sse42.c @@ -22,7 +22,7 @@ * Hashes data with hardware acceleration at 10GBps. * @note needs Nehalem+ c. 2008 or Bulldozer+ c. 2011 */ -optimizespeed uint32_t crc32c$sse42(uint32_t init, const void *data, size_t n) { +optimizespeed uint32_t crc32c_sse42(uint32_t init, const void *data, size_t n) { const unsigned char *p = (const unsigned char *)data; const unsigned char *pe = (const unsigned char *)data + n; uint32_t h = init ^ 0xffffffff; @@ -42,7 +42,7 @@ optimizespeed uint32_t crc32c$sse42(uint32_t init, const void *data, size_t n) { } /* - bench_crc32c$sse42 for #c per n where c ≈ 0.293ns + bench_crc32c_sse42 for #c per n where c ≈ 0.293ns N x1 x8 x64 mBps ------------------------------------------------------------ 1 877.000 43.375 40.359 81 diff --git a/libc/str/crc32c.S b/libc/str/crc32c.S index fff51786a..4366bdbbc 100644 --- a/libc/str/crc32c.S +++ b/libc/str/crc32c.S @@ -34,8 +34,8 @@ crc32c: .quad 0 .previous .init.start 300,_init_crc32c - ezlea crc32c$pure,ax - ezlea crc32c$sse42,cx + ezlea crc32c_pure,ax + ezlea crc32c_sse42,cx testb X86_HAVE(SSE4_2)+kCpuids(%rip) cmovnz %rcx,%rax stosq diff --git a/libc/str/crc32z.c b/libc/str/crc32z.c index 504d412e2..19259aeb0 100644 --- a/libc/str/crc32z.c +++ b/libc/str/crc32z.c @@ -42,7 +42,7 @@ uint32_t crc32_z(uint32_t h, const void *data, size_t size) { if (data) { h ^= 0xffffffff; if (size >= 64 && X86_HAVE(PCLMUL)) { - h = crc32$pclmul(h, data, size); /* 51x faster */ + h = crc32_pclmul(h, data, size); /* 51x faster */ skip = rounddown(size, 16); } else { skip = 0; diff --git a/libc/str/djbsort.c b/libc/str/djbsort.c index 0f63aedcc..e048cbf35 100644 --- a/libc/str/djbsort.c +++ b/libc/str/djbsort.c @@ -20,14 +20,14 @@ #include "libc/nexgen32e/nexgen32e.h" #include "libc/nexgen32e/x86feature.h" -void djbsort$avx2(int32_t *, long); +void djbsort_avx2(int32_t *, long); /** * D.J. Bernstein's outrageously fast integer sorting algorithm. */ void djbsort(int32_t *a, size_t n) { if (X86_HAVE(AVX2)) { - djbsort$avx2(a, n); + djbsort_avx2(a, n); } else { insertionsort(a, n); } diff --git a/libc/str/getcachesize.c b/libc/str/getcachesize.c index ade32dd51..e9ab0fbd3 100644 --- a/libc/str/getcachesize.c +++ b/libc/str/getcachesize.c @@ -22,7 +22,7 @@ #include "libc/nexgen32e/cachesize.h" #include "libc/nexgen32e/cpuid4.internal.h" -static unsigned getcachesize$cpuid4(int type, int level) { +static unsigned getcachesize_cpuid4(int type, int level) { unsigned i, k; static int once; static unsigned char kCacheKey[8]; @@ -53,5 +53,5 @@ static unsigned getcachesize$cpuid4(int type, int level) { unsigned getcachesize(int type, int level) { assert(1 <= type && type <= 3); assert(level >= 1); - return getcachesize$cpuid4(type, level); + return getcachesize_cpuid4(type, level); } diff --git a/libc/str/internal.h b/libc/str/internal.h index e5bb2f4e5..2720330ba 100644 --- a/libc/str/internal.h +++ b/libc/str/internal.h @@ -15,11 +15,11 @@ nodebuginfo forceinline bool32 iscont(wint_t c) { return (c & 0300) == 0200; } -char *strstr$sse42(const char *, const char *) strlenesque hidden; -char16_t *strstr16$sse42(const char16_t *, const char16_t *) strlenesque hidden; -void *memmem$sse42(const void *, size_t, const void *, +char *strstr_sse42(const char *, const char *) strlenesque hidden; +char16_t *strstr16_sse42(const char16_t *, const char16_t *) strlenesque hidden; +void *memmem_sse42(const void *, size_t, const void *, size_t) strlenesque hidden; -void sha256$x86(uint32_t[hasatleast 8], const uint8_t[hasatleast 64], +void sha256_x86(uint32_t[hasatleast 8], const uint8_t[hasatleast 64], uint32_t) hidden; #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ diff --git a/libc/str/memmove-pure.c b/libc/str/memmove-pure.c index 2f0bbddfc..7a58c55ff 100644 --- a/libc/str/memmove-pure.c +++ b/libc/str/memmove-pure.c @@ -31,7 +31,7 @@ typedef long long xmm_t __attribute__((__vector_size__(16), __aligned__(1))); * @return dst * @asyncsignalsafe */ -void *memmove$pure(void *dst, const void *src, size_t n) { +void *memmove_pure(void *dst, const void *src, size_t n) { size_t i; xmm_t v, w; char *d, *r; diff --git a/libc/str/memset-pure.c b/libc/str/memset-pure.c index 60a132eb2..951629f7e 100644 --- a/libc/str/memset-pure.c +++ b/libc/str/memset-pure.c @@ -27,7 +27,7 @@ * @return p * @asyncsignalsafe */ -void *memset$pure(void *p, int c, size_t n) { +void *memset_pure(void *p, int c, size_t n) { char *b; uint64_t x; b = p; diff --git a/libc/str/sha256.c b/libc/str/sha256.c index 33290a133..5ceb1492d 100644 --- a/libc/str/sha256.c +++ b/libc/str/sha256.c @@ -85,7 +85,7 @@ void sha256_update(struct Sha256Ctx *ctx, const uint8_t *data, size_t size) { #if 0 if (!IsTiny() && size >= 64 && (X86_HAVE(SHA) && X86_HAVE(SSE4_1) && X86_HAVE(SSSE3))) { - sha256$x86(ctx->state, data, size); + sha256_x86(ctx->state, data, size); i += rounddown(size, 16); } #endif diff --git a/libc/str/stpcpy.c b/libc/str/stpcpy.c index 7d25a8649..0b5208189 100644 --- a/libc/str/stpcpy.c +++ b/libc/str/stpcpy.c @@ -20,7 +20,7 @@ #include "libc/intrin/pmovmskb.h" #include "libc/str/str.h" -static noasan size_t stpcpy$sse2(char *d, const char *s, size_t i) { +static noasan size_t stpcpy_sse2(char *d, const char *s, size_t i) { uint8_t v1[16], v2[16], vz[16]; for (;;) { memset(vz, 0, 16); @@ -52,7 +52,7 @@ char *stpcpy(char *d, const char *s) { return d + i; } } - i = stpcpy$sse2(d, s, i); + i = stpcpy_sse2(d, s, i); for (;;) { if (!(d[i] = s[i])) { return d + i; diff --git a/libc/str/str.h b/libc/str/str.h index e71ad7d8d..5a1400643 100644 --- a/libc/str/str.h +++ b/libc/str/str.h @@ -363,39 +363,39 @@ char *strsignal(int) returnsnonnull libcesque; /*───────────────────────────────────────────────────────────────────────────│─╗ │ cosmopolitan § strings » address sanitizer ─╬─│┼ ╚────────────────────────────────────────────────────────────────────────────│*/ -void *memset$pure(void *, int, size_t) memcpyesque; -void *memmove$pure(void *, const void *, size_t) memcpyesque; -size_t strlen$pure(const char *) strlenesque; -size_t strcspn$pure(const char *, const char *) strlenesque; +void *memset_pure(void *, int, size_t) memcpyesque; +void *memmove_pure(void *, const void *, size_t) memcpyesque; +size_t strlen_pure(const char *) strlenesque; +size_t strcspn_pure(const char *, const char *) strlenesque; #if defined(__FSANITIZE_ADDRESS__) -#define strcspn(STR, REJECT) strcspn$pure(STR, REJECT) +#define strcspn(STR, REJECT) strcspn_pure(STR, REJECT) #undef strlen #define strlen(STR) \ - (__builtin_constant_p(STR) ? __builtin_strlen(STR) : strlen$pure(STR)) + (__builtin_constant_p(STR) ? __builtin_strlen(STR) : strlen_pure(STR)) #undef memset #define memset(DST, CHAR, SIZE) \ (__memcpy_isgoodsize(SIZE) ? __builtin_memset(DST, CHAR, SIZE) \ - : memset$pure(DST, CHAR, SIZE)) + : memset_pure(DST, CHAR, SIZE)) #undef memmove #define memmove(DST, SRC, SIZE) \ (__memcpy_isgoodsize(SIZE) ? __builtin_memmove(DST, SRC, SIZE) \ - : memmove$pure(DST, SRC, SIZE)) + : memmove_pure(DST, SRC, SIZE)) #undef memcpy #define memcpy(DST, SRC, SIZE) \ (__memcpy_isgoodsize(SIZE) ? __builtin_memcpy(DST, SRC, SIZE) \ - : memmove$pure(DST, SRC, SIZE)) + : memmove_pure(DST, SRC, SIZE)) #undef mempcpy #define mempcpy(DST, SRC, SIZE) \ (__memcpy_isgoodsize(SIZE) ? __builtin_mempcpy(DST, SRC, SIZE) : ({ \ void *DsT = (DST); \ size_t SiZe = (SIZE); \ - memmove$pure(DsT, SRC, SiZe); \ + memmove_pure(DsT, SRC, SiZe); \ (void *)((char *)DsT + SiZe); \ })) diff --git a/libc/str/strchr.c b/libc/str/strchr.c index 6d7ea516c..c74aac9fb 100644 --- a/libc/str/strchr.c +++ b/libc/str/strchr.c @@ -19,7 +19,7 @@ #include "libc/assert.h" #include "libc/str/str.h" -noasan static const unsigned char *strchr$x64(const unsigned char *p, +noasan static const unsigned char *strchr_x64(const unsigned char *p, uint64_t c) { unsigned a, b; uint64_t w, x, y; @@ -63,7 +63,7 @@ char *strchr(const char *s, int c) { if ((*s & 0xff) == c) return s; if (!*s) return NULL; } - r = (char *)strchr$x64((const unsigned char *)s, c); + r = (char *)strchr_x64((const unsigned char *)s, c); assert(!r || *r || !c); return r; } diff --git a/libc/str/strchrnul.c b/libc/str/strchrnul.c index 8efc95274..09c4f738b 100644 --- a/libc/str/strchrnul.c +++ b/libc/str/strchrnul.c @@ -19,7 +19,7 @@ #include "libc/assert.h" #include "libc/str/str.h" -noasan static const unsigned char *strchrnul$x64(const unsigned char *p, +noasan static const unsigned char *strchrnul_x64(const unsigned char *p, uint64_t c) { unsigned a, b; uint64_t w, x, y; @@ -63,7 +63,7 @@ char *strchrnul(const char *s, int c) { if ((*s & 0xff) == c) return s; if (!*s) return s; } - r = (char *)strchrnul$x64((const unsigned char *)s, c); + r = (char *)strchrnul_x64((const unsigned char *)s, c); assert((*r & 0xff) == c || !*r); return r; } diff --git a/libc/str/strcpy.c b/libc/str/strcpy.c index 14fddfc13..9ceb238ca 100644 --- a/libc/str/strcpy.c +++ b/libc/str/strcpy.c @@ -20,7 +20,7 @@ #include "libc/intrin/pmovmskb.h" #include "libc/str/str.h" -static noasan size_t strcpy$sse2(char *d, const char *s, size_t i) { +static noasan size_t strcpy_sse2(char *d, const char *s, size_t i) { uint8_t v1[16], v2[16], vz[16]; for (;;) { memset(vz, 0, 16); @@ -52,7 +52,7 @@ char *strcpy(char *d, const char *s) { return d; } } - i = strcpy$sse2(d, s, i); + i = strcpy_sse2(d, s, i); for (;;) { if (!(d[i] = s[i])) { return d; diff --git a/libc/str/strcspn-pure.c b/libc/str/strcspn-pure.c index 0acecb89a..9c1a7501a 100644 --- a/libc/str/strcspn-pure.c +++ b/libc/str/strcspn-pure.c @@ -34,7 +34,7 @@ * @see strspn(), strtok_r() * @asyncsignalsafe */ -size_t strcspn$pure(const char *s, const char *reject) { +size_t strcspn_pure(const char *s, const char *reject) { size_t i, n; unsigned m; char cv[16], sv[16]; diff --git a/libc/str/strlen-pure.c b/libc/str/strlen-pure.c index 8c3ba391c..6df045f16 100644 --- a/libc/str/strlen-pure.c +++ b/libc/str/strlen-pure.c @@ -19,7 +19,7 @@ #include "libc/assert.h" #include "libc/str/str.h" -static noasan size_t strlen$pure$x64(const char *s, size_t i) { +static noasan size_t strlen_pure_x64(const char *s, size_t i) { uint64_t w; const unsigned char *p; for (;;) { @@ -38,12 +38,12 @@ static noasan size_t strlen$pure$x64(const char *s, size_t i) { /** * Returns length of NUL-terminated string. */ -size_t strlen$pure(const char *s) { +size_t strlen_pure(const char *s) { size_t i; for (i = 0; (uintptr_t)(s + i) & 7; ++i) { if (!s[i]) return i; } - i = strlen$pure$x64(s, i); + i = strlen_pure_x64(s, i); assert(!i || s[0]); assert(!s[i]); return i; diff --git a/libc/str/strnlen.c b/libc/str/strnlen.c index 8fa348e62..61b326f18 100644 --- a/libc/str/strnlen.c +++ b/libc/str/strnlen.c @@ -19,7 +19,7 @@ #include "libc/assert.h" #include "libc/str/str.h" -static noasan size_t strnlen$x64(const char *s, size_t n, size_t i) { +static noasan size_t strnlen_x64(const char *s, size_t n, size_t i) { uint64_t w; const unsigned char *p; for (; i + 8 < n; i += 8) { @@ -48,7 +48,7 @@ size_t strnlen(const char *s, size_t n) { for (i = 0; (uintptr_t)(s + i) & 7; ++i) { if (i == n || !s[i]) return i; } - i = strnlen$x64(s, n, i); + i = strnlen_x64(s, n, i); for (;; ++i) { if (i == n || !s[i]) break; } diff --git a/libc/str/tprecode16to8.c b/libc/str/tprecode16to8.c index cfa09e6e4..652dafd60 100644 --- a/libc/str/tprecode16to8.c +++ b/libc/str/tprecode16to8.c @@ -28,7 +28,7 @@ static const int16_t kDel16[8] = {127, 127, 127, 127, 127, 127, 127, 127}; /* 10x speedup for ascii */ -static noasan axdx_t tprecode16to8$sse2(char *dst, size_t dstsize, +static noasan axdx_t tprecode16to8_sse2(char *dst, size_t dstsize, const char16_t *src, axdx_t r) { int16_t v1[8], v2[8], v3[8], vz[8]; memset(vz, 0, 16); @@ -63,7 +63,7 @@ axdx_t tprecode16to8(char *dst, size_t dstsize, const char16_t *src) { r.dx = 0; for (;;) { if (!IsTiny() && !((uintptr_t)(src + r.dx) & 15)) { - r = tprecode16to8$sse2(dst, dstsize, src, r); + r = tprecode16to8_sse2(dst, dstsize, src, r); } if (!(x = src[r.dx++])) break; if (IsUtf16Cont(x)) continue; diff --git a/libc/str/tprecode8to16.c b/libc/str/tprecode8to16.c index ba475a8e4..dc8eafb39 100644 --- a/libc/str/tprecode8to16.c +++ b/libc/str/tprecode8to16.c @@ -25,7 +25,7 @@ #include "libc/str/utf16.h" /* 34x speedup for ascii */ -static noasan axdx_t tprecode8to16$sse2(char16_t *dst, size_t dstsize, +static noasan axdx_t tprecode8to16_sse2(char16_t *dst, size_t dstsize, const char *src, axdx_t r) { uint8_t v1[16], v2[16], vz[16]; memset(vz, 0, 16); @@ -61,7 +61,7 @@ axdx_t tprecode8to16(char16_t *dst, size_t dstsize, const char *src) { r.dx = 0; for (;;) { if (!IsTiny() && !((uintptr_t)(src + r.dx) & 15)) { - tprecode8to16$sse2(dst, dstsize, src, r); + tprecode8to16_sse2(dst, dstsize, src, r); } x = src[r.dx++] & 0xff; if (ThomPikeCont(x)) continue; diff --git a/libc/testlib/testlib.h b/libc/testlib/testlib.h index a42358c99..6aa48e22f 100644 --- a/libc/testlib/testlib.h +++ b/libc/testlib/testlib.h @@ -137,20 +137,20 @@ void TearDown(void); #define ASSERT_BINEQ(WANT, GOT) \ _Generic((WANT)[0], char \ - : assertBinaryEquals$hex, default \ - : assertBinaryEquals$cp437)(FILIFU WANT, GOT, -1, #GOT, true) + : assertBinaryEquals_hex, default \ + : assertBinaryEquals_cp437)(FILIFU WANT, GOT, -1, #GOT, true) #define ASSERT_BINNE(NOPE, GOT) \ _Generic((NOPE)[0], char \ - : assertBinaryNotEquals$hex, default \ - : assertBinaryNotEquals$cp437)(FILIFU NOPE, GOT, -1, #GOT, true) + : assertBinaryNotEquals_hex, default \ + : assertBinaryNotEquals_cp437)(FILIFU NOPE, GOT, -1, #GOT, true) #define ASSERT_BINEQN(WANT, GOT, N) \ _Generic((WANT)[0], char \ - : assertBinaryEquals$hex, default \ - : assertBinaryEquals$cp437)(FILIFU WANT, GOT, N, #GOT, true) + : assertBinaryEquals_hex, default \ + : assertBinaryEquals_cp437)(FILIFU WANT, GOT, N, #GOT, true) #define ASSERT_BINNEN(NOPE, GOT, N) \ _Generic((NOPE)[0], char \ - : assertBinaryNotEquals$hex, default \ - : assertBinaryNotEquals$cp437)(FILIFU NOPE, GOT, -1, #GOT, true) + : assertBinaryNotEquals_hex, default \ + : assertBinaryNotEquals_cp437)(FILIFU NOPE, GOT, -1, #GOT, true) #define ASSERT_FLOAT_EQ(WANT, GOT) \ assertLongDoubleEquals(FILIFU WANT, GOT, #GOT, true) @@ -195,20 +195,20 @@ void TearDown(void); #define EXPECT_BINEQ(WANT, GOT) \ _Generic((WANT)[0], char \ - : assertBinaryEquals$hex, default \ - : assertBinaryEquals$cp437)(FILIFU WANT, GOT, -1, #GOT, false) + : assertBinaryEquals_hex, default \ + : assertBinaryEquals_cp437)(FILIFU WANT, GOT, -1, #GOT, false) #define EXPECT_BINNE(NOPE, GOT) \ _Generic((NOPE)[0], char \ - : assertBinaryNotEquals$hex, default \ - : assertBinaryNotEquals$cp437)(FILIFU NOPE, GOT, -1, #GOT, false) + : assertBinaryNotEquals_hex, default \ + : assertBinaryNotEquals_cp437)(FILIFU NOPE, GOT, -1, #GOT, false) #define EXPECT_BINEQN(WANT, GOT, N) \ _Generic((WANT)[0], char \ - : assertBinaryEquals$hex, default \ - : assertBinaryEquals$cp437)(FILIFU WANT, GOT, N, #GOT, false) + : assertBinaryEquals_hex, default \ + : assertBinaryEquals_cp437)(FILIFU WANT, GOT, N, #GOT, false) #define EXPECT_BINNEN(NOPE, GOT, N) \ _Generic((NOPE)[0], char \ - : assertBinaryNotEquals$hex, default \ - : assertBinaryNotEquals$cp437)(FILIFU NOPE, GOT, -1, #GOT, false) + : assertBinaryNotEquals_hex, default \ + : assertBinaryNotEquals_cp437)(FILIFU NOPE, GOT, -1, #GOT, false) #define EXPECT_FLOAT_EQ(WANT, GOT) \ assertLongDoubleEquals(FILIFU WANT, GOT, #GOT, false) @@ -536,7 +536,7 @@ forceinline void assertContains(FILIFU_ARGS size_t cw, const char *needle, testlib_onfail2(isfatal); } -forceinline void assertBinaryEquals$cp437(FILIFU_ARGS const char16_t *want, +forceinline void assertBinaryEquals_cp437(FILIFU_ARGS const char16_t *want, const void *got, size_t n, const char *gotcode, bool isfatal) { ++g_testlib_ran; @@ -549,7 +549,7 @@ forceinline void assertBinaryEquals$cp437(FILIFU_ARGS const char16_t *want, testlib_onfail2(isfatal); } -forceinline void assertBinaryEquals$hex(FILIFU_ARGS const char *want, +forceinline void assertBinaryEquals_hex(FILIFU_ARGS const char *want, const void *got, size_t n, const char *gotcode, bool isfatal) { ++g_testlib_ran; @@ -562,7 +562,7 @@ forceinline void assertBinaryEquals$hex(FILIFU_ARGS const char *want, testlib_onfail2(isfatal); } -forceinline void assertBinaryNotEquals$cp437(FILIFU_ARGS const char16_t *want, +forceinline void assertBinaryNotEquals_cp437(FILIFU_ARGS const char16_t *want, const void *got, size_t n, const char *gotcode, bool isfatal) { @@ -576,7 +576,7 @@ forceinline void assertBinaryNotEquals$cp437(FILIFU_ARGS const char16_t *want, testlib_onfail2(isfatal); } -forceinline void assertBinaryNotEquals$hex(FILIFU_ARGS const char *want, +forceinline void assertBinaryNotEquals_hex(FILIFU_ARGS const char *want, const void *got, size_t n, const char *gotcode, bool isfatal) { ++g_testlib_ran; diff --git a/libc/time/xiso8601.c b/libc/time/xiso8601.c index 6d6b515ed..d4062d7dd 100644 --- a/libc/time/xiso8601.c +++ b/libc/time/xiso8601.c @@ -34,7 +34,7 @@ STATIC_YOINK("ntoa"); * @fileoverview Timestamps in One True Format w/o toil. */ -static char *xiso8601$impl(struct timespec *opt_ts, int sswidth) { +static char *xiso8601_impl(struct timespec *opt_ts, int sswidth) { char *p; struct tm tm; struct timespec ts; @@ -69,13 +69,13 @@ static char *xiso8601$impl(struct timespec *opt_ts, int sswidth) { * Returns allocated string representation of nanosecond timestamp. */ char *xiso8601ts(struct timespec *opt_ts) { - return xiso8601$impl(opt_ts, 9); + return xiso8601_impl(opt_ts, 9); } /** * Returns allocated string representation of microsecond timestamp. */ char *xiso8601tv(struct timeval *opt_tv) { - return xiso8601$impl( + return xiso8601_impl( opt_tv ? &(struct timespec){opt_tv->tv_sec, opt_tv->tv_usec} : NULL, 6); } diff --git a/libc/x/filecmp.c b/libc/x/filecmp.c index 332c4a9a9..be7e89430 100644 --- a/libc/x/filecmp.c +++ b/libc/x/filecmp.c @@ -26,7 +26,7 @@ #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/prot.h" -static void *filecmp$mmap(int fd, size_t size) { +static void *filecmp_mmap(int fd, size_t size) { return size ? mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0) : NULL; } @@ -49,8 +49,8 @@ int filecmp(const char *pathname1, const char *pathname2) { (fd2 = open(pathname2, O_RDONLY)) != -1 && (size1 = getfiledescriptorsize(fd1)) != -1 && (size2 = getfiledescriptorsize(fd2)) != -1 && - (addr1 = filecmp$mmap(fd1, size1)) != MAP_FAILED && - (addr2 = filecmp$mmap(fd2, size2)) != MAP_FAILED) { + (addr1 = filecmp_mmap(fd1, size1)) != MAP_FAILED && + (addr2 = filecmp_mmap(fd2, size2)) != MAP_FAILED) { olderr = errno; madvise(addr1, size1, MADV_WILLNEED | MADV_SEQUENTIAL); madvise(addr2, size2, MADV_WILLNEED | MADV_SEQUENTIAL); diff --git a/test/dsp/core/sad16x8n_test.c b/test/dsp/core/sad16x8n_test.c index 26b801169..e4ae0de00 100644 --- a/test/dsp/core/sad16x8n_test.c +++ b/test/dsp/core/sad16x8n_test.c @@ -26,7 +26,7 @@ #include "libc/testlib/ezbench.h" #include "libc/testlib/testlib.h" -void addsw$pure(size_t n, short x[n][8], const short y[n][8]) { +void addsw_pure(size_t n, short x[n][8], const short y[n][8]) { size_t i, j; for (i = 0; i < n; ++i) { for (j = 0; j < 8; ++j) { @@ -94,7 +94,7 @@ void sad16x8n_sse2(void) { sad16x8n(PLM_AUDIO_SAMPLES_PER_FRAME / 8, (void *)pcm1, (void *)pcm2); } void sad16x8n_pure(void) { - addsw$pure(PLM_AUDIO_SAMPLES_PER_FRAME / 8, (void *)pcm1, (void *)pcm2); + addsw_pure(PLM_AUDIO_SAMPLES_PER_FRAME / 8, (void *)pcm1, (void *)pcm2); } BENCH(sad16x8n, audioframe) { diff --git a/test/dsp/tty/windex_test.c b/test/dsp/tty/windex_test.c index aedd130ce..bdfb49e52 100644 --- a/test/dsp/tty/windex_test.c +++ b/test/dsp/tty/windex_test.c @@ -28,9 +28,9 @@ #include "libc/testlib/ezbench.h" #include "libc/testlib/testlib.h" -unsigned windex$k8(short *, size_t) hidden; -unsigned windex$avx2(short *, size_t) hidden; -unsigned windex$sse4(short *, size_t) hidden; +unsigned windex_k8(short *, size_t) hidden; +unsigned windex_avx2(short *, size_t) hidden; +unsigned windex_sse4(short *, size_t) hidden; const short kW[64] forcealign(32) = { 8281, 3883, 1365, 1786, 9006, 3681, 5563, 8013, 5787, 9063, 2923, @@ -78,9 +78,9 @@ TEST(windex, testRealWorldPicks) { 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, }; /* multiple valid answers are fine if it's deterministic */ - TestIt(windex$k8, 52, 21, ARRAYLEN(kPicks), kPicks); - if (X86_HAVE(AVX2)) TestIt(windex$avx2, 78, 21, ARRAYLEN(kPicks), kPicks); - if (X86_HAVE(SSE4_2)) TestIt(windex$sse4, 80, 21, ARRAYLEN(kPicks), kPicks); + TestIt(windex_k8, 52, 21, ARRAYLEN(kPicks), kPicks); + if (X86_HAVE(AVX2)) TestIt(windex_avx2, 78, 21, ARRAYLEN(kPicks), kPicks); + if (X86_HAVE(SSE4_2)) TestIt(windex_sse4, 80, 21, ARRAYLEN(kPicks), kPicks); } TEST(windex, test) { @@ -89,26 +89,26 @@ TEST(windex, test) { TestIt(windex, 62, 7, ARRAYLEN(kW3), kW3); } -TEST(windex$avx2, test) { +TEST(windex_avx2, test) { if (X86_HAVE(AVX2)) { - TestIt(windex$avx2, 13, 32, ARRAYLEN(kW), kW); - TestIt(windex$avx2, 1, 1, ARRAYLEN(kW2), kW2); - TestIt(windex$avx2, 62, 7, ARRAYLEN(kW3), kW3); + TestIt(windex_avx2, 13, 32, ARRAYLEN(kW), kW); + TestIt(windex_avx2, 1, 1, ARRAYLEN(kW2), kW2); + TestIt(windex_avx2, 62, 7, ARRAYLEN(kW3), kW3); } } -TEST(windex$sse4, test) { +TEST(windex_sse4, test) { if (X86_HAVE(SSE4_2)) { - TestIt(windex$sse4, 13, 32, ARRAYLEN(kW), kW); - TestIt(windex$sse4, 1, 1, ARRAYLEN(kW2), kW2); - TestIt(windex$sse4, 62, 7, ARRAYLEN(kW3), kW3); + TestIt(windex_sse4, 13, 32, ARRAYLEN(kW), kW); + TestIt(windex_sse4, 1, 1, ARRAYLEN(kW2), kW2); + TestIt(windex_sse4, 62, 7, ARRAYLEN(kW3), kW3); } } -TEST(windex$k8, test) { - TestIt(windex$k8, 13, 32, ARRAYLEN(kW), kW); - TestIt(windex$k8, 1, 1, ARRAYLEN(kW2), kW2); - TestIt(windex$k8, 62, 7, ARRAYLEN(kW3), kW3); +TEST(windex_k8, test) { + TestIt(windex_k8, 13, 32, ARRAYLEN(kW), kW); + TestIt(windex_k8, 1, 1, ARRAYLEN(kW2), kW2); + TestIt(windex_k8, 62, 7, ARRAYLEN(kW3), kW3); } //////////////////////////////////////////////////////////////////////////////// @@ -116,16 +116,16 @@ TEST(windex$k8, test) { BENCH(windex, bench) { EZBENCH(donothing, windex(kW, ARRAYLEN(kW))); } -BENCH(windex$k8, bench) { - EZBENCH(donothing, windex$k8(kW, ARRAYLEN(kW))); +BENCH(windex_k8, bench) { + EZBENCH(donothing, windex_k8(kW, ARRAYLEN(kW))); } -BENCH(windex$avx2, bench) { +BENCH(windex_avx2, bench) { if (X86_HAVE(AVX2)) { - EZBENCH(donothing, windex$avx2(kW, ARRAYLEN(kW))); + EZBENCH(donothing, windex_avx2(kW, ARRAYLEN(kW))); } } -BENCH(windex$sse4, bench) { +BENCH(windex_sse4, bench) { if (X86_HAVE(SSE4_2)) { - EZBENCH(donothing, windex$sse4(kW, ARRAYLEN(kW))); + EZBENCH(donothing, windex_sse4(kW, ARRAYLEN(kW))); } } diff --git a/test/libc/alg/djbsort_test.c b/test/libc/alg/djbsort_test.c index 554e2bf8c..ed86fc739 100644 --- a/test/libc/alg/djbsort_test.c +++ b/test/libc/alg/djbsort_test.c @@ -30,7 +30,7 @@ #include "libc/testlib/ezbench.h" #include "libc/testlib/testlib.h" -void djbsort$avx2(int32_t *, long); +void djbsort_avx2(int32_t *, long); size_t n; int32_t *a, *b, *c; @@ -42,7 +42,7 @@ TEST(djbsort, test4) { b = memcpy(gc(malloc(n * 4)), kA, n * 4); c = memcpy(gc(malloc(n * 4)), kA, n * 4); insertionsort(a, n); - djbsort$avx2(b, n); + djbsort_avx2(b, n); djbsort(c, n); ASSERT_EQ(0, memcmp(a, b, n * 4)); ASSERT_EQ(0, memcmp(a, c, n * 4)); @@ -72,7 +72,7 @@ TEST(djbsort, test64) { djbsort(c, n); ASSERT_EQ(0, memcmp(a, c, n * 4)); if (X86_HAVE(AVX2)) { - djbsort$avx2(b, n); + djbsort_avx2(b, n); ASSERT_EQ(0, memcmp(a, b, n * 4)); } } diff --git a/test/libc/nexgen32e/crc32_test.c b/test/libc/nexgen32e/crc32_test.c index d0ac0601e..5e2f3f067 100644 --- a/test/libc/nexgen32e/crc32_test.c +++ b/test/libc/nexgen32e/crc32_test.c @@ -37,7 +37,7 @@ TEST(crc32, testBigText) { EXPECT_EQ(0xc7adc04f, crc32(0, hyperion, size)); EXPECT_EQ(0xc7adc04f, crc32_z(0, hyperion, size)); EXPECT_EQ(0xc7adc04f, - 0xffffffffu ^ crc32$pclmul(0 ^ 0xffffffffu, hyperion, size)); + 0xffffffffu ^ crc32_pclmul(0 ^ 0xffffffffu, hyperion, size)); } } diff --git a/test/libc/nexgen32e/memmove_test.c b/test/libc/nexgen32e/memmove_test.c index d69ceb422..74072f4c8 100644 --- a/test/libc/nexgen32e/memmove_test.c +++ b/test/libc/nexgen32e/memmove_test.c @@ -68,7 +68,7 @@ TEST(memmove$pure, overlapping) { b0 = rngset(malloc(N), N, rand64, -1); b1 = memcpy(malloc(N), b0, N); b2 = memcpy(malloc(N), b0, N); - ASSERT_EQ(b1 + j, memmove$pure(b1 + j, b1 + i, n)); + ASSERT_EQ(b1 + j, memmove_pure(b1 + j, b1 + i, n)); ASSERT_EQ(b2 + j, PosixMemmove(b2 + j, b2 + i, n)); ASSERT_EQ(0, memcmp(b1, b2, N), "j=%ld i=%ld n=%ld\n" diff --git a/test/libc/release/smoke.c b/test/libc/release/smoke.c index 793bd4bc9..20ce3a98c 100644 --- a/test/libc/release/smoke.c +++ b/test/libc/release/smoke.c @@ -1,8 +1,8 @@ -int main() { +int main(int argc, char *argv[]) { int rc; FILE *f; f = fopen("/dev/null", "w"); - fprintf(f, "hello world\n"); + fprintf(f, "hello world %d\n", argc); fclose(f); rc = system("exit 42"); CHECK_NE(-1, rc); diff --git a/test/libc/release/test.mk b/test/libc/release/test.mk index f16692933..3a27dcdca 100644 --- a/test/libc/release/test.mk +++ b/test/libc/release/test.mk @@ -93,6 +93,31 @@ o/$(MODE)/test/libc/release/smokeansi.com.dbg: \ o/$(MODE)/ape/ape.o \ o/$(MODE)/cosmopolitan.a +o/$(MODE)/test/libc/release/smokeclang.com.dbg: \ + test/libc/release/smoke.c \ + o/cosmopolitan.h \ + o/$(MODE)/ape/ape.lds \ + o/$(MODE)/libc/crt/crt.o \ + o/$(MODE)/ape/ape.o \ + o/$(MODE)/cosmopolitan.a + @ACTION=CLANG build/compile clang \ + -o $@ \ + -Os \ + -static \ + -no-pie \ + -fno-pie \ + -nostdlib \ + -nostdinc \ + -mno-red-zone \ + -Wl,--gc-sections \ + -Wl,-z,max-page-size=0x1000 \ + -Wl,-T,o/$(MODE)/ape/ape.lds \ + -include o/cosmopolitan.h \ + test/libc/release/smoke.c \ + o/$(MODE)/libc/crt/crt.o \ + o/$(MODE)/ape/ape.o \ + o/$(MODE)/cosmopolitan.a + .PHONY: o/$(MODE)/test/libc/release o/$(MODE)/test/libc/release: \ o/$(MODE)/test/libc/release/smoke.com \ diff --git a/test/libc/str/crc32c_test.c b/test/libc/str/crc32c_test.c index 651e332d9..b755eb62b 100644 --- a/test/libc/str/crc32c_test.c +++ b/test/libc/str/crc32c_test.c @@ -40,12 +40,12 @@ TEST(crc32c, test) { strlen(hyperion) - strlen(FANATICS))); } -FIXTURE(crc32c, pure) { - *(void **)(&crc32c) = (void *)crc32c$pure; +FIXTURE(crc32c, pure_) { + *(void **)(&crc32c) = (void *)crc32c_pure; } -FIXTURE(crc32c, sse42) { +FIXTURE(crc32c, sse42_) { if (X86_HAVE(SSE4_2)) { - *(void **)(&crc32c) = (void *)crc32c$sse42; + *(void **)(&crc32c) = (void *)crc32c_sse42; } } diff --git a/test/libc/str/memccpy_test.c b/test/libc/str/memccpy_test.c index fc6cc6357..3579352a7 100644 --- a/test/libc/str/memccpy_test.c +++ b/test/libc/str/memccpy_test.c @@ -23,7 +23,7 @@ #include "libc/testlib/ezbench.h" #include "libc/testlib/testlib.h" -void *memccpy$pure(void *d, const void *s, int c, size_t n) { +void *memccpy_pure(void *d, const void *s, int c, size_t n) { size_t i; unsigned char *x; const unsigned char *y; @@ -57,7 +57,7 @@ TEST(memccpy, memcpy) { b2 = calloc(1, n); b3 = calloc(1, n); rngset(b1, n, rand64, -1); - e1 = memccpy$pure(b2, b1, 31337, n); + e1 = memccpy_pure(b2, b1, 31337, n); e2 = memccpy(b3, b1, 31337, n); n1 = e1 ? e1 - b2 : n; n2 = e2 ? e2 - b3 : n; diff --git a/test/libc/str/memcpy_test.c b/test/libc/str/memcpy_test.c index ec1be0696..ff3e6f25d 100644 --- a/test/libc/str/memcpy_test.c +++ b/test/libc/str/memcpy_test.c @@ -174,7 +174,7 @@ void *MemCpy(void *, const void *, size_t); #define BB(N) \ do { \ - B(memmove$pure, N); \ + B(memmove_pure, N); \ B(memcpy, N); \ B(MemCpy, N); \ fprintf(stderr, "\n"); \ diff --git a/test/libc/str/strchr_test.c b/test/libc/str/strchr_test.c index bdb1c6215..214a82a4d 100644 --- a/test/libc/str/strchr_test.c +++ b/test/libc/str/strchr_test.c @@ -70,7 +70,7 @@ TEST(strchrnul, notFound_returnsPointerToNulByte) { EXPECT_EQ(&buf[2], strchrnul(buf, 'z')); } -char *strchr$pure(const char *s, int c) { +char *strchr_pure(const char *s, int c) { char *r; for (c &= 0xff;; ++s) { if ((*s & 0xff) == c) return (char *)s; @@ -85,7 +85,7 @@ TEST(strchr, fuzz) { for (i = -2; i < 257; ++i) { for (j = 0; j < 17; ++j) { rngset(p, 63, rand64, -1); - ASSERT_EQ(strchr(p + j, i), strchr$pure(p + j, i)); + ASSERT_EQ(strchr(p + j, i), strchr_pure(p + j, i)); } } free(p); @@ -103,7 +103,7 @@ BENCH(strchr, bench) { strchr(VEIL("r", "hellzzzhellzzzeeAhellzzzhellzzzeeo"), 'o'))); } -char *memchr$pure(const char *m, int c, size_t n) { +char *memchr_pure(const char *m, int c, size_t n) { const unsigned char *p, *pe; for (c &= 0xff, p = (const unsigned char *)m, pe = p + n; p < pe; ++p) { if (*p == c) return p; @@ -118,13 +118,13 @@ TEST(memchr, fuzz) { for (i = -2; i < 257; ++i) { for (j = 0; j < 17; ++j) { rngset(p, 64, rand64, -1); - ASSERT_EQ(memchr(p + j, i, 64 - j), memchr$pure(p + j, i, 64 - j)); + ASSERT_EQ(memchr(p + j, i, 64 - j), memchr_pure(p + j, i, 64 - j)); } } free(p); } -char *strchrnul$pure(const char *s, int c) { +char *strchrnul_pure(const char *s, int c) { char *r; for (c &= 0xff;; ++s) { if ((*s & 0xff) == c) return (char *)s; @@ -139,13 +139,13 @@ TEST(strchrnul, fuzz) { for (i = -2; i < 257; ++i) { for (j = 0; j < 17; ++j) { rngset(p, 63, rand64, -1); - ASSERT_EQ(strchrnul(p + j, i), strchrnul$pure(p + j, i)); + ASSERT_EQ(strchrnul(p + j, i), strchrnul_pure(p + j, i)); } } free(p); } -void *rawmemchr$pure(const void *m, int c) { +void *rawmemchr_pure(const void *m, int c) { const unsigned char *s; for (c &= 255, s = m;; ++s) { if (*s == c) return s; @@ -160,7 +160,7 @@ TEST(rawmemchr, fuzz) { for (j = 0; j < 17; ++j) { rngset(p, 63, rand64, -1); p[63] = i; - ASSERT_EQ(rawmemchr(p + j, i), rawmemchr$pure(p + j, i)); + ASSERT_EQ(rawmemchr(p + j, i), rawmemchr_pure(p + j, i)); } } free(p); diff --git a/test/libc/str/strcmp_test.c b/test/libc/str/strcmp_test.c index 4c34f2e3c..693ebd37a 100644 --- a/test/libc/str/strcmp_test.c +++ b/test/libc/str/strcmp_test.c @@ -485,14 +485,14 @@ TEST(wcsncmp, testTwosComplementBane) { │ test/libc/str/strcmp_test.c § benchmarks ─╬─│┼ ╚────────────────────────────────────────────────────────────────────────────│*/ -testonly noinline int strcmp$pure(const char *a, const char *b) { +testonly noinline int strcmp_pure(const char *a, const char *b) { for (; *a == *b; a++, b++) { if (!*a) break; } return (*a & 0xff) - (*b & 0xff); } -testonly noinline int strcasecmp$pure(const char *a, const char *b) { +testonly noinline int strcasecmp_pure(const char *a, const char *b) { for (; *a && *b; a++, b++) { if (!(*a == *b || tolower(*a & 0xff) == tolower(*b & 0xff))) { break; @@ -542,38 +542,38 @@ BENCH(bench_00_strcmp, bench) { fprintf(stderr, "\n"); EZBENCH2("strcmp [2 diff]", donothing, EXPROPRIATE(strcmp(VEIL("r", "hi"), VEIL("r", "there")))); - EZBENCH2("strcmp$pure [2 diff]", donothing, - EXPROPRIATE(strcmp$pure(VEIL("r", "hi"), VEIL("r", "there")))); + EZBENCH2("strcmp_pure [2 diff]", donothing, + EXPROPRIATE(strcmp_pure(VEIL("r", "hi"), VEIL("r", "there")))); fprintf(stderr, "\n"); EZBENCH2("strcmp [2 dupe]", randomize_buf2str_dupe(2, data, dupe), EXPROPRIATE(strcmp(VEIL("r", data), VEIL("r", dupe)))); - EZBENCH2("strcmp$pure [2 dupe]", randomize_buf2str_dupe(2, data, dupe), - EXPROPRIATE(strcmp$pure(VEIL("r", data), VEIL("r", dupe)))); + EZBENCH2("strcmp_pure [2 dupe]", randomize_buf2str_dupe(2, data, dupe), + EXPROPRIATE(strcmp_pure(VEIL("r", data), VEIL("r", dupe)))); fprintf(stderr, "\n"); EZBENCH2("strcmp [4 dupe]", randomize_buf2str_dupe(4, data, dupe), EXPROPRIATE(strcmp(VEIL("r", data), VEIL("r", dupe)))); - EZBENCH2("strcmp$pure [4 dupe]", randomize_buf2str_dupe(4, data, dupe), - EXPROPRIATE(strcmp$pure(VEIL("r", data), VEIL("r", dupe)))); + EZBENCH2("strcmp_pure [4 dupe]", randomize_buf2str_dupe(4, data, dupe), + EXPROPRIATE(strcmp_pure(VEIL("r", data), VEIL("r", dupe)))); fprintf(stderr, "\n"); EZBENCH2("strcmp [8 dupe]", randomize_buf2str_dupe(8, data, dupe), EXPROPRIATE(strcmp(VEIL("r", data), VEIL("r", dupe)))); - EZBENCH2("strcmp$pure [8 dupe]", randomize_buf2str_dupe(8, data, dupe), - EXPROPRIATE(strcmp$pure(VEIL("r", data), VEIL("r", dupe)))); + EZBENCH2("strcmp_pure [8 dupe]", randomize_buf2str_dupe(8, data, dupe), + EXPROPRIATE(strcmp_pure(VEIL("r", data), VEIL("r", dupe)))); fprintf(stderr, "\n"); EZBENCH2("strcmp [short dupe]", randomize_buf2str_dupe(size, data, dupe), EXPROPRIATE(strcmp(VEIL("r", data), VEIL("r", dupe)))); - EZBENCH2("strcmp$pure [short dupe]", randomize_buf2str_dupe(size, data, dupe), - EXPROPRIATE(strcmp$pure(VEIL("r", data), VEIL("r", dupe)))); + EZBENCH2("strcmp_pure [short dupe]", randomize_buf2str_dupe(size, data, dupe), + EXPROPRIATE(strcmp_pure(VEIL("r", data), VEIL("r", dupe)))); fprintf(stderr, "\n"); EZBENCH2("strcmp [long dupe]", longstringislong_dupe(size, data, dupe), EXPROPRIATE(strcmp(VEIL("r", data), VEIL("r", dupe)))); - EZBENCH2("strcmp$pure [long dupe]", longstringislong_dupe(size, data, dupe), - EXPROPRIATE(strcmp$pure(VEIL("r", data), VEIL("r", dupe)))); + EZBENCH2("strcmp_pure [long dupe]", longstringislong_dupe(size, data, dupe), + EXPROPRIATE(strcmp_pure(VEIL("r", data), VEIL("r", dupe)))); } BENCH(bench_01_strcasecmp, bench) { @@ -591,14 +591,14 @@ BENCH(bench_01_strcasecmp, bench) { fprintf(stderr, "\n"); EZBENCH2("strcasecmp [short dupe]", randomize_buf2str_dupe(size, data, dupe), EXPROPRIATE(strcasecmp(VEIL("r", data), VEIL("r", dupe)))); - EZBENCH2("strcasecmp$pure [short dupe]", + EZBENCH2("strcasecmp_pure [short dupe]", randomize_buf2str_dupe(size, data, dupe), - EXPROPRIATE(strcasecmp$pure(VEIL("r", data), VEIL("r", dupe)))); + EXPROPRIATE(strcasecmp_pure(VEIL("r", data), VEIL("r", dupe)))); fprintf(stderr, "\n"); EZBENCH2("strcasecmp [long dupe]", longstringislong_dupe(size, data, dupe), EXPROPRIATE(strcasecmp(VEIL("r", data), VEIL("r", dupe)))); - EZBENCH2("strcasecmp$pure [long dupe]", + EZBENCH2("strcasecmp_pure [long dupe]", longstringislong_dupe(size, data, dupe), - EXPROPRIATE(strcasecmp$pure(VEIL("r", data), VEIL("r", dupe)))); + EXPROPRIATE(strcasecmp_pure(VEIL("r", data), VEIL("r", dupe)))); } diff --git a/test/libc/str/strlen_test.c b/test/libc/str/strlen_test.c index 8c1cb1078..30eb33307 100644 --- a/test/libc/str/strlen_test.c +++ b/test/libc/str/strlen_test.c @@ -33,7 +33,7 @@ wchar_t u32[] = L"utf32 ☻"; TEST(strlen, usageExample_c11) { _Alignas(16) char ugh[] = "eeeeeeeeeeeeeee\017"; - EXPECT_EQ(1, strlen$pure(ugh + 15)); + EXPECT_EQ(1, strlen_pure(ugh + 15)); EXPECT_EQ(6 + 3, strlen(u8)); EXPECT_EQ(7, strlen16(u16)); EXPECT_EQ(7, wcslen(u32)); @@ -146,10 +146,10 @@ TEST(strlen, fuzz) { for (n = 2; n < 1026; ++n) { b = rngset(calloc(1, n), n - 1, rand64, -1); n1 = strlen(b); - n2 = strlen$pure(b); + n2 = strlen_pure(b); ASSERT_EQ(n1, n2, "%#.*s", n, b); n1 = strlen(b + 1); - n2 = strlen$pure(b + 1); + n2 = strlen_pure(b + 1); ASSERT_EQ(n1, n2); free(b); } @@ -157,27 +157,27 @@ TEST(strlen, fuzz) { BENCH(strlen, bench) { extern size_t strlen_(const char *) asm("strlen"); - extern size_t strlen$pure_(const char *) asm("strlen$pure"); + extern size_t strlen_pure_(const char *) asm("strlen_pure"); static char b[2048]; memset(b, -1, sizeof(b) - 1); EZBENCH2("strlen 1", donothing, strlen_("")); - EZBENCH2("strlen$pure 1", donothing, strlen$pure_("")); + EZBENCH2("strlen_pure 1", donothing, strlen_pure_("")); EZBENCH2("strlen 2", donothing, strlen_("1")); - EZBENCH2("strlen$pure 2", donothing, strlen$pure_("1")); + EZBENCH2("strlen_pure 2", donothing, strlen_pure_("1")); EZBENCH2("strlen 7", donothing, strlen_("123456")); - EZBENCH2("strlen$pure 7", donothing, strlen$pure_("123456")); + EZBENCH2("strlen_pure 7", donothing, strlen_pure_("123456")); EZBENCH2("strlen 8", donothing, strlen_("1234567")); - EZBENCH2("strlen$pure 8", donothing, strlen$pure_("1234567")); + EZBENCH2("strlen_pure 8", donothing, strlen_pure_("1234567")); EZBENCH2("strlen 9", donothing, strlen_("12345678")); - EZBENCH2("strlen$pure 9", donothing, strlen$pure_("12345678")); + EZBENCH2("strlen_pure 9", donothing, strlen_pure_("12345678")); EZBENCH2("strlen 11", donothing, strlen_("12345678aa")); - EZBENCH2("strlen$pure 11", donothing, strlen$pure_("12345678aa")); + EZBENCH2("strlen_pure 11", donothing, strlen_pure_("12345678aa")); EZBENCH2("strlen 13", donothing, strlen_("12345678aabb")); - EZBENCH2("strlen$pure 13", donothing, strlen$pure_("12345678aabb")); + EZBENCH2("strlen_pure 13", donothing, strlen_pure_("12345678aabb")); EZBENCH2("strlen 16", donothing, strlen_("123456781234567")); - EZBENCH2("strlen$pure 16", donothing, strlen$pure_("123456781234567")); + EZBENCH2("strlen_pure 16", donothing, strlen_pure_("123456781234567")); EZBENCH2("strlen 17", donothing, strlen_("123456781234567e")); - EZBENCH2("strlen$pure 17", donothing, strlen$pure_("123456781234567e")); + EZBENCH2("strlen_pure 17", donothing, strlen_pure_("123456781234567e")); EZBENCH2("strlen 1023", donothing, strlen_(b)); - EZBENCH2("strlen$pure 1023", donothing, strlen$pure_(b)); + EZBENCH2("strlen_pure 1023", donothing, strlen_pure_(b)); } diff --git a/test/libc/str/strstr_test.c b/test/libc/str/strstr_test.c index 639b158e8..82a8f1527 100644 --- a/test/libc/str/strstr_test.c +++ b/test/libc/str/strstr_test.c @@ -28,15 +28,15 @@ #define MAKESTRING(NAME, VALUE) \ char *NAME = strcpy(malloc(sizeof(VALUE) + 16), VALUE) -char *strstr$kmp(const char *haystak, const char *needle) { +char *strstr_kmp(const char *haystak, const char *needle) { return memmem(haystak, strlen(haystak), needle, strlen(needle)); } -char *(*strstri)(const char *, const char *) = strstr$kmp; +char *(*strstri)(const char *, const char *) = strstr_kmp; -FIXTURE(strstr, sse42) { +FIXTURE(strstr, sse42_) { if (X86_HAVE(SSE4_2)) { - strstri = strstr$sse42; + strstri = strstr_sse42; } } diff --git a/tool/viz/derasterize.c b/tool/viz/derasterize.c index dae739cb7..79aeb652e 100644 --- a/tool/viz/derasterize.c +++ b/tool/viz/derasterize.c @@ -311,25 +311,25 @@ static unsigned combinecolors(unsigned char bf[1u << MC][2], return r; \ } -ADJUDICATE(adjudicate$avx2, microarchitecture("avx2,fma")) -ADJUDICATE(adjudicate$avx, microarchitecture("avx")) -ADJUDICATE(adjudicate$default, ) +ADJUDICATE(adjudicate_avx2, microarchitecture("avx2,fma")) +ADJUDICATE(adjudicate_avx, microarchitecture("avx")) +ADJUDICATE(adjudicate_default, ) -static float (*adjudicate$hook)(unsigned, unsigned, unsigned, +static float (*adjudicate_hook)(unsigned, unsigned, unsigned, const float[CN][YS * XS]); static float adjudicate2(unsigned b, unsigned f, unsigned g, const float lb[CN][YS * XS]) { - if (!adjudicate$hook) { + if (!adjudicate_hook) { if (X86_HAVE(AVX2) && X86_HAVE(FMA)) { - adjudicate$hook = adjudicate$avx2; + adjudicate_hook = adjudicate_avx2; } else if (X86_HAVE(AVX)) { - adjudicate$hook = adjudicate$avx; + adjudicate_hook = adjudicate_avx; } else { - adjudicate$hook = adjudicate$default; + adjudicate_hook = adjudicate_default; } } - return adjudicate$hook(b, f, g, lb); + return adjudicate_hook(b, f, g, lb); } static float adjudicate(unsigned b, unsigned f, unsigned g,