Use __builtin_extract_return_addr in GC_RETURN_ADDR_PARENT (gcc/x86)
authorIvan Maidanski <ivmai@mail.ru>
Sun, 25 Aug 2013 05:59:42 +0000 (09:59 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 25 Aug 2013 18:42:39 +0000 (22:42 +0400)
* 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

index e652593..7e96757 100644 (file)
     /* 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.       */