diff --git a/blink/describeflags.c b/blink/describeflags.c index 0ba25281..b6b14f56 100644 --- a/blink/describeflags.c +++ b/blink/describeflags.c @@ -20,7 +20,7 @@ #include -const char *DescribeFlags(char *p, size_t n, const struct DescribeFlags *d, +const char *DescribeFlagz(char *p, size_t n, const struct DescribeFlagz *d, size_t m, const char *prefix, unsigned x) { bool t; char b[21]; diff --git a/blink/describeflags.h b/blink/describeflags.h index bd4bb7a4..7cc265ce 100644 --- a/blink/describeflags.h +++ b/blink/describeflags.h @@ -4,12 +4,12 @@ #include "blink/builtin.h" -struct DescribeFlags { +struct DescribeFlagz { unsigned flag; const char *name; }; -const char *DescribeFlags(char *, size_t, const struct DescribeFlags *, size_t, +const char *DescribeFlagz(char *, size_t, const struct DescribeFlagz *, size_t, const char *, unsigned); #endif /* BLINK_DESCRIBEFLAGS_H_ */ diff --git a/blink/strace.c b/blink/strace.c index 57f53f24..57004146 100644 --- a/blink/strace.c +++ b/blink/strace.c @@ -52,13 +52,13 @@ static const char *const kOpenAccmode[] = { "O_RDWR", // }; -static const struct DescribeFlags kAccessModes[] = { +static const struct DescribeFlagz kAccessModes[] = { {R_OK_LINUX, "R_OK"}, // {W_OK_LINUX, "W_OK"}, // {X_OK_LINUX, "X_OK"}, // }; -static const struct DescribeFlags kOpenFlags[] = { +static const struct DescribeFlagz kOpenFlags[] = { {O_APPEND_LINUX, "APPEND"}, // {O_CREAT_LINUX, "CREAT"}, // {O_EXCL_LINUX, "EXCL"}, // @@ -78,7 +78,7 @@ static const struct DescribeFlags kOpenFlags[] = { {O_DSYNC_LINUX, "DSYNC"}, // }; -static const struct DescribeFlags kProtFlags[] = { +static const struct DescribeFlagz kProtFlags[] = { {PROT_READ_LINUX, "READ"}, // {PROT_WRITE_LINUX, "WRITE"}, // {PROT_EXEC_LINUX, "EXEC"}, // @@ -87,7 +87,7 @@ static const struct DescribeFlags kProtFlags[] = { {PROT_GROWSUP_LINUX, "GROWSUP"}, // }; -static const struct DescribeFlags kMapFlags[] = { +static const struct DescribeFlagz kMapFlags[] = { {MAP_SHARED_LINUX, "SHARED"}, // {MAP_PRIVATE_LINUX, "PRIVATE"}, // {MAP_FIXED_LINUX, "FIXED"}, // @@ -103,7 +103,7 @@ static const struct DescribeFlags kMapFlags[] = { {MAP_UNINITIALIZED_LINUX, "UNINITIALIZED"}, // }; -static const struct DescribeFlags kSaFlags[] = { +static const struct DescribeFlagz kSaFlags[] = { {SA_NOCLDSTOP_LINUX, "NOCLDSTOP"}, // {SA_NOCLDWAIT_LINUX, "NOCLDWAIT"}, // {SA_SIGINFO_LINUX, "SIGINFO"}, // @@ -116,7 +116,7 @@ static const struct DescribeFlags kSaFlags[] = { {SA_RESETHAND_LINUX, "RESETHAND"}, // }; -static const struct DescribeFlags kAtFlags[] = { +static const struct DescribeFlagz kAtFlags[] = { {AT_SYMLINK_NOFOLLOW_LINUX, "SYMLINK_NOFOLLOW"}, // {AT_REMOVEDIR_LINUX, "REMOVEDIR"}, // {AT_EACCESS_LINUX, "EACCESS"}, // @@ -125,7 +125,7 @@ static const struct DescribeFlags kAtFlags[] = { }; #ifndef DISABLE_THREADS -static const struct DescribeFlags kCloneFlags[] = { +static const struct DescribeFlagz kCloneFlags[] = { {CLONE_VM_LINUX, "VM"}, // {CLONE_THREAD_LINUX, "THREAD"}, // {CLONE_FS_LINUX, "FS"}, // @@ -149,7 +149,7 @@ static const struct DescribeFlags kCloneFlags[] = { #endif #ifndef DISABLE_NONPOSIX -static const struct DescribeFlags kRenameFlags[] = { +static const struct DescribeFlagz kRenameFlags[] = { {RENAME_NOREPLACE_LINUX, "NOREPLACE"}, // {RENAME_EXCHANGE_LINUX, "EXCHANGE"}, // {RENAME_WHITEOUT_LINUX, "WHITEOUT"}, // @@ -157,7 +157,7 @@ static const struct DescribeFlags kRenameFlags[] = { #endif #ifdef HAVE_FORK -static const struct DescribeFlags kWaitFlags[] = { +static const struct DescribeFlagz kWaitFlags[] = { {WNOHANG_LINUX, "WNOHANG"}, // {WUNTRACED_LINUX, "WUNTRACED"}, // {WEXITED_LINUX, "WEXITED"}, // @@ -170,7 +170,7 @@ static const struct DescribeFlags kWaitFlags[] = { #endif #ifndef DISABLE_SOCKETS -static const struct DescribeFlags kSockFlags[] = { +static const struct DescribeFlagz kSockFlags[] = { {SOCK_CLOEXEC_LINUX, "CLOEXEC"}, // {SOCK_NONBLOCK_LINUX, "NONBLOCK"}, // }; @@ -456,13 +456,13 @@ void Strace(struct Machine *m, const char *func, bool isentry, const char *fmt, if (!arg) { APPEND("F_OK"); } else { - DescribeFlags(tmp, sizeof(tmp), kAccessModes, ARRAYLEN(kAccessModes), + DescribeFlagz(tmp, sizeof(tmp), kAccessModes, ARRAYLEN(kAccessModes), "", arg); APPEND("%s", tmp); } #ifdef HAVE_FORK } else if (c == I32_WAITFLAGS[0]) { - DescribeFlags(tmp, sizeof(tmp), kWaitFlags, ARRAYLEN(kWaitFlags), "", + DescribeFlagz(tmp, sizeof(tmp), kWaitFlags, ARRAYLEN(kWaitFlags), "", arg); APPEND("%s", tmp); } else if (c == O_WSTATUS[0]) { @@ -484,14 +484,14 @@ void Strace(struct Machine *m, const char *func, bool isentry, const char *fmt, #endif } else if (c == I32_PROT[0]) { if (arg) { - DescribeFlags(tmp, sizeof(tmp), kProtFlags, ARRAYLEN(kProtFlags), + DescribeFlagz(tmp, sizeof(tmp), kProtFlags, ARRAYLEN(kProtFlags), "PROT_", arg); APPEND("%s", tmp); } else { APPEND("PROT_NONE"); } } else if (c == I32_MAPFLAGS[0]) { - DescribeFlags(tmp, sizeof(tmp), kMapFlags, ARRAYLEN(kMapFlags), "MAP_", + DescribeFlagz(tmp, sizeof(tmp), kMapFlags, ARRAYLEN(kMapFlags), "MAP_", arg); APPEND("%s", tmp); } else if (c == I32_OFLAGS[0]) { @@ -501,7 +501,7 @@ void Strace(struct Machine *m, const char *func, bool isentry, const char *fmt, arg2 &= ~O_ACCMODE_LINUX; } if (arg2) { - DescribeFlags(tmp, sizeof(tmp), kOpenFlags, ARRAYLEN(kOpenFlags), "O_", + DescribeFlagz(tmp, sizeof(tmp), kOpenFlags, ARRAYLEN(kOpenFlags), "O_", arg2); APPEND("|%s", tmp); } @@ -509,11 +509,11 @@ void Strace(struct Machine *m, const char *func, bool isentry, const char *fmt, ++i; // ignore mode } } else if (c == I32_ATFLAGS[0]) { - DescribeFlags(tmp, sizeof(tmp), kAtFlags, ARRAYLEN(kAtFlags), "AT_", arg); + DescribeFlagz(tmp, sizeof(tmp), kAtFlags, ARRAYLEN(kAtFlags), "AT_", arg); APPEND("%s", tmp); #ifndef DISABLE_THREADS } else if (c == I32_CLONEFLAGS[0]) { - DescribeFlags(tmp, sizeof(tmp), kCloneFlags, ARRAYLEN(kCloneFlags), + DescribeFlagz(tmp, sizeof(tmp), kCloneFlags, ARRAYLEN(kCloneFlags), "CLONE_", arg); APPEND("%s", tmp); #endif @@ -627,7 +627,7 @@ void Strace(struct Machine *m, const char *func, bool isentry, const char *fmt, break; } if (Read64(sa->flags)) { - DescribeFlags(tmp, sizeof(tmp), kSaFlags, ARRAYLEN(kSaFlags), "SA_", + DescribeFlagz(tmp, sizeof(tmp), kSaFlags, ARRAYLEN(kSaFlags), "SA_", Read64(sa->flags)); APPEND(", .sa_flags=%s", tmp); } @@ -670,7 +670,7 @@ void Strace(struct Machine *m, const char *func, bool isentry, const char *fmt, APPEND("%s", GetMagicNumber(kClock, ARRAYLEN(kClock), arg)); #ifndef DISABLE_SOCKETS } else if (c == I32_SOCKFLAGS[0]) { - DescribeFlags(tmp, sizeof(tmp), kSockFlags, ARRAYLEN(kSockFlags), "SOCK_", + DescribeFlagz(tmp, sizeof(tmp), kSockFlags, ARRAYLEN(kSockFlags), "SOCK_", arg); APPEND("%s", tmp); } else if (IS_ADDR(c)) { @@ -704,7 +704,7 @@ void Strace(struct Machine *m, const char *func, bool isentry, const char *fmt, #endif #ifndef DISABLE_NONPOSIX } else if (c == I32_RENFLAGS[0]) { - DescribeFlags(tmp, sizeof(tmp), kRenameFlags, ARRAYLEN(kRenameFlags), + DescribeFlagz(tmp, sizeof(tmp), kRenameFlags, ARRAYLEN(kRenameFlags), "RENAME_", arg); APPEND("%s", tmp); #endif @@ -750,7 +750,7 @@ void Strace(struct Machine *m, const char *func, bool isentry, const char *fmt, } } else if (arg == F_SETFL_LINUX) { i32 flags = va_arg(va, i64); - DescribeFlags(tmp, sizeof(tmp), kOpenFlags, ARRAYLEN(kOpenFlags), "O_", + DescribeFlagz(tmp, sizeof(tmp), kOpenFlags, ARRAYLEN(kOpenFlags), "O_", flags); APPEND("%s", tmp); } else if (arg == F_SETOWN_LINUX) { diff --git a/blink/tunables.h b/blink/tunables.h index 907a6429..b5fe6e7d 100644 --- a/blink/tunables.h +++ b/blink/tunables.h @@ -17,7 +17,7 @@ #define LINUX_VERSION MKVERSION(LINUX_MAJOR, LINUX_MINOR, LINUX_PATCH) #define BLINK_VERSION MKVERSION(BLINK_MAJOR, BLINK_MINOR, BLINK_PATCH) -#if CAN_64BIT && (defined(__APPLE__) || defined(__COSMOPOLITAN__)) +#if CAN_64BIT && defined(__APPLE__) #define kSkew 0x088800000000 #else #define kSkew 0x000000000000 diff --git a/configure b/configure index e91a8c0f..44d7f2b3 100755 --- a/configure +++ b/configure @@ -548,6 +548,12 @@ if config noop "checking for -fno-stack-protector... "; then UOPFLAGS="-fno-stack-protector ${UOPFLAGS}" fi +# avoid cosmo libc function call tracing messing up micro-ops +EXTRA_CFLAGS=-fpatchable-function-entry=0,0 +if config noop "checking for -fpatchable-function-entry=0,0... "; then + UOPFLAGS="-fpatchable-function-entry=0,0 ${UOPFLAGS}" +fi + # avoid creating stack frames in micro-op functions if [ "${MODE}" != "prof" ]; then EXTRA_CFLAGS=-fomit-frame-pointer