public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <oliva@adacore.com>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: Alexandre Oliva via Gcc-patches <gcc-patches@gcc.gnu.org>,
	Jonathan Wakely <jwakely@redhat.com>,
	Jonathan Wakely <jwakely.gcc@gmail.com>,
	"libstdc++" <libstdc++@gcc.gnu.org>,
	Bernd Edlinger <bernd.edlinger@hotmail.de>
Subject: Re: [libstdc++] Use __gthread_join in jthread/95989
Date: Fri, 03 Mar 2023 17:57:13 -0300	[thread overview]
Message-ID: <ory1odh7ti.fsf@lxoliva.fsfla.org> (raw)
In-Reply-To: <or356lincg.fsf@lxoliva.fsfla.org> (Alexandre Oliva's message of "Fri, 03 Mar 2023 17:36:31 -0300")

On Mar  3, 2023, Alexandre Oliva <oliva@adacore.com> wrote:

> 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++.

Wait, no, you had me going but it's really fine.  What would be in
memory is a *pointer* to the function, so the function would still be
referenced by whatever initialized the pointer, so it wouldn't get GCed.

-- 
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>

      reply	other threads:[~2023-03-03 20:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17  6:39 Alexandre Oliva
2023-02-17 10:58 ` Jonathan Wakely
2023-03-03  8:18   ` Alexandre Oliva
2023-03-03  9:33     ` Jonathan Wakely
2023-03-03  9:48       ` Jonathan Wakely
2023-03-03 17:46         ` Alexandre Oliva
2023-03-03 18:12           ` Jonathan Wakely
2023-03-03 18:14             ` Jonathan Wakely
2023-03-03 19:55               ` Alexandre Oliva
2023-03-03 20:15                 ` Florian Weimer
2023-03-03 20:36                   ` Alexandre Oliva
2023-03-03 20:57                     ` Alexandre Oliva [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ory1odh7ti.fsf@lxoliva.fsfla.org \
    --to=oliva@adacore.com \
    --cc=bernd.edlinger@hotmail.de \
    --cc=fw@deneb.enyo.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).