Hi, David The front-end drivers use -pthread and that often adds -lpthread. But -pthread is not passed to cc1, etc.
I am not certain if there is a way for the compiler to ascertain that it is being invoked to compile a file intended for a multi-threaded application. It knows bout OpenMP and __thread, but that does not encompass all pthreads applications. Thanks, David On Fri, Dec 28, 2012 at 2:08 PM, Xinliang David Li <davi...@google.com> wrote: > Is there a way to tell if the program is going to be multi-threaded? > If not, it might be useful to introduce a compiler option such as -fmt > which also enables -lpthread. Using tricks like weakrefs can > introduce unnecessary runtime overhead. > > David > > On Fri, Dec 28, 2012 at 8:26 AM, David Edelsohn <dje....@gmail.com> wrote: >> David, >> >> Support for native TLS on AIX exposed a problem with this patch. A >> similar problem exists on Solaris 9. >> >> Some helper functions for TLS on AIX and Solaris 9 only are provided >> by libpthread. Promoting ic related variables to TLS breaks profiling >> of non-pthread appications. I completely agree with reducing race >> conditions and improving support for profiling of pthread >> applications, but why should this change be enabled for applications >> not built and run as multi-threaded? This feature should test more >> than the existence of target TLS support. >> >> Thanks, David