From 808af929bf55cd2b31e354f1903e182b151e8668 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 15 Nov 2016 11:35:28 +0300 Subject: [PATCH] Fix GC_jmp_buf multiple definition This error occurs only if "-fno-common" gcc option is specified. * include/private/gc_priv.h [USE_PROC_FOR_LIBRARIES && THREADS || NEED_FIND_LIMIT] (GC_jmp_buf): Replace variable definition with a declaration (as GC_EXTERN). * os_dep.c [USE_PROC_FOR_LIBRARIES && THREADS || NEED_FIND_LIMIT] (GC_jmp_buf): Define global variable (as GC_INNER). --- include/private/gc_priv.h | 2 +- os_dep.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 979b27f..f1a5185 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -2548,7 +2548,7 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str, #if defined(NEED_FIND_LIMIT) \ || (defined(USE_PROC_FOR_LIBRARIES) && defined(THREADS)) - JMP_BUF GC_jmp_buf; + GC_EXTERN JMP_BUF GC_jmp_buf; /* Set up a handler for address faults which will longjmp to */ /* GC_jmp_buf; */ diff --git a/os_dep.c b/os_dep.c index 98c8832..5a962c1 100644 --- a/os_dep.c +++ b/os_dep.c @@ -898,6 +898,8 @@ GC_INNER size_t GC_page_size = 0; /* Some tools to implement HEURISTIC2 */ # define MIN_PAGE_SIZE 256 /* Smallest conceivable page size, bytes */ + GC_INNER JMP_BUF GC_jmp_buf; + STATIC void GC_fault_handler(int sig GC_ATTR_UNUSED) { LONGJMP(GC_jmp_buf, 1); -- 2.7.4