From 824932194eaab21a96fa74e972d467c58043c44e 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 73eb48cd..efab8de7 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -2543,7 +2543,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 a649b598..00323266 100644 --- a/os_dep.c +++ b/os_dep.c @@ -902,6 +902,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.40.0