From: James Lentini Date: Wed, 28 Sep 2005 21:50:13 +0000 (+0000) Subject: r3606: Fixes IA64 build problems (atomics) with the latest Redhat EL4.0 update and X-Git-Tag: libdapl-1.2.1~76 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=634b199218b775a8ed071c1faea519c4cc4ee4e3;p=~ardavis%2Fdapl.git r3606: Fixes IA64 build problems (atomics) with the latest Redhat EL4.0 update and adds support for SuSe. Signed-off by: Arlin Davis Signed-off by: James Lentini --- diff --git a/dapl/common/dapl_evd_free.c b/dapl/common/dapl_evd_free.c index 2f41c0d..ab4ce7e 100644 --- a/dapl/common/dapl_evd_free.c +++ b/dapl/common/dapl_evd_free.c @@ -113,7 +113,7 @@ DAT_RETURN dapl_evd_free ( #else if (cno_ptr != NULL) { - if (cno_ptr->cno_ref_count == 0 && cno_ptr->cno_waiters > 0) + if (dapl_os_atomic_read(&cno_ptr->cno_ref_count) == 0 && cno_ptr->cno_waiters > 0) { /* * Last reference on the CNO, trigger a notice. See diff --git a/dapl/udapl/Makefile b/dapl/udapl/Makefile index b6885e1..1cee32e 100644 --- a/dapl/udapl/Makefile +++ b/dapl/udapl/Makefile @@ -56,6 +56,13 @@ ifndef $VERBS VERBS=openib endif +# +# Set an OS Vendor +# +# OS_VENDOR = REDHAT_EL4 +# OS_VENDOR = SuSE +# + # # CFLAGS definition # @@ -67,7 +74,7 @@ endif # CFLAGS Compile time flags for build # -CFLAGS = -O2 $(CPPFLAGS) -DOS_VERSION=$(OSRELEASE) -DDAPL_DBG +CFLAGS = -O2 $(CPPFLAGS) -D$(OS_VENDOR) -DOS_VERSION=$(OSRELEASE) -DDAPL_DBG # # dummy provider @@ -152,15 +159,12 @@ CFLAGS += -Wmissing-declarations CFLAGS += --no-strict-aliasing CFLAGS += -Werror CFLAGS += -g3 +CFLAGS += -fPIC ifdef GPROF CFLAGS += -pg endif -ifeq (${MACH},x86_64) -CFLAGS += -fPIC -endif - LD = ld # @@ -170,6 +174,10 @@ LDFLAGS = -shared LDFLAGS += -lpthread LDFLAGS += -init dapl_init LDFLAGS += -fini dapl_fini +ifeq ($(OS_VENDOR),SuSE) +LDFLAGS += -lgcc_s +endif + AR = ar # diff --git a/dapl/udapl/dapl_cno_free.c b/dapl/udapl/dapl_cno_free.c index 54227ca..cf9d7ef 100644 --- a/dapl/udapl/dapl_cno_free.c +++ b/dapl/udapl/dapl_cno_free.c @@ -74,7 +74,7 @@ DAT_RETURN dapl_cno_free( goto bail; } - if (cno_ptr->cno_ref_count != 0 + if (dapl_os_atomic_read(&cno_ptr->cno_ref_count) != 0 || cno_ptr->cno_waiters != 0) { dat_status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_STATE_CNO_IN_USE); diff --git a/dapl/udapl/linux/dapl_osd.h b/dapl/udapl/linux/dapl_osd.h index 1dfd542..97d0a72 100644 --- a/dapl/udapl/linux/dapl_osd.h +++ b/dapl/udapl/linux/dapl_osd.h @@ -83,7 +83,6 @@ #include #endif - /* Useful debug definitions */ #ifndef STATIC #define STATIC static @@ -156,11 +155,11 @@ dapl_os_atomic_inc ( #ifdef __ia64__ DAT_COUNT old_value; -#if OS_VERSION >= LINUX_VERSION(2,6) - IA64_FETCHADD (old_value,v,1,4,rel); -#else - IA64_FETCHADD (old_value,v,1,4); -#endif +# if !defined(REDHAT_EL4) && (OS_RELEASE >= LINUX_VERSION(2,6)) + IA64_FETCHADD(old_value,v,1,4,rel); +# else + IA64_FETCHADD(old_value,v,1,4); +# endif #else /* !__ia64__ */ __asm__ __volatile__ ( @@ -184,11 +183,11 @@ dapl_os_atomic_dec ( #ifdef __ia64__ DAT_COUNT old_value; -#if OS_VERSION >= LINUX_VERSION(2,6) - IA64_FETCHADD (old_value,v,-1,4,rel); -#else - IA64_FETCHADD (old_value,v,-1,4); -#endif +# if !defined(REDHAT_EL4) && (OS_RELEASE >= LINUX_VERSION(2,6)) + IA64_FETCHADD(old_value,v,-1,4,rel); +# else + IA64_FETCHADD(old_value,v,-1,4); +# endif #else /* !__ia64__ */ __asm__ __volatile__ ( @@ -227,9 +226,11 @@ dapl_os_atomic_assign ( */ #ifdef __ia64__ - -current_value = ia64_cmpxchg("acq",v,match_value,new_value,4); - +#ifdef REDHAT_EL4 + current_value = ia64_cmpxchg("acq",v,match_value,new_value,4); +#else + current_value = ia64_cmpxchg(acq,v,match_value,new_value,4); +#endif #else __asm__ __volatile__ ( "lock; cmpxchgl %1, %2"