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:
Justine Tunney 2023-06-05 23:35:31 -07:00
parent 5b908bc756
commit eb40cb371d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
934 changed files with 2259 additions and 1268 deletions

View file

@ -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;
}