mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-05 10:48:29 +00:00
Get TEST_LIBC_CALLS passing on AARCH64
This commit is contained in:
parent
802e7eb4ef
commit
ba49e86e20
22 changed files with 65 additions and 7 deletions
|
@ -64,9 +64,12 @@ int raise(int sig) {
|
|||
if (sig == SIGTRAP) {
|
||||
DebugBreak();
|
||||
rc = 0;
|
||||
#ifndef __aarch64__
|
||||
} else if (sig == SIGFPE) {
|
||||
// TODO(jart): Why doesn't AARCH64 raise SIGFPE?
|
||||
RaiseSigFpe();
|
||||
rc = 0;
|
||||
#endif
|
||||
} else if (!IsWindows() && !IsMetal()) {
|
||||
rc = sys_tkill(gettid(), sig, 0);
|
||||
} else {
|
||||
|
|
|
@ -96,10 +96,12 @@ static const struct sock_filter kUnveilBlacklistLatestAbi[] = {
|
|||
};
|
||||
|
||||
static int landlock_abi_version;
|
||||
static int landlock_abi_errno;
|
||||
|
||||
__attribute__((__constructor__)) void init_landlock_version() {
|
||||
landlock_abi_version =
|
||||
landlock_create_ruleset(0, 0, LANDLOCK_CREATE_RULESET_VERSION);
|
||||
landlock_abi_errno = errno;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,6 +155,7 @@ static int unveil_init(void) {
|
|||
int rc, fd;
|
||||
State.fs_mask = UNVEIL_READ | UNVEIL_WRITE | UNVEIL_EXEC | UNVEIL_CREATE;
|
||||
if (landlock_abi_version == -1) {
|
||||
errno = landlock_abi_errno;
|
||||
if (errno == EOPNOTSUPP) {
|
||||
errno = ENOSYS;
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ typedef char __intrin_xmm_t _Vector_size(16) forcealign(16) mayalias;
|
|||
#define INTRIN_SSEVEX_X_X_X_(PURE, ISA, OP, FLAGS, A, B, C) PURE(A, B, C)
|
||||
#define INTRIN_SSEVEX_X_X_I_(PURE, ISA, OP, A, B, I) PURE(A, B, I)
|
||||
#define INTRIN_SSEVEX_X_I_(PURE, ISA, OP, A, B, I) PURE(A, B, I)
|
||||
#define INTRIN_SSEVEX_X_X_(PURE, ISA, OP, A, B) PURE(A, B)
|
||||
#endif /* X86 && !ANSI */
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "ape/sections.internal.h"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/rusage.internal.h"
|
||||
#include "libc/calls/struct/siginfo.h"
|
||||
|
@ -110,7 +111,7 @@ static const char *ColorRegister(int r) {
|
|||
static bool AppendFileLine(struct Buffer *b, const char *addr2line,
|
||||
const char *debugbin, long addr) {
|
||||
ssize_t rc;
|
||||
char buf[128];
|
||||
char *p, *q, buf[128];
|
||||
int j, k, ws, pid, pfd[2];
|
||||
if (!debugbin || !*debugbin) return false;
|
||||
if (!addr2line || !*addr2line) return false;
|
||||
|
@ -139,6 +140,14 @@ static bool AppendFileLine(struct Buffer *b, const char *addr2line,
|
|||
while ((rc = sys_read(pfd[0], buf, sizeof(buf))) > 0) {
|
||||
Append(b, "%.*s", (int)rc, buf);
|
||||
}
|
||||
// remove the annoying `foo.c:123 (discriminator 3)` suffixes, because
|
||||
// they break emacs, and who on earth knows what those things mean lol
|
||||
while ((p = memmem(b->p + k, b->i - k, " (discriminator ", 16)) &&
|
||||
(q = memchr(p + 16, '\n', (b->p + b->i) - (p + 16)))) {
|
||||
memmove(p, q, (b->p + b->i) - q);
|
||||
b->i -= q - p;
|
||||
}
|
||||
// mop up after the process and sanity check captured text
|
||||
sys_close(pfd[0]);
|
||||
if (sys_wait4(pid, &ws, 0, 0) != -1 && !ws && b->p[k] != ':' &&
|
||||
b->p[k] != '?' && b->p[b->i - 1] == '\n') {
|
||||
|
|
|
@ -64,6 +64,7 @@ sys_clone_linux:
|
|||
cbz x0,2f
|
||||
ret
|
||||
2: mov x0,x6 // child thread
|
||||
ldr w1,[x4] // arg2 = *ctid
|
||||
blr x5
|
||||
mov x8,#93 // __NR_exit
|
||||
svc #0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue