From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: "Richard Earnshaw (lists)" <Richard.Earnshaw@arm.com>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Subject: Re: [PATCH] libgcc: Add a weak stub for __sync_synchronize
Date: Tue, 17 Nov 2020 18:17:56 +0100 [thread overview]
Message-ID: <AM6PR03MB51707FDC89054CA135F00DFCE4E20@AM6PR03MB5170.eurprd03.prod.outlook.com> (raw)
In-Reply-To: <e3730c6e-029f-cba7-8a65-ab91af6c2369@arm.com>
On 11/17/20 4:41 PM, Richard Earnshaw (lists) wrote:
>
> libgcc is *still* the wrong place for this. It belongs in the system
> library (eg newlib, or glibc, or whatever), which knows about the system
> it's running on. (Sorry, I should have said this before, but I've
> context-switched this out since it's been a long time since it came up).
>
No problem. I just saw it from the other end.
It is odd that this problem does not go away even if gcc is configured
with --disable-threads, which should be the default for arm-none-eabi
anyway.
If we assume a threaded environment then it is still libgcc
which does not define __GTHREADS in libgcc/gthr.h, and libstdc++'s
__cxa_guard_acquire is not making use of functions like __gthread_mutex_lock.
But that appears to be this way by design.
Of course the race is not fixed if you ask newlib to implement just this
__sync_synchronize function.
> This hack will just lead to silent code failure of the worst kind
> (non-reproducable, racy) at runtime.
>
So in a arm-none-eabi system with armv6 or higher where the intrinsic
__sync_synchronize is not a library call but an instruction
we have exactly this worst kind scenario, already.
It is however possible that the default of -fthreadsafe_statics
is inappropriate for --disable-threads ?
Bernd.
> R.
>
next prev parent reply other threads:[~2020-11-17 17:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-03 15:08 Bernd Edlinger
2020-11-17 5:43 ` [PING] " Bernd Edlinger
2020-11-17 12:44 ` Richard Earnshaw (lists)
2020-11-17 15:18 ` Bernd Edlinger
2020-11-17 15:41 ` Richard Earnshaw (lists)
2020-11-17 15:51 ` Christophe Lyon
2020-11-17 17:17 ` Bernd Edlinger [this message]
2020-11-22 8:05 ` [PATCH] Avoid atomic for guard acquire when that is expensive Bernd Edlinger
2020-11-24 22:10 ` Jason Merrill
2020-12-01 18:28 ` Bernd Edlinger
2020-12-02 18:57 ` Jason Merrill
2020-12-05 12:37 ` Bernd Edlinger
2020-12-07 15:04 ` Jason Merrill
2020-12-07 16:17 ` Bernd Edlinger
2020-12-08 19:50 ` Jason Merrill
2020-11-30 20:08 ` [PING] " Bernd Edlinger
2020-11-30 20:54 ` Jason Merrill
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=AM6PR03MB51707FDC89054CA135F00DFCE4E20@AM6PR03MB5170.eurprd03.prod.outlook.com \
--to=bernd.edlinger@hotmail.de \
--cc=Richard.Earnshaw@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=ramana.radhakrishnan@arm.com \
/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).