Fix MODE=optlinux and MODE=tiny builds

This commit is contained in:
Justine Tunney 2024-07-23 04:04:19 -07:00
parent 5660ec4741
commit 0602ff6bab
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
12 changed files with 75 additions and 36 deletions

View file

@ -51,10 +51,13 @@ void CrashHandler(int sig, siginfo_t *si, void *ctx) {
longjmp(recover, 123);
}
int StackOverflow(void);
int (*pStackOverflow)(void) = StackOverflow;
int StackOverflow(void) {
return pStackOverflow();
int StackOverflow(int d) {
char A[8];
for (int i = 0; i < sizeof(A); i++)
A[i] = d + i;
if (__veil("r", d))
return StackOverflow(d + 1) + A[d % sizeof(A)];
return 0;
}
void *MyPosixThread(void *arg) {
@ -71,7 +74,7 @@ void *MyPosixThread(void *arg) {
sigaction(SIGBUS, &sa, &o1);
sigaction(SIGSEGV, &sa, &o2);
if (!(jumpcode = setjmp(recover))) {
exit(pStackOverflow());
exit(StackOverflow(0));
}
ASSERT_EQ(123, jumpcode);
sigaction(SIGSEGV, &o2, 0);