diff options
author | Tristan Gingold | 2015-09-30 20:59:13 +0200 |
---|---|---|
committer | Tristan Gingold | 2015-09-30 20:59:13 +0200 |
commit | 0bf4bb4bd306c1f038aa5cb9c96cdb83d7846f87 (patch) | |
tree | 1c25020687c452a0da31ee417d8d2ceaf980002d /src/grt | |
parent | 15449f26754603d49ea2ba4f58a2b2f3495a6568 (diff) | |
download | ghdl-0bf4bb4bd306c1f038aa5cb9c96cdb83d7846f87.tar.gz ghdl-0bf4bb4bd306c1f038aa5cb9c96cdb83d7846f87.tar.bz2 ghdl-0bf4bb4bd306c1f038aa5cb9c96cdb83d7846f87.zip |
Fix build of jumps.c on i386/linux.
Diffstat (limited to 'src/grt')
-rw-r--r-- | src/grt/config/jumps.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/grt/config/jumps.c b/src/grt/config/jumps.c index 775225e..a544f83 100644 --- a/src/grt/config/jumps.c +++ b/src/grt/config/jumps.c @@ -24,10 +24,15 @@ covered by the GNU Public License. */ +#define _GNU_SOURCE #include <stddef.h> #include <signal.h> #include <fcntl.h> + +#if defined (__linux__) && defined (__i386__) +/* On i386/Linux, the context must be inspected. */ #include <sys/ucontext.h> +#endif /* There is a simple setjmp/longjmp mechanism used to report failures. We have the choice between 3 mechanisms: @@ -37,11 +42,10 @@ */ #if defined (__GNUC__) && !defined (__clang__) -#define USE_BUILTIN_SJLJ +# define USE_BUILTIN_SJLJ #else -#define USE__SETJMP +# define USE__SETJMP #endif -/* #define USE_SETJMP */ #ifdef USE_BUILTIN_SJLJ typedef void *JMP_BUF[5]; @@ -88,6 +92,8 @@ static struct sigaction prev_sigsegv_act; static void grt_sigsegv_handler (int signo, siginfo_t *info, void *ptr) { #if defined (__linux__) && defined (__i386__) + ucontext_t *uctxt = (ucontext_t *)ptr; + /* Linux generates a SIGSEGV (!) for an overflow exception. */ if (uctxt->uc_mcontext.gregs[REG_TRAPNO] == 4) { |