[PATCH] D14165: [lld] Ensure we link to the threading library used by std::thread (e.g. pthreads).

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 04:00:36 PST 2015


> lovely, it is a debian change for hurd :-(
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61841

Thanks for finding that. It seems that the behaviour that seems strange to me is exactly what they were aiming for. I suppose it can be argued that including <thread> without the intention to spawn a thread is strange too.

> I wonder if we should just refuse to build lld if LLVM_ENABLE_THREADS is off.

Personally, I have no objections to that but it does prevent using this option as a way to rule out threading issues when debugging.

I should mention that this patch was originally to fix LLVM_ENABLE_THREADS=ON builds. I only tried OFF to test the other cases and found I still needed the 'find_package(Threads)' to get a successful link.
________________________________
From: Rui Ueyama [ruiu at google.com]
Sent: 05 November 2015 09:04
To: Rafael Espíndola
Cc: Daniel Sanders; llvm-commits; reviews+D14165+public+8a648fa84ee244b3 at reviews.llvm.org
Subject: Re: [PATCH] D14165: [lld] Ensure we link to the threading library used by std::thread (e.g. pthreads).

On Thu, Nov 5, 2015 at 6:11 AM, Rafael Espíndola <rafael.espindola at gmail.com<mailto:rafael.espindola at gmail.com>> wrote:
lovely, it is a debian change for hurd :-(

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61841

I wonder if we should just refuse to build lld if LLVM_ENABLE_THREADS is off.

Who wants to use LLVM without threading support and why? (I just don't know about that, and I'm trying to make an informed decision.)


Cheers,
Rafael


On 5 November 2015 at 08:57, Daniel Sanders <Daniel.Sanders at imgtec.com<mailto:Daniel.Sanders at imgtec.com>> wrote:
> Sure, see attached.
> ________________________________
> From: Rafael Espíndola [rafael.espindola at gmail.com<mailto:rafael.espindola at gmail.com>]
> Sent: 05 November 2015 04:16
> To: Daniel Sanders
> Cc: llvm-commits; Rui Ueyama;
> reviews+D14165+public+8a648fa84ee244b3 at reviews.llvm.org<mailto:reviews%2BD14165%2Bpublic%2B8a648fa84ee244b3 at reviews.llvm.org>
> Subject: RE: [PATCH] D14165: [lld] Ensure we link to the threading library
> used by std::thread (e.g. pthreads).
>
> Can you email the .ii file?
>
> On Nov 5, 2015 4:54 AM, "Daniel Sanders" <Daniel.Sanders at imgtec.com<mailto:Daniel.Sanders at imgtec.com>> wrote:
>>
>> It's the libstdc++-4.9-dev in Debian Jessie (amd64). The package version
>> is 4.9.2-10.
>> ________________________________________
>> From: Rafael Espíndola [rafael.espindola at gmail.com<mailto:rafael.espindola at gmail.com>]
>> Sent: 04 November 2015 13:02
>> To: reviews+D14165+public+8a648fa84ee244b3 at reviews.llvm.org<mailto:reviews%2BD14165%2Bpublic%2B8a648fa84ee244b3 at reviews.llvm.org>; Daniel
>> Sanders
>> Cc: Rui Ueyama; llvm-commits
>> Subject: Re: [PATCH] D14165: [lld] Ensure we link to the threading library
>> used by std::thread (e.g. pthreads).
>>
>> 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
>>
>> On 30 October 2015 at 03:28, Daniel Sanders via llvm-commits
>> <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> wrote:
>> > dsanders added a comment.
>> >
>> > 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>.
>> >
>> >
>> > http://reviews.llvm.org/D14165
>> >
>> >
>> >
>> > _______________________________________________
>> > llvm-commits mailing list
>> > llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151106/f0cd02a6/attachment.html>


More information about the llvm-commits mailing list