libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compilation error on RHEL 6.5 ppc64: __ATOMIC_RELAXED is not defined


From: John DelSignore
Subject: Compilation error on RHEL 6.5 ppc64: __ATOMIC_RELAXED is not defined
Date: Mon, 2 Dec 2019 22:34:39 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

Hi,

I'm trying to build the libunwind v1.4-stable branch on a RHEL 6.5 ppc64 
system. The compiler is: gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4). Here's the 
error:

libtool: compile:  /usr/bin/gcc -fsigned-char -m64 -Wl,--as-needed -g 
-DHAVE_CONFIG_H -I. -I../../LIBUnwind/src -I../include 
-I../../LIBUnwind/include -I../../LIBUnwind/include/tdep-ppc64 -I. 
-D_GNU_SOURCE -DDEBUG -fexceptions -Wall -Wsign-compare -MT dwarf/Lparser.lo 
-MD -MP -MF dwarf/.deps/Lparser.Tpo -c ../../LIBUnwind/src/dwarf/Lparser.c  
-fPIC -DPIC -o dwarf/.libs/Lparser.o
In file included from ../../LIBUnwind/src/dwarf/Lparser.c:4:
../../LIBUnwind/src/dwarf/Gparser.c: In function 'get_rs_cache':
../../LIBUnwind/src/dwarf/Gparser.c:613: warning: implicit declaration of 
function '__atomic_load_n'
../../LIBUnwind/src/dwarf/Gparser.c:613: error: '__ATOMIC_RELAXED' undeclared 
(first use in this function)
../../LIBUnwind/src/dwarf/Gparser.c:613: error: (Each undeclared identifier is 
reported only once
../../LIBUnwind/src/dwarf/Gparser.c:613: error: for each function it appears 
in.)

I'm not sure what is the "right" way to fix this, but the following change 
seems to allow it to compile:

diff --git a/3rdparty/libunwind/LIBUnwind/include/libunwind_i.h 
b/3rdparty/libunwind/LIBUnwind/include/libunwind_i.h
index e0f4540..09356b2 100644
--- a/3rdparty/libunwind/LIBUnwind/include/libunwind_i.h
+++ b/3rdparty/libunwind/LIBUnwind/include/libunwind_i.h
@@ -165,7 +165,11 @@ cmpxchg_ptr (void *addr, void *old, void *new)
 }
 # define fetch_and_add1(_ptr)           __sync_fetch_and_add(_ptr, 1)
 # define fetch_and_add(_ptr, value)     __sync_fetch_and_add(_ptr, value)
-# define atomic_read(ptr) (__atomic_load_n(ptr,__ATOMIC_RELAXED))
+# if defined(__ATOMIC_RELAXED)
+#  define atomic_read(ptr) (__atomic_load_n(ptr,__ATOMIC_RELAXED))
+# else
+#  define atomic_read(ptr) (__sync_fetch_and_add(ptr, 0))
+# endif
 # define HAVE_CMPXCHG
 # define HAVE_FETCH_AND_ADD
 #endif

AFAIK, adding 0 to *ptr with __sync_fetch_and_add() should be equivalent to 
__atomic_load_n(), and more portable because the code already uses 
__sync_fetch_and_add() just a few lines above. Does that change look OK or is 
something different needed? Should I file a bug report or is RHEL 6.5 no longer 
supported?

Thanks, John D.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]