From 5b1b13f7cab36ef270a7f05e585b7d295b3d3a86 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 9303e74d..6219c274 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -2509,7 +2509,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 2a4ef5a2..d81678c9 100644 --- a/os_dep.c +++ b/os_dep.c @@ -901,6 +901,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