diff options
author | Tristan Gingold | 2015-09-30 20:59:13 +0200 |
---|---|---|
committer | Tristan Gingold | 2015-09-30 20:59:13 +0200 |
commit | f6d7e8c9b4746ea50a8c10892e3d28ce8d1020cb (patch) | |
tree | 7ff67c3f21fe4fa8c6b679259de0b11b3bf3751e | |
parent | 254d75df6af86b768ab2ae007a916b6682142c8e (diff) | |
download | ghdl-f6d7e8c9b4746ea50a8c10892e3d28ce8d1020cb.tar.gz ghdl-f6d7e8c9b4746ea50a8c10892e3d28ce8d1020cb.tar.bz2 ghdl-f6d7e8c9b4746ea50a8c10892e3d28ce8d1020cb.zip |
Fix build of jumps.c on i386/linux.
-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) { |