Boost C++ Libraries: Ticket #2263: On PA-RISC with GCC 4.3.1, thread primitives are misdetected https://svn.boost.org/trac10/ticket/2263 <p> In at least two places (boost/detail/spinlock.hpp and boost/detail/atomic_count.hpp), Boost assumes that if the following condition is true: </p> <p> defined( <span class="underline">GNUC</span> ) &amp;&amp; ( <span class="underline">GNUC</span> * 100 + <span class="underline">GNUC_MINOR</span> &gt;= 401 ) </p> <p> then GCC sync primitives (e.g. <span class="underline">sync_lock_test_and_set, </span>sync_fetch_and_add) are available. This is not correct; GCC 4.3.1 on PA-RISC does not provide these operations. The following link error results: </p> <p> /usr/ccs/bin/ld: Unsatisfied symbols: </p> <blockquote> <p> <span class="underline">sync_add_and_fetch_4 (first referenced in main.o) (code) </span></p> </blockquote> <p> The test can be fixed like this: </p> <p> defined( <span class="underline">GNUC</span> ) &amp;&amp; ( <span class="underline">GNUC</span> * 100 + <span class="underline">GNUC_MINOR</span> &gt;= 401 ) &amp;&amp; !defined(<span class="underline">hppa) </span></p> <p> However, it seems like it would be more resiliant to list the platforms which do support these primitves (e.g. Itanium, i386...) rather than excepting specific platforms. </p> <p> (Tested on HP-UX 11.11 using HP GCC 4.3.1 on a PA-8200 CPU.) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2263 Trac 1.4.3 Marshall Clow Tue, 09 Sep 2008 18:57:21 GMT owner set https://svn.boost.org/trac10/ticket/2263#comment:1 https://svn.boost.org/trac10/ticket/2263#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Peter Dimov</span> </li> </ul> Ticket Peter Dimov Tue, 09 Sep 2008 21:54:08 GMT status changed https://svn.boost.org/trac10/ticket/2263#comment:2 https://svn.boost.org/trac10/ticket/2263#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Peter Dimov Wed, 17 Sep 2008 20:55:04 GMT <link>https://svn.boost.org/trac10/ticket/2263#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2263#comment:3</guid> <description> <p> In addition to __hppa, need to also check __arm<span class="underline">. </span></p> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Dimov</dc:creator> <pubDate>Wed, 17 Sep 2008 22:27:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2263#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2263#comment:4</guid> <description> <p> Does GCC on PA-RISC indeed not provide even sync_lock_test_and_set? Or is it just sync_fetch_and_add that is not present? </p> </description> <category>Ticket</category> </item> <item> <author>river@…</author> <pubDate>Wed, 17 Sep 2008 22:41:54 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2263#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2263#comment:5</guid> <description> <p> it does not: </p> <pre class="wiki">river@maiden:~&gt;cat test.c int i; int main() { __sync_lock_test_and_set(&amp;i, 1); return 0; } river@maiden:~&gt;gcc test.c -o test -W -Wall /usr/ccs/bin/ld: Unsatisfied symbols: __sync_lock_test_and_set_4 (first referenced in /var/tmp//ccgdGbo1.o) (code) collect2: ld returned 1 exit status river@maiden:~&gt;gcc -v Using built-in specs. Target: hppa1.1-hp-hpux11.11 Configured with: /tmp/gcc-4.3.1.tar.gz/gcc-4.3.1/configure --host=hppa1.1-hp-hpux11.11 --target=hppa1.1-hp-hpux11.11 --build=hppa1.1-hp-hpux11.11 --prefix=/opt/hp-gcc-4.3.1 --with-gnu-as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-threads=posix --enable-languages=c,c++ --with-gmp=/proj/opensrc/be/hppa1.1-hp-hpux11.11 --with-mpfr=/proj/opensrc/be/hppa1.1-hp-hpux11.11 Thread model: posix gcc version 4.3.1 (GCC) </pre><p> (PA-RISC does provide a single atomic operation - 'load and clear word' (ldcw), which is roughly equivalent to <code>__sync_lock_test_and_set(&amp;x, 1)</code>. Unfortunately, I'm not comfortable enough with the platform to provide an implementation.) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Dimov</dc:creator> <pubDate>Wed, 17 Sep 2008 22:53:54 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/2263#comment:6 https://svn.boost.org/trac10/ticket/2263#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/48838" title="Fix #2263. See also [48835].">[48838]</a>) Fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2263" title="#2263: Bugs: On PA-RISC with GCC 4.3.1, thread primitives are misdetected (closed: fixed)">#2263</a>. See also <a class="changeset" href="https://svn.boost.org/trac10/changeset/48835" title="Fix #2336.">[48835]</a>. </p> Ticket