Get LIBC_RUNTIME and LIBC_CALLS building on aarch64

This commit is contained in:
Justine Tunney 2023-05-09 01:56:56 -07:00
parent 7e46645193
commit e5e3cdf447
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
1200 changed files with 5341 additions and 3677 deletions

View file

@ -19,13 +19,9 @@
#include "libc/fmt/magnumstrs.internal.h"
#include "libc/intrin/describeflags.internal.h"
#ifdef DescribeClockName
#undef DescribeClockName
#endif
/**
* Describes clock_gettime() clock argument.
*/
const char *DescribeClockName(char buf[32], int x) {
const char *(DescribeClockName)(char buf[32], int x) {
return DescribeMagnum(buf, kClockNames, "CLOCK_", x);
}

View file

@ -21,10 +21,6 @@
#include "libc/nt/enum/processaccess.h"
#include "libc/sysv/consts/dn.h"
#ifdef DescribeDnotifyFlags
#undef DescribeDnotifyFlags
#endif
static const struct DescribeFlags kDnotifyFlags[] = {
{DN_ACCESS, "ACCESS"}, //
{DN_MODIFY, "MODIFY"}, //
@ -35,7 +31,7 @@ static const struct DescribeFlags kDnotifyFlags[] = {
{DN_MULTISHOT, "MULTISHOT"}, //
};
const char *DescribeDnotifyFlags(char buf[80], int x) {
const char *(DescribeDnotifyFlags)(char buf[80], int x) {
return DescribeFlags(buf, 80, kDnotifyFlags, ARRAYLEN(kDnotifyFlags), "DN_",
x);
}

View file

@ -20,11 +20,7 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/str/str.h"
#ifdef DescribeErrno
#undef DescribeErrno
#endif
const char *DescribeErrno(char buf[20], int ax) {
const char *(DescribeErrno)(char buf[20], int ax) {
char *p = buf;
const char *s;
if (ax < 0) {

View file

@ -19,11 +19,7 @@
#include "libc/fmt/itoa.h"
#include "libc/sysv/consts/f.h"
#ifdef DescribeFlockType
#undef DescribeFlockType
#endif
const char *DescribeFlockType(char buf[12], int x) {
const char *(DescribeFlockType)(char buf[12], int x) {
if (x == F_RDLCK) return "F_RDLCK";
if (x == F_WRLCK) return "F_WRLCK";
if (x == F_UNLCK) return "F_UNLCK";

View file

@ -21,11 +21,7 @@
#include "libc/str/str.h"
#include "libc/sysv/consts/futex.h"
#ifdef DescribeFutexOp
#undef DescribeFutexOp
#endif
const char *DescribeFutexOp(char buf[64], int x) {
const char *(DescribeFutexOp)(char buf[64], int x) {
bool priv = false;
if (x & FUTEX_PRIVATE_FLAG) {

View file

@ -22,11 +22,7 @@
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h"
#ifdef DescribeMapFlags
#undef DescribeMapFlags
#endif
const char *DescribeMapFlags(char buf[64], int x) {
const char *(DescribeMapFlags)(char buf[64], int x) {
const struct DescribeFlags kMapFlags[] = {
{MAP_STACK, "STACK"}, // order matters
{MAP_PRIVATE, "PRIVATE"}, //

View file

@ -21,10 +21,6 @@
#include "libc/nt/enum/accessmask.h"
#include "libc/nt/enum/filesharemode.h"
#ifdef DescribeNtFileAccessFlags
#undef DescribeNtFileAccessFlags
#endif
static const struct DescribeFlags kFileAccessflags[] = {
{kNtFileAllAccess, "FileAllAccess"}, // order matters
{kNtFileGenericRead, "FileGenericRead"}, // order matters
@ -67,7 +63,7 @@ static const struct DescribeFlags kFileAccessflags[] = {
{kNtTokenAdjustSessionid, "TokenAdjustSessionid"}, //
};
const char *DescribeNtFileAccessFlags(char buf[512], uint32_t x) {
const char *(DescribeNtFileAccessFlags)(char buf[512], uint32_t x) {
return DescribeFlags(buf, 512, kFileAccessflags, ARRAYLEN(kFileAccessflags),
"kNt", x);
}

View file

@ -21,10 +21,6 @@
#include "libc/nt/enum/filemapflags.h"
#include "libc/nt/ipc.h"
#ifdef DescribeNtPipeModeFlags
#undef DescribeNtPipeModeFlags
#endif
static const struct DescribeFlags kPipeModeFlags[] = {
{kNtPipeNowait, "Nowait"}, // 0x0000000001
{kNtPipeReadmodeMessage, "ReadmodeMessage"}, // 0x0000000002
@ -36,7 +32,7 @@ static const struct DescribeFlags kPipeModeFlags[] = {
//{kNtPipeTypeByte, "TypeByte"}, // 0x00000000
};
const char *DescribeNtPipeModeFlags(char buf[64], uint32_t x) {
const char *(DescribeNtPipeModeFlags)(char buf[64], uint32_t x) {
return DescribeFlags(buf, 64, kPipeModeFlags, ARRAYLEN(kPipeModeFlags),
"kNtPipe", x);
}

View file

@ -23,16 +23,12 @@
#include "libc/macros.internal.h"
#include "libc/sysv/consts/sol.h"
#ifdef DescribeOpenFlags
#undef DescribeOpenFlags
#endif
#define N (PAGESIZE / 2 / sizeof(struct DescribeFlags))
/**
* Describes clock_gettime() clock argument.
*/
const char *DescribeOpenFlags(char buf[128], int x) {
const char *(DescribeOpenFlags)(char buf[128], int x) {
char *s;
int i, n;
struct DescribeFlags d[N];

View file

@ -21,14 +21,10 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/str/str.h"
#ifdef DescribeSchedParam
#undef DescribeSchedParam
#endif
/**
* Describes clock_gettime() clock argument.
*/
const char *DescribeSchedParam(char buf[32], const struct sched_param *x) {
const char *(DescribeSchedParam)(char buf[32], const struct sched_param *x) {
char *p;
if (!x) return "0";
p = buf;

View file

@ -26,15 +26,11 @@
#include "libc/str/str.h"
#include "libc/sysv/consts/sig.h"
#ifdef DescribeSiginfo
#undef DescribeSiginfo
#endif
#define N 300
#define append(...) i += ksnprintf(buf + i, N - i, __VA_ARGS__)
const char *DescribeSiginfo(char buf[N], int rc, const siginfo_t *si) {
const char *(DescribeSiginfo)(char buf[N], int rc, const siginfo_t *si) {
int i = 0;
if (rc == -1) return "n/a";

View file

@ -26,15 +26,11 @@
#include "libc/sysv/consts/limits.h"
#include "libc/sysv/consts/sig.h"
#ifdef DescribeSigset
#undef DescribeSigset
#endif
#define N 128
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *DescribeSigset(char buf[N], int rc, const sigset_t *ss) {
const char *(DescribeSigset)(char buf[N], int rc, const sigset_t *ss) {
bool gotsome;
const char *s;
int sig, o = 0;

View file

@ -21,14 +21,10 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/sysv/consts/timer.h"
#ifdef DescribeSleepFlags
#undef DescribeSleepFlags
#endif
/**
* Describes clock_nanosleep() flags argument.
*/
const char *DescribeSleepFlags(char buf[16], int x) {
const char *(DescribeSleepFlags)(char buf[16], int x) {
switch (x) {
case 0:
return "0";

View file

@ -22,15 +22,11 @@
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/kprintf.h"
#ifdef DescribeStat
#undef DescribeStat
#endif
#define N 300
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *DescribeStat(char buf[N], int rc, const struct stat *st) {
const char *(DescribeStat)(char buf[N], int rc, const struct stat *st) {
int o = 0;
if (rc == -1) return "n/a";

View file

@ -20,11 +20,7 @@
#include "libc/fmt/itoa.h"
#include "libc/intrin/describeflags.internal.h"
#ifdef DescribeWhence
#undef DescribeWhence
#endif
const char *DescribeWhence(char buf[12], int whence) {
const char *(DescribeWhence)(char buf[12], int whence) {
if (whence == SEEK_SET) return "SEEK_SET";
if (whence == SEEK_CUR) return "SEEK_CUR";
if (whence == SEEK_END) return "SEEK_END";

View file

@ -20,11 +20,7 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/sysv/consts/prio.h"
#ifdef DescribeWhichPrio
#undef DescribeWhichPrio
#endif
const char *DescribeWhichPrio(char buf[12], int x) {
const char *(DescribeWhichPrio)(char buf[12], int x) {
if (x == PRIO_PROCESS) return "PRIO_PROCESS";
if (x == PRIO_PGRP) return "PRIO_PGRP";
if (x == PRIO_USER) return "PRIO_USER";

View file

@ -157,7 +157,7 @@ void *memset(void *p, int c, size_t n) {
} while (n);
}
return b;
#ifdef __x86_64__
#ifdef __x86__
} else if (IsTiny()) {
asm("rep stosb" : "+D"(b), "+c"(n), "=m"(*(char(*)[n])b) : "0"(p), "a"(c));
return p;

View file

@ -18,17 +18,13 @@
*/
#include "libc/intrin/psrad.h"
#ifdef psradv
#undef psradv
#endif
/**
* Divides shorts by two powers.
*
* @note arithmetic shift right will sign extend negatives
* @mayalias
*/
void psradv(int32_t a[4], const int32_t b[4], const uint64_t c[2]) {
void(psradv)(int32_t a[4], const int32_t b[4], const uint64_t c[2]) {
unsigned i;
unsigned char k;
k = c[0] > 31 ? 31 : c[0];

View file

@ -21,10 +21,6 @@
#include "libc/macros.internal.h"
#include "libc/str/str.h"
#ifdef psubusb
#undef psubusb
#endif
/**
* Subtracts unsigned 8-bit integers w/ saturation.
*
@ -33,7 +29,7 @@
* @param 𝑐 [r/o] supplies second input vector
* @mayalias
*/
void psubusb(uint8_t a[16], const uint8_t b[16], const uint8_t c[16]) {
void(psubusb)(uint8_t a[16], const uint8_t b[16], const uint8_t c[16]) {
unsigned i;
uint8_t r[16];
for (i = 0; i < 16; ++i) {

View file

@ -21,11 +21,7 @@
#include "libc/thread/thread.h"
#include "libc/thread/tls.h"
#ifdef pthread_cleanup_pop
#undef pthread_cleanup_pop
#endif
void pthread_cleanup_pop(struct _pthread_cleanup_buffer *cb, int execute) {
void(pthread_cleanup_pop)(struct _pthread_cleanup_buffer *cb, int execute) {
struct PosixThread *pt;
if (__tls_enabled && (pt = (struct PosixThread *)__get_tls()->tib_pthread)) {
_unassert(cb == pt->cleanup);

View file

@ -20,12 +20,8 @@
#include "libc/thread/thread.h"
#include "libc/thread/tls.h"
#ifdef pthread_cleanup_push
#undef pthread_cleanup_push
#endif
void pthread_cleanup_push(struct _pthread_cleanup_buffer *cb,
void (*routine)(void *), void *arg) {
void(pthread_cleanup_push)(struct _pthread_cleanup_buffer *cb,
void (*routine)(void *), void *arg) {
struct PosixThread *pt;
cb->__routine = routine;
cb->__arg = arg;

View file

@ -19,10 +19,6 @@
#include "libc/intrin/atomic.h"
#include "libc/thread/thread.h"
#ifdef pthread_spin_init
#undef pthread_spin_init
#endif
/**
* Initializes spin lock.
*
@ -32,7 +28,7 @@
* @see pthread_spin_destroy
* @see pthread_spin_lock
*/
errno_t pthread_spin_init(pthread_spinlock_t *spin, int pshared) {
errno_t(pthread_spin_init)(pthread_spinlock_t *spin, int pshared) {
atomic_store_explicit(&spin->_lock, 0, memory_order_relaxed);
return 0;
}

View file

@ -21,10 +21,6 @@
#include "libc/intrin/strace.internal.h"
#include "libc/thread/thread.h"
#ifdef pthread_spin_lock
#undef pthread_spin_lock
#endif
/**
* Acquires spin lock, e.g.
*
@ -43,7 +39,7 @@
* @see pthread_spin_unlock
* @see pthread_spin_init
*/
errno_t pthread_spin_lock(pthread_spinlock_t *spin) {
errno_t(pthread_spin_lock)(pthread_spinlock_t *spin) {
int x;
#if defined(SYSDEBUG) && _LOCKTRACE
for (;;) {