RFR: 8351322: Parameterize link option for pthreads [v2]
Magnus Ihse Bursie
ihse at openjdk.org
Thu Mar 20 12:41:17 UTC 2025
On Mon, 17 Mar 2025 06:41:31 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> @magicus why can't we just use `-pthread` everywhere? My recollection is that `-pthread` both sets compiler directives needed for pthread programming and links to libpthread, so it seems to be what we should be using. ??
>
>> Another follow-up is if it would hurt to include $LIBPTHREAD for _all_ Hotspot tests, to avoid the huge list. @dholmes-ora Do you have anything coming to mind directly that would make that infeasible, or is it just a matter of testing to add it and see if any tests fail?
>
> Sorry I was out of contact for a while. I can't imagine why any test would fail if linked with libpthread, given the VM is linking to it anyway.
>
>> We can then check if we can turn -lpthread into -pthread on Linux as a follow up.
>
> I have a vague recollection that at one time `-pthread` set some _POSIX_SOURCE define (or something like that) which conflicted with our use of some gcc specific things. But that was long ago so I would try it and see. Of couise it then becomes hard to classify what kind of flag this is because it isn't strictly a library flag.
@dholmes-ora
> I have a vague recollection that at one time -pthread set some _POSIX_SOURCE define (or something like that) which conflicted with our use of some gcc specific things. But that was long ago so I would try it and see. Of couise it then becomes hard to classify what kind of flag this is because it isn't strictly a library flag.
Is there any gain then in changing away from `-lpthread`? That is clearly defined, link with libpthread, with no side effects. "If it ain't broke..."
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23930#issuecomment-2740323348
More information about the core-libs-dev
mailing list