Why is there no libatomic default implementation using gthr.h?

Sebastian Huber sebastian.huber@embedded-brains.de
Mon Dec 19 09:03:00 GMT 2022


I would like to fix the -fprofile-update=atomic implementation so that 
it works on all targets. Currently, it works only on targets with 64-bit 
atomic operations in hardware (and some special cases). I tried to fix 
it like this:


The problem with this patch is that it falls back to use functions 
provided by libatomic. The libatomic is currently not supported on all 
targets, for example:



Why is there no libatomic default implementation using gthr.h?

The C++ library already depends on gthr.h and installs the headers in 
"bits/gthr.h" etc. For this the libstdc++-v3 configure/Makefile 
duplicates some logic from libgcc. Why is the gthr.h stuff not installed 
by libgcc itself?

In libatomic, the POSIX implementation could be easily rewritten to use 
the gthr interface.

Any objections to do the following?

1. Install gthr.h to "bits/gthr.h" by libgcc (including the other gthr 

2. Remove the gthr configure/Makefile support from libstdc++-v3.

3. Use gthr as the default implementation of libatomic.

embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
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:

More information about the Gcc mailing list