[Gc] Missed AO_compare_and_swap_full on Solaris 10 SPARC building

Claudio A. Costagliola Fiedler claudio.costagliola at gmail.com
Thu Sep 15 11:57:14 PDT 2011


Ivan,

I repeated the configuration process defining AO_REQUIRE_CAS in the test, as
you told me. The results were the same. I think this is rather a problem
with libatomic_ops building as the AO_compare_and_swap_full symbol is not
build at all. You can see evidence in this conversation thread. The client
of the library (in this case erlang) may or may not define AO_REQUIRE_CAS,
but when it links with the library to find the implementation of
AO_compare_and_swap_full it doesn't find it.

Here is the test:
configure:10588: checking for a usable libatomic_ops implementation
configure:10630: cc -o conftest -m32 -g
-I/desarrollo/proyectos/ps2mix09003/claudio/build/erlangR14B03/otp_src_R14B03/erts/sparc
-sun-solaris2.10  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-DAO_REQUIRE_CAS   -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -D_P
OSIX_PTHREAD_SEMANTICS
-I/desarrollo/proyectos/ps2mix09003/claudio/build/erlangR14B03/LIBATOMIC/include
-m32   conftest.c -ldl -
lm   -lpthread  -lkstat >&5
Undefined                       first referenced
 symbol                             in file
AO_compare_and_swap_emulation       conftest.o
AO_compare_double_and_swap_double_emulation conftest.o
AO_store_full_emulation             conftest.o
AO_test_and_set_full                conftest.o
ld: fatal: Symbol referencing errors. No output written to conftest
configure:10636: $? = 1
configure: failed program was:
| /* confdefs.h.  */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define SIZEOF_VOID_P 4
| #define HAVE_LIBM 1
| #define HAVE_LIBDL 1
| #define HAVE_PTHREAD_H 1
| #define HAVE_KSTAT 1
| #define ETHR_PTHREADS 1
| #define ETHR_HAVE_PTHREAD_H 1
| #define ETHR_HAVE_SCHED_H 1
| #define ETHR_HAVE_SYS_TIME_H 1
| #define ETHR_TIME_WITH_SYS_TIME 1
| #define ETHR_HAVE_PTHREAD_SPIN_LOCK 1
| #define ETHR_HAVE_SCHED_YIELD 1
| #define ETHR_SCHED_YIELD_RET_INT 1
| #define ETHR_HAVE_PTHREAD_ATTR_SETGUARDSIZE 1
| /* end confdefs.h.  */
| #include "atomic_ops.h"
| int
| main ()
| {
|
|                       volatile AO_t x;
|                       AO_t y;
|                       int z;
|
|                       AO_nop_full();
|                       AO_store(&x, (AO_t) 0);
|                       z = AO_load(&x);
|                       z = AO_compare_and_swap_full(&x, (AO_t) 0, (AO_t)
1);
|
|   ;
|   return 0;
| }
configure:10660: result: no
configure:11125: error: No usable libatomic_ops implementation found

Regards,
Claudio

On Thu, Sep 15, 2011 at 11:54 AM, Ivan Maidanski <ivmai at mail.ru> wrote:

