On 09/08/2021 12:19, Richard Biener wrote:
On Mon, Aug 9, 2021 at 10:01 AM Sebastian Huber
<sebastian.hu...@embedded-brains.de> wrote:
If get_gcov_type() returns a 64-bit type, then 64-bit atomic operations in
hardware are required for the "atomic" method. Add a new method to force
atomic operations even if a library implementation (libatomic) must be used.
I do wonder about the =atomic behavior here - I'd expected that to
be equivalent to force-atomic...
Yes, this method just maps to the "atomic" method:
+ else if (flag_profile_update == PROFILE_UPDATE_FORCE_ATOMIC)
+ flag_profile_update = PROFILE_UPDATE_ATOMIC;
With =force-atomic the user will need to eventually link to -latomic
himself, correct? What happens for targets that do not have libatomic support?
See libatomic/configure.tgt - is that something we can test for and error/warn?
The compiler will generate a library call:
main:
save %sp, -96, %sp
mov 0, %o3
mov 1, %o2
mov 0, %o1
sethi %hi(__gcov0.main), %o0
call __atomic_fetch_add_8, 0
or %o0, %lo(__gcov0.main), %o0
sethi %hi(x), %g1
ld [%g1+%lo(x)], %i0
jmp %i7+8
restore
The __atomic_fetch_add_8 is usually provided by libatomic. If a target
doesn't have it, then you get a linker error. I am not sure how the
compiler could warn, since it is built before libatomic.
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@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/