Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fix compile error for NetBSD/i386 (OCaml 4.02 or later)
--- ocaml-4.02.1/asmrun/signals_osdep.h 2014-09-29 04:46:24.000000000 +0900
+++ ocaml-4.02.1_fix/asmrun/signals_osdep.h 2014-10-05 15:22:24.000000000 +0900
@@ -163,14 +172,24 @@
#elif defined(TARGET_i386) && defined(SYS_bsd_elf)
- #define DECLARE_SIGNAL_HANDLER(name) \
- static void name(int sig, siginfo_t * info, struct sigcontext * context)
+ #if defined (__NetBSD__)
+ #include <ucontext.h>
+ #define DECLARE_SIGNAL_HANDLER(name) \
+ static void name(int sig, siginfo_t * info, ucontext_t * context)
+ #else
+ #define DECLARE_SIGNAL_HANDLER(name) \
+ static void name(int sig, siginfo_t * info, struct sigcontext * context)
+ #endif
#define SET_SIGACT(sigact,name) \
sigact.sa_sigaction = (void (*)(int,siginfo_t *,void *)) (name); \
sigact.sa_flags = SA_SIGINFO
- #define CONTEXT_PC (context->sc_eip)
+ #if defined (__NetBSD__)
+ #define CONTEXT_PC (_UC_MACHINE_PC(context))
+ #else
+ #define CONTEXT_PC (context->sc_eip)
+ #endif
#define CONTEXT_FAULTING_ADDRESS ((char *) info->si_addr)
/****************** I386, BSD */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.