summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/sh/pthread_arch.h5
-rw-r--r--src/thread/pthread_cancel.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/arch/sh/pthread_arch.h b/arch/sh/pthread_arch.h
index 41fefacf..a7dd27a6 100644
--- a/arch/sh/pthread_arch.h
+++ b/arch/sh/pthread_arch.h
@@ -10,3 +10,8 @@ static inline struct pthread *__pthread_self()
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
#define MC_PC sc_pc
+
+#ifdef __FDPIC__
+#define MC_GOT sc_regs[12]
+#define CANCEL_GOT (*(uintptr_t *)((char *)__syscall_cp_asm+sizeof(uintptr_t)))
+#endif
diff --git a/src/thread/pthread_cancel.c b/src/thread/pthread_cancel.c
index bf07dbeb..5d458af2 100644
--- a/src/thread/pthread_cancel.c
+++ b/src/thread/pthread_cancel.c
@@ -61,6 +61,9 @@ static void cancel_handler(int sig, siginfo_t *si, void *ctx)
if (self->cancelasync || pc >= (uintptr_t)__cp_begin && pc < (uintptr_t)__cp_end) {
uc->uc_mcontext.MC_PC = (uintptr_t)__cp_cancel;
+#ifdef CANCEL_GOT
+ uc->uc_mcontext.MC_GOT = CANCEL_GOT;
+#endif
return;
}