Option -pthread in test suite with cross compilers

Jonathan Wakely jwakely.gcc@gmail.com
Wed Jun 6 13:44:00 GMT 2012


On Jun 6, 2012 2:14 PM, "Florian Weimer" wrote:
>
> On 06/06/2012 03:09 PM, Dave Korn wrote:
>>>>
>>>> I am not sure, but AFAICT, -pthread is Linux-specific.
>>>
>>>
>>> No, it's the canonical multi-os option to enable pthreads, as
>>> generic as it gets.
>>
>>
>>   According to the manual(*), it's a machine-dependent option for RS6000 and
>> Solaris 2 only!

That's http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16519

> And there's a lot of confusion about whether you have to throw in -D_REENTRANT as well (on GNU/Linux and on other systems).
>
> I think on GNU/Linux, pthread detection mostly happens at run time these days, and you ought to use the _r API variants (which are available without -pthread) in library code.  I even think you shouldn't link against the library unless you actually create threads.

Certainly true for C++ as linking to libpthread causes libstdc++ to
use atomic ops for reference-counting.



More information about the Gcc mailing list