Re: [Boost-bugs] [Boost C++ Libraries] #9041: [thread] Boost.Thread DSO's may need to link with Boost.Atomic

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9041: [thread] Boost.Thread DSO's may need to link with Boost.Atomic
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-01-14 01:00:30


#9041: [thread] Boost.Thread DSO's may need to link with Boost.Atomic
----------------------------------------+---------------------
  Reporter: Petr Machata <pmachata@…> | Owner: viboes
      Type: Bugs | Status: closed
 Milestone: Boost 1.55.0 | Component: thread
   Version: Boost 1.54.0 | Severity: Problem
Resolution: fixed | Keywords:
----------------------------------------+---------------------

Comment (by Peter Vingelmann <peter@…>):

 Sorry for reviving this old issue, but we encountered the same problem
 again with several gcc 4.7+ cross-compilers. The problem is that
 atomic/detail/platform.hpp relies on `__atomic*` intrinsics for certain
 compiler versions (gcc 4.7+ and clang 3.2+). However, if
 `__GCC_ATOMIC_BOOL_LOCK_FREE` is not defined or its value is 1 (where 2
 indicates always lock-free, and 1 indicates sometimes lock-free), then
 `BOOST_ATOMIC_FLAG_LOCK_FREE` will not be defined in gcc-atomic.hpp, and
 the external reference to atomic becomes necessary again.

 For example, consider this listing of defines for an Android cross-
 compiler:
 http://slowbutdeadly.blogspot.hu/2013/09/android-prebuilt-gcc-47-builtin-
 macro.html
 where `__GCC_ATOMIC_BOOL_LOCK_FREE` is 1.

 We would like to avoid linking with atomic, so I attached a patch which
 checks if `__GCC_ATOMIC_BOOL_LOCK_FREE` is 2, before including gcc-
 atomic.hpp. If the value is not 2, then the other include options are
 exhausted, before we have to link with atomic (depending on platform
 support). This solution works well for us on a range of cross-compilers.

 Perhaps the issue should also be raised in atomic.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9041#comment:16>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC