[libstdc++] Use __gthread_join in jthread/95989

Alexandre Oliva oliva@adacore.com
Fri Mar 3 20:36:31 GMT 2023


Hello, Florian,

On Mar  3, 2023, Florian Weimer <fw@deneb.enyo.de> wrote:

> * Alexandre Oliva via Gcc-patches:
>> +    // Make sure it's not optimized out, not even with LTO.
>> +    asm ("" : : "rm" (depend));

> If the m constraint is used, this may never emit the symbol name and
> thus not create a reference after all.

But that is no longer the pthread symbol itself, it's the symbol of a
static member function with vague linkage that, because the compiler
believes the asm statement will reference it, will still be output, and
it's that function body that will refer to and thus pull in the symbols
we need.

Now, hmm, maybe with per-function sections, the compiler will emit it,
but with section gc, the linker may drop it, so we might lose the needed
function body.  When performing LTO with an LTO-enabled libstdc++.

-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>


More information about the Libstdc++ mailing list