From e6018f57838f85f75c092034678b60fef7d23f50 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sun, 25 Aug 2013 09:59:42 +0400 Subject: [PATCH] Use __builtin_extract_return_addr in GC_RETURN_ADDR_PARENT (gcc/x86) * include/gc_config_macros.h (GC_RETURN_ADDR_PARENT): Use __builtin_extract_return_addr (since the address passed to dladdr); do not define the macro for GCC pre-v4. --- include/gc_config_macros.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h index e652593..7e96757 100644 --- a/include/gc_config_macros.h +++ b/include/gc_config_macros.h @@ -323,9 +323,10 @@ /* gcc knows how to retrieve return address, but we don't know */ /* how to generate call stacks. */ # define GC_RETURN_ADDR (GC_word)__builtin_return_address(0) -# if defined(__i386__) || defined(__amd64__) \ - || defined(__x86_64__) /* and probably others... */ -# define GC_RETURN_ADDR_PARENT (GC_word)__builtin_return_address(1) +# if (__GNUC__ >= 4) && (defined(__i386__) || defined(__amd64__) \ + || defined(__x86_64__) /* and probably others... */) +# define GC_RETURN_ADDR_PARENT \ + (GC_word)__builtin_extract_return_addr(__builtin_return_address(1)) # endif # else /* Just pass 0 for gcc compatibility. */ -- 2.7.4