From: Iain Sandoe <iain@sandoe.co.uk>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: libstdc++@gcc.gnu.org
Subject: Re: [RFA/C] Reimplementation of std::call_once.
Date: Wed, 9 Aug 2023 13:51:48 +0100 [thread overview]
Message-ID: <0B281969-EB24-405E-B41A-83429CDDA8FE@sandoe.co.uk> (raw)
In-Reply-To: <CAH6eHdRQy=zZ2OWAfcBcp6bGjfX9b17gqWjCOA5rGO9XQ+3ycA@mail.gmail.com>
Hi Jonathan,
> On 9 Aug 2023, at 13:38, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
> On Wed, 9 Aug 2023 at 13:22, Iain Sandoe <iain@sandoe.co.uk> wrote:
>>
>> Hello.
>>
>> With the current [posix-y] implementation of std::call_once, we are seeing significant issues for Darwin. The issues vary in strength from “hangs or segvs sometimes depending on optimisation and the day of the week” (newer OS, faster h/w) to “segvs or std::terminates every time” older OS slower h/w.
>>
>> Actually, I think that in the presence of exceptions it is not working on Linux either.
>>
>> As a use-case: this problem prevents us from building working LLVM/clang tools on Darwin using GCC as the bootstrap compiler.
>>
>> the test code I am using is: https://godbolt.org/z/Mxcnv9YEx (derived from a cppreference example, IIRC).
>>
>> This is a prototype, so I’m looking for advice/comment on:
>>
>> (a) if this can be generalised to be part of libstdc++
>> (b) what that would take ...
>> (c) ..or if I should figure out how to make this a darwin-specific impl.
>
>
> It's an ABI break. I already tried to replace std::call_once once, see
> r11-4691-g93e79ed391b9c6 and r11-7688-g6ee24638ed0ad5 and PR 99341.
blast.
>> —— here is the prototype implementation as a non-patch .. (patch attached).
>>
>> =====
>> the implementation in mutex.cc can sit togethe with the old version so that the symbols for that remain available (or, for versioned libraries, the old code can be deleted).
>
> If you have old and new code sharing a std::once_flag object you're dead.
indeed - I was only considering the case where existing binaries needed to run with the new lib, not the case where code compiled with two different impls was combined.
> Something like the abi_tag transition for std::string in GCC 5 would be needed.
That sounds quite complicated and likely to produce similar pain?
====
Presumably an alternative is that I just have to accept that Darwin needs to use a versioned library (which is a direction I am close to heading in because of co-existence of mulitple c++ runtimes anyway).
thanks
Iain
next prev parent reply other threads:[~2023-08-09 12:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 12:21 Iain Sandoe
2023-08-09 12:38 ` Jonathan Wakely
2023-08-09 12:51 ` Iain Sandoe [this message]
2023-08-09 12:53 ` Jonathan Wakely
2023-08-09 13:12 ` Iain Sandoe
2023-08-09 14:10 ` Jonathan Wakely
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=0B281969-EB24-405E-B41A-83429CDDA8FE@sandoe.co.uk \
--to=iain@sandoe.co.uk \
--cc=jwakely.gcc@gmail.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).