Skip to content

Commit 62dbe57

Browse files
brad0korli
andauthored
[compiler-rt][sanitizer] fix i386 build for Haiku (#171075)
r13 does not provide the trap err. Co-authored-by: Jerome Duval <[email protected]>
1 parent 56e092c commit 62dbe57

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ uptr GetPageSize() {
12871287

12881288
uptr ReadBinaryName(/*out*/ char *buf, uptr buf_len) {
12891289
# if SANITIZER_HAIKU
1290-
int cookie = 0;
1290+
int32_t cookie = 0;
12911291
image_info info;
12921292
const char *argv0 = "<UNKNOWN>";
12931293
while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
@@ -1987,7 +1987,10 @@ SignalContext::WriteFlag SignalContext::GetWriteFlag() const {
19871987
# elif SANITIZER_NETBSD
19881988
uptr err = ucontext->uc_mcontext.__gregs[_REG_ERR];
19891989
# elif SANITIZER_HAIKU
1990-
uptr err = ucontext->uc_mcontext.r13;
1990+
uptr err = 0; // FIXME: ucontext->uc_mcontext.r13;
1991+
// The err register was added on the main branch and not
1992+
// available with the current release. To be reverted later.
1993+
// https://github.com/haiku/haiku/commit/11adda21aa4e6b24f71a496868a44d7607bc3764
19911994
# elif SANITIZER_SOLARIS && defined(__i386__)
19921995
const int Err = 13;
19931996
uptr err = ucontext->uc_mcontext.gregs[Err];
@@ -2617,6 +2620,11 @@ static void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
26172620
*pc = ucontext->uc_mcontext.mc_eip;
26182621
*bp = ucontext->uc_mcontext.mc_ebp;
26192622
*sp = ucontext->uc_mcontext.mc_esp;
2623+
# elif SANITIZER_HAIKU
2624+
ucontext_t *ucontext = (ucontext_t *)context;
2625+
*pc = ucontext->uc_mcontext.eip;
2626+
*bp = ucontext->uc_mcontext.ebp;
2627+
*sp = ucontext->uc_mcontext.esp;
26202628
# else
26212629
ucontext_t *ucontext = (ucontext_t *)context;
26222630
# if SANITIZER_SOLARIS

compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ typedef unsigned long __sanitizer_sigset_t;
629629
# elif SANITIZER_APPLE
630630
typedef unsigned __sanitizer_sigset_t;
631631
# elif SANITIZER_HAIKU
632-
typedef unsigned long __sanitizer_sigset_t;
632+
typedef unsigned long long __sanitizer_sigset_t;
633633
# elif SANITIZER_LINUX
634634
struct __sanitizer_sigset_t {
635635
// The size is determined by looking at sizeof of real sigset_t on linux.

0 commit comments

Comments
 (0)