After Ethan's inline assembly patch (to make the upper-level atomic.h
declarations match the lower-level inline definitions -- if they
exist), I've had a problem with the PGI compiler on Linux.
I finally tracked down the issue this morning -- it seems that
OMPI_GCC_INLINE_ASSEMBLY is 0 for the PGI compiler. Hence, none of
the assembly routines are inlined. The logic for the lower layer to
say "these functions aren't inlined" didn't take the value of
OMPI_GCC_INLINE_ASSEMBLY into account, so the upper layer was still
prefixing the declarations with "static inline", which led to linker
problems later.
The below patch fixes the problem for me, but I wanted to run it by
others before committing because it's fairly tangled logic (both
inline for easy reading and attached in case my mail client munges the
formatting).
--
Jeff Squyres
Cisco Systems
Index: opal/include/opal/sys/ia32/atomic.h
===================================================================
--- opal/include/opal/sys/ia32/atomic.h (revision 16997)
+++ opal/include/opal/sys/ia32/atomic.h (working copy)
@@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of
California.
* All rights reserved.
* Copyright (c) 2007 Sun Microsystems, Inc. All rights
reserverd.
+ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserverd.
* $COPYRIGHT$
*
* Additional copyrights may follow
@@ -51,6 +52,21 @@
#undef OPAL_HAVE_INLINE_ATOMIC_CMPSET_64
#define OPAL_HAVE_INLINE_ATOMIC_CMPSET_64 0
+/* If we don't have GCC inline assembly, then nothing is inline */
+#if !OMPI_GCC_INLINE_ASSEMBLY
+#undef OPAL_HAVE_INLINE_ATOMIC_MEM_BARRIER
+#define OPAL_HAVE_INLINE_ATOMIC_MEM_BARRIER 0
+
+#undef OPAL_HAVE_INLINE_ATOMIC_CMPSET_32
+#define OPAL_HAVE_INLINE_ATOMIC_CMPSET_32 0
+
+#undef OPAL_HAVE_INLINE_ATOMIC_ADD_32
+#define OPAL_HAVE_INLINE_ATOMIC_ADD_32 0
+
+#undef OPAL_HAVE_INLINE_ATOMIC_SUB_32
+#define OPAL_HAVE_INLINE_ATOMIC_SUB_32 0
+#endif
+
/
**********************************************************************
*
* Memory Barriers
Index: opal/include/opal/sys/amd64/atomic.h
===================================================================
--- opal/include/opal/sys/amd64/atomic.h (revision 16997)
+++ opal/include/opal/sys/amd64/atomic.h (working copy)
@@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of
California.
* All rights reserved.
* Copyright (c) 2007 Sun Microsystems, Inc. All rights
reserverd.
+ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserverd.
* $COPYRIGHT$
*
* Additional copyrights may follow
@@ -44,7 +45,18 @@
#define OPAL_HAVE_ATOMIC_CMPSET_64 1
+/* If we don't have GCC inline assembly, then nothing is inline */
+#if !OMPI_GCC_INLINE_ASSEMBLY
+#undef OPAL_HAVE_INLINE_ATOMIC_CMPSET_32
+#define OPAL_HAVE_INLINE_ATOMIC_CMPSET_32 0
+#undef OPAL_HAVE_INLINE_ATOMIC_CMPSET_64
+#define OPAL_HAVE_INLINE_ATOMIC_CMPSET_64 0
+
+#undef OPAL_HAVE_INLINE_ATOMIC_MEM_BARRIER
+#define OPAL_HAVE_INLINE_ATOMIC_MEM_BARRIER 0
+#endif
+
/
**********************************************************************
*
* Memory Barriers
|