> Hi Claudio,
>
> By the contract, if the client uses CAS operation (AO_compare_and_swap_...)
> then it should define AO_REQUIRE_CAS before including atomic_ops.h (see
> README).
>
> So, it's a bug of erlang. (erlang script should add #define AO_REQUIRE_CAS
> to that test).
>
> Regards.
>
> 15 09 2011, 19:42 "Claudio A. Costagliola Fiedler" <
> claudio.costagliola at gmail.com>:
> > Ivan,
> >
> > The failed test made by configure script of erlang is:
> > configure:10588: checking for a usable libatomic_ops implementation
> > configure:10630: cc -o conftest -m32 -g
> > -I<path>/otp_src_R14B03/erts/sparc-sun-solaris2.10  -D_LARGEFILE_SOURCE
> > -D_FILE_OFFSET_BITS=64   -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS
> > -D_POSIX_PTHREAD_SEMANTICS -I<path>/include -m32   conftest.c -ldl -lm
> > -lpthread  -lkstat >&5
> > "conftest.c", line 45: warning: implicit function declaration:
> > AO_compare_and_swap_full
> > Undefined                       first referenced
> >  symbol                             in file
> > AO_compare_and_swap_full            conftest.o
> > AO_test_and_set_full                conftest.o
> > ld: fatal: Symbol referencing errors. No output written to conftest
> > configure:10636: $? = 1
> > configure: failed program was:
> > | /* confdefs.h.  */
> > |
> > | #define PACKAGE_NAME ""
> > | #define PACKAGE_TARNAME ""
> > | #define PACKAGE_VERSION ""
> > | #define PACKAGE_STRING ""
> > | #define PACKAGE_BUGREPORT ""
> > | #define STDC_HEADERS 1
> > | #define HAVE_SYS_TYPES_H 1
> > | #define HAVE_SYS_STAT_H 1
> > | #define HAVE_STDLIB_H 1
> > | #define HAVE_STRING_H 1
> > | #define HAVE_MEMORY_H 1
> > | #define HAVE_STRINGS_H 1
> > | #define HAVE_INTTYPES_H 1
> > | #define HAVE_STDINT_H 1
> > | #define HAVE_UNISTD_H 1
> > | #define SIZEOF_VOID_P 4
> > | #define HAVE_LIBM 1
> > | #define HAVE_LIBDL 1
> > | #define HAVE_PTHREAD_H 1
> > | #define HAVE_KSTAT 1
> > | #define ETHR_PTHREADS 1
> > | #define ETHR_HAVE_PTHREAD_H 1
> > | #define ETHR_HAVE_SCHED_H 1
> > | #define ETHR_HAVE_SYS_TIME_H 1
> > | #define ETHR_TIME_WITH_SYS_TIME 1
> > | #define ETHR_HAVE_PTHREAD_SPIN_LOCK 1
> > | #define ETHR_HAVE_SCHED_YIELD 1
> > | #define ETHR_SCHED_YIELD_RET_INT 1
> > | #define ETHR_HAVE_PTHREAD_ATTR_SETGUARDSIZE 1
> > | /* end confdefs.h.  */
> > | #include "atomic_ops.h"
> > | int
> > | main ()
> > | {
> > |
> > |                       volatile AO_t x;
> > |                       AO_t y;
> > |                       int z;
> > |
> > |                       AO_nop_full();
> > |                       AO_store(&x, (AO_t) 0);
> > |                       z = AO_load(&x);
> > |                       z = AO_compare_and_swap_full(&x, (AO_t) 0, (AO_t)
> > 1);
> > |
> > |   ;
> > |   return 0;
> > | }
> > configure:10660: result: no
> > configure:11125: error: No usable libatomic_ops implementation found
> >
> > On Thu, Sep 15, 2011 at 11:15 AM, Ivan Maidanski <ivmai at mail.ru> wrote:
> >
> > > Hi Claudio,
> > >
> > > AO_REQUIRE_CAS should defined in include/private/gc_priv.h provided
> > > PARALLEL_MARK is defined.
> > >
> > > AO_compare_and_swap() should be in use only if PARALLEL_MARK is defined
> in
> > > make scripts.
> > > What's the code that uses AO_compare_and_swap in your case?
> > >
> > > Regards.
> > >
> > > 15 09 2011, 19:04 "Claudio A. Costagliola Fiedler" <
> > > claudio.costagliola at gmail.com>:
> > > > Ivan,
> > > >
> > > > Thanks for your answer.
> > > >
> > > > In atomic_ops.h, at this point:
> > > > #if defined(AO_REQUIRE_CAS) && !defined(AO_HAVE_compare_and_swap) \
> > > >     && !defined(AO_HAVE_compare_and_swap_full) \
> > > >     && !defined(AO_HAVE_compare_and_swap_acquire)
> > > > # if defined(AO_CAN_EMUL_CAS)
> > > > #   include "atomic_ops/sysdeps/emul_cas.h"
> > > > # else
> > > > #  error Cannot implement AO_compare_and_swap_full on this
> architecture.
> > > > # endif
> > > > #endif /* AO_REQUIRE_CAS && !AO_HAVE_compare_and_swap ... */
> > > >
> > > > None of these macros are defined: AO_REQUIRE_CAS,
> > > AO_HAVE_compare_and_swap,
> > > > AO_HAVE_compare_and_swap_full, AO_HAVE_compare_and_swap_acquire. So
> the
> > > > whole outter #if is not compiled.
> > > >
> > > > The file atomic_ops.c is compiled and it does have
> > > > AO_compare_and_swap_emulation:
> > > > bash-3.00$ pwd
> > > > <path>/gc-7.2alpha6/libatomic_ops
> > > > bash-3.00$ find . -name "atomic_ops.o" -print
> > > > ./src/atomic_ops.o
> > > > bash-3.00$ nm src/atomic_ops.o | grep AO_compare_and_swap_emulation
> > > > [51]    |      1660|     200|FUNC |GLOB |0    |2
> > > > |AO_compare_and_swap_emulation
> > > >
> > > > Regards,
> > > > Claudio
> > > >
> > > > On Thu, Sep 15, 2011 at 2:19 AM, Ivan Maidanski <ivmai at mail.ru>
> wrote:
> > > >
> > > > > Hi Claudio,
> > > > >
> > > > > Seems that the scripts need some fixing:
> > > > >
> > > > > 1. Check that emul_cas.h is included from atomic_ops.h (it should
> > > redirect
> > > > > AO_compare_and_swap_full to AO_compare_and_swap_emulation.
> > > > > 2. Check that atomic_ops.c (which has
> AO_compare_and_swap_emulation) is
> > > > > compiled.
> > > > >
> > > > > Regards.
> > > > >
> > > > > 15 09 2011, 02:30 Claudio Costagliola <
> claudio.costagliola at gmail.com>:
> > > > > > I'm trying to build libatomic_ops version 7.2alpha6 on a Solaris
> 10
> > > > > SPARC. The
> > > > > > configuration and building process seems successful, but the
> > > generated
> > > > > > libraries don't have the symbol AO_compare_and_swap_full. I need
> it
> > > to
> > > > > build
> > > > > > Erlang R14B03, which complains about de missing symbol.
> > > > > >
> > > > > > The command line I'm using to configure is:
> > > > > > CC=cc CXX=CC ./configure --prefix=<path>
> > > > > >
> > > > > > The missed symbols:
> > > > > > bash-3.00$ nm libatomic_ops_gpl.a | grep AO_compare_and_swap_full
> > > > > > bash-3.00$ nm libatomic_ops.a | grep AO_compare_and_swap_full
> > > > > > bash-3.00$
> > > > > >
> > > > > > Any help would be appreciated
> > > > > >
> > > > > > Regards,
> > > > > > Claudio
> > > > > >
> > > > > > _______________________________________________
> > > > > > Gc mailing list
> > > > > > Gc at linux.hpl.hp.com
> > > > > > http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> > > > > >
> > > >
> > > > --
> > > > Claudio A. Costagliola Fiedler
> > > >
> > > >
> >
> > --
> > Claudio A. Costagliola Fiedler
> >
> >
>



-- 
Claudio A. Costagliola Fiedler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20110915/62968b4e/attachment-0001.htm


More information about the Gc mailing list