Option -pthread in test suite with cross compilers

Florian Weimer fweimer@redhat.com
Wed Jun 6 13:14:00 GMT 2012


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!

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.


-- 
Florian Weimer / Red Hat Product Security Team



More information about the Gcc mailing list