public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: Richard Biener <richard.guenther@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libatomic: Provide gthr.h default implementation
Date: Tue, 30 May 2023 12:17:47 +0200	[thread overview]
Message-ID: <0e95b057-ea2f-91c8-e51b-97b3d018cb31@embedded-brains.de> (raw)
In-Reply-To: <CAFiYyc1HJCeyYPcQj=J5Tz4em0ZDXEvny3RH=J0POiiRnzmu_g@mail.gmail.com>

On 30.05.23 11:53, Richard Biener wrote:
> On Tue, May 23, 2023 at 11:28 AM Sebastian Huber
> <sebastian.huber@embedded-brains.de>  wrote:
>> On 10.01.23 16:38, Sebastian Huber wrote:
>>> On 19/12/2022 17:02, Sebastian Huber wrote:
>>>> Build libatomic for all targets.  Use gthr.h to provide a default
>>>> implementation.  If the thread model is "single", then this
>>>> implementation will
>>>> not work if for example atomic operations are used for thread/interrupt
>>>> synchronization.
>>> Is this and the related -fprofile-update=atomic patch something for GCC 14?
>> Now that the GCC 14 development is in progress, what about this patch?
> Sorry, there doesn't seem to be a main maintainer for libatomic and your patch
> touches targets which didn't have it before.
> 
> Can you explain how this affects the ABI of targets not having (needing?!)
> libatomic?  It might help if you can say this is still opt-in and targets not
> building libatomic right now would not with your patch and targets already
> building libatomic have no changes with your patch.
> 
> That said - what kind of ABI implications has providing libatomic support
> for a target that didn't do so before?

Sorry for the missing context. The root problem I want to solve is 
getting gcov support for multi-threaded applications. For this we need 
atomic 64-bit operations, see also:

https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608620.html

The libatomic patch lets it build for every target. Targets with no 
explicit support will use the gthr.h API to provide a default 
implementation.

An alternative would be to use the RTEMS approach which uses the 
following API (provided by Newlib <machine/_libatomic.h> for RTEMS):

#include <sys/cdefs.h>
#include <sys/_types.h>

__BEGIN_DECLS

__uint32_t _Libatomic_Protect_start(void *);

void _Libatomic_Protect_end(void *, __uint32_t);

void _Libatomic_Lock_n(void *, __size_t);

void _Libatomic_Unlock_n(void *, __size_t);

__END_DECLS

We could also leave libatomic as is, but then you may get unresolved 
references if you use -fprofile-update=atomic with the patch mentioned 
above.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

  reply	other threads:[~2023-05-30 10:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19 16:02 Sebastian Huber
2023-01-10 15:38 ` Sebastian Huber
2023-05-23  9:27   ` Sebastian Huber
2023-05-30  9:53     ` Richard Biener
2023-05-30 10:17       ` Sebastian Huber [this message]
2023-05-30 11:17         ` Richard Biener
2023-05-31  5:31           ` Sebastian Huber
2023-05-31  7:27             ` Richard Biener
2023-09-11 13:02               ` Sebastian Huber

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=0e95b057-ea2f-91c8-e51b-97b3d018cb31@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.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).