Boost logo

Boost-Build :

Subject: Re: [Boost-build] __sync_val_compare_and_swap_4
From: Madhukar Sandi (Madhukar.Sandi_at_[hidden])
Date: 2010-07-23 03:22:49


Hi All,

Thanks for your support.

We found the solution here. Whether it is all the test cases correct or not please verify?

We replaced this returned statement ( __sync_val_compare_and_swap_4 ) and included assembly language code in atomic.hpp.

(volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp)
{ /* return __sync_val_compare_and_swap(const_cast<boost::uint32_t *>(mem), cmp, with);*/
   boost::uint32_t result;
  asm volatile(".set\tpush\n\t"
                       ".set\tnoreorder\n\t"
                       ".set\tnomacro\n\t"
                       "1:\n\t"
                        "ll\t%[result],0(%[mem])\n\t"
                       "bne\t%[result],%[with],2f\n\t"
                        "move\t%[result],$0\n\t" // delay slot
                        "move\t%[result],%[mem]\n\t"
                        "sc\t%[result],0(%[mem])\n\t"
                        "beq\t%[result],$0,1b\n\t"
                        "nop\n\t" // delay slot
                        "2:\n\t"
                        ".set\tpop"
           : [result] "=&r" (result)
           : [mem] "r" (mem), [cmp] "r" (cmp), [with] "r"(with)
           : "memory");

return result;
 }

Any body Please verify?

Thanks
Madhukar Sandi

-----Original Message-----
From: boost-build-bounces_at_[hidden] [mailto:boost-build-bounces_at_[hidden]] On Behalf Of Oliver Kowalke
Sent: Thursday, July 22, 2010 8:09 PM
To: Boost.Build developer's and user's list
Subject: Re: [Boost-build] __sync_val_compare_and_swap_4

I got the same error on ARM. It seams that the version I used (gcc 4.3. I beleive) did not implement the atomic ops. Upgrade to gcc 4.4.4 helped me for ARM. Maybe you too.

Oliver

-------- Original-Nachricht --------
> Datum: Wed, 21 Jul 2010 13:38:07 +0530
> Von: Madhukar Sandi <Madhukar.Sandi_at_[hidden]>
> An: "Boost.Build developer\'s and user\'s list" <boost-build_at_[hidden]>
> Betreff: [Boost-build] __sync_val_compare_and_swap_4

> Hi
>
> When im doing cross compiling boost libraries on Cronus mips board.
>
> I am getting below error
>
> undefined reference to `__sync_val_compare_and_swap_4'
>
> Please any one have solution , pls share with me
>
>
> user_at_user-desktop:~/madhukar/boost/boost_1_43_0/workspace/interprocess/messageque$
> mips-linux-g++ -lpthread -lrt -g -march=mips32
> comp_doc_message_queueA.cpp -o mess -I/home/user/madhukar/boost/boost_1_43_0/
> ../../../stage/lib/libboost_thread.a
>
> I got below error....
>
> /tmp/ccVKlA7S.o:/home/user/madhukar/boost/boost_1_43_0/boost/interprocess/detail/atomic.hpp:306:
> undefined reference to `__sync_val_compare_and_swap_4'
> collect2: ld returned 1 exit status
>
> Thanks & Regards
> Madhukar Sandi
>
> This Email may contain confidential or privileged information for the
> intended recipient (s) If you are not the intended recipient, please do not use
> or disseminate the information, notify the sender and delete it from your
> system.
>
> ______________________________________________________________________
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost-build

--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
______________________________________________________________________
This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
______________________________________________________________________

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk