mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-11 21:49:12 +00:00
Get --ftrace working on aarch64
This change implements a new approach to function call logging, that's based on the GCC flag: -fpatchable-function-entry. Read the commentary in build/config.mk to learn how it works.
This commit is contained in:
parent
5b908bc756
commit
eb40cb371d
934 changed files with 2259 additions and 1268 deletions
|
@ -51,7 +51,7 @@ o/$(MODE)/libc/str/wow.o: private \
|
|||
o/$(MODE)/libc/str/wmemset.o \
|
||||
o/$(MODE)/libc/str/memset16.o \
|
||||
o/$(MODE)/libc/str/dosdatetimetounix.o: private \
|
||||
OVERRIDE_CFLAGS += \
|
||||
CFLAGS += \
|
||||
-O3
|
||||
|
||||
o/$(MODE)/libc/str/getzipcdir.o \
|
||||
|
@ -66,14 +66,14 @@ o/$(MODE)/libc/str/getzipcfileuncompressedsize.o \
|
|||
o/$(MODE)/libc/str/getziplfilecompressedsize.o \
|
||||
o/$(MODE)/libc/str/getziplfileuncompressedsize.o \
|
||||
o/$(MODE)/libc/str/getzipcfiletimestamps.o: private \
|
||||
OVERRIDE_CFLAGS += \
|
||||
CFLAGS += \
|
||||
-Os
|
||||
|
||||
o/$(MODE)/libc/str/iswpunct.o \
|
||||
o/$(MODE)/libc/str/iswupper.o \
|
||||
o/$(MODE)/libc/str/iswlower.o \
|
||||
o/$(MODE)/libc/str/iswseparator.o: private \
|
||||
OVERRIDE_CFLAGS += \
|
||||
CFLAGS += \
|
||||
-fno-jump-tables
|
||||
|
||||
o/$(MODE)/libc/str/bcmp.o \
|
||||
|
@ -84,13 +84,13 @@ o/$(MODE)/libc/str/timevaltowindowstime.o \
|
|||
o/$(MODE)/libc/str/timespectowindowstime.o \
|
||||
o/$(MODE)/libc/str/windowstimetotimeval.o \
|
||||
o/$(MODE)/libc/str/windowstimetotimespec.o: private \
|
||||
OVERRIDE_CFLAGS += \
|
||||
CFLAGS += \
|
||||
-O2
|
||||
|
||||
# we can't use compiler magic because:
|
||||
# kprintf() depends on these functions
|
||||
o/$(MODE)/libc/fmt/strsignal.greg.o: private \
|
||||
OVERRIDE_CFLAGS += \
|
||||
CFLAGS += \
|
||||
-fpie \
|
||||
-ffreestanding \
|
||||
$(NO_MAGIC)
|
||||
|
|
|
@ -16,16 +16,8 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/pcmpeqb.h"
|
||||
#include "libc/intrin/pmovmskb.h"
|
||||
#include "libc/intrin/pshufd.h"
|
||||
#include "libc/intrin/punpcklbw.h"
|
||||
#include "libc/intrin/punpcklwd.h"
|
||||
#include "libc/nexgen32e/hascharacter.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
#define V(p) (void *)(p)
|
||||
|
||||
/**
|
||||
* Returns prefix length, consisting of chars not in reject.
|
||||
* a.k.a. Return index of first byte that's in charset.
|
||||
|
@ -35,28 +27,24 @@
|
|||
* @asyncsignalsafe
|
||||
*/
|
||||
size_t strcspn(const char *s, const char *reject) {
|
||||
size_t i, n;
|
||||
unsigned m;
|
||||
char cv[16], sv[16];
|
||||
if ((n = strlen(reject)) < 16) {
|
||||
bzero(sv, 16);
|
||||
memcpy(sv, reject, n);
|
||||
for (i = 0;; ++i) {
|
||||
cv[0] = s[i];
|
||||
punpcklbw(V(cv), V(cv), V(cv));
|
||||
punpcklwd(V(cv), V(cv), V(cv));
|
||||
pshufd(V(cv), V(cv), 0);
|
||||
pcmpeqb(V(cv), V(cv), V(sv));
|
||||
if ((m = pmovmskb(V(cv)))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
int c;
|
||||
size_t i;
|
||||
bool lut[256];
|
||||
#ifndef TINY
|
||||
if (!reject[0]) {
|
||||
return strlen(s);
|
||||
}
|
||||
for (i = 0; s[i]; ++i) {
|
||||
if (HasCharacter(s[i], reject)) {
|
||||
break;
|
||||
if (!reject[1]) {
|
||||
return strchrnul(s, reject[0]) - s;
|
||||
}
|
||||
#endif
|
||||
bzero(lut, sizeof(lut));
|
||||
do {
|
||||
lut[(c = *reject++ & 255)] = true;
|
||||
} while (c);
|
||||
for (i = 0;; i++) {
|
||||
if (lut[s[i] & 255]) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/nexgen32e/hascharacter.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
/**
|
||||
|
@ -27,11 +26,28 @@
|
|||
* @asyncsignalsafe
|
||||
*/
|
||||
size_t strspn(const char *s, const char *accept) {
|
||||
int c;
|
||||
size_t i;
|
||||
for (i = 0; s[i]; ++i) {
|
||||
if (!HasCharacter(s[i], accept)) {
|
||||
break;
|
||||
bool lut[256];
|
||||
#ifndef TINY
|
||||
if (!accept[0]) {
|
||||
return 0;
|
||||
}
|
||||
if (!accept[1]) {
|
||||
for (i = 0;; i++) {
|
||||
if (s[i] != accept[0]) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
bzero(lut, sizeof(lut));
|
||||
while ((c = *accept++ & 255)) {
|
||||
lut[c] = true;
|
||||
}
|
||||
for (i = 0;; i++) {
|
||||
if (!lut[s[i] & 255]) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue