This fixes the BUILD_SHARED_LIBS=ON build. We must link to the threading
library even when LLVM_ENABLE_THREADS is OFF.
Details
- Reviewers
ruiu • espindola
Diff Detail
Event Timeline
Currently LLD does not spawn threads using std::thread if LLVM_ENABLE_THREADS=OFF, but it surely includes <thread> even if the flag is OFF. Is anyone who thinks that's wrong in the first place?
I'm OK with this patch, but I'd like to get experts opinions.
FWIW, it seems odd that we'd need pthreads when we don't use threads. I've just had a look at the preprocessed source for COFF/SymbolTable.cpp and the pthread_create reference comes from this line:
__asm ("" : : "r" (&pthread_create));
which was in the <thread> that was included by <future>.
Which C++ library is that? On my system (gcc 4.9) running
grep -r '&pthread_create' /usr/include/c++/
finds nothing.
And in the preprocessed file:
$ grep pthread_create SymbolTable.ii
extern int pthread_create (pthread_t *restrict newthread,
static typeof(pthread_create) gthrw_pthread_create attribute
((weakref("pthread_create")));
return __gthrw_pthread_create (__threadid, __null, __func, __args);
Cheers,
Rafael
It's the libstdc++-4.9-dev in Debian Jessie (amd64). The package version is 4.9.2-10.