On Wed, 11 Aug 2021, Sebastian Huber wrote: > 64-bit atomic operations. Allow targets to override the default type > size with the new TARGET_GCOV_TYPE_SIZE target macro.
Hook, not macro. > diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c > index f79f939bd10f..e85b60c79f49 100644 > --- a/gcc/c-family/c-cppbuiltin.c > +++ b/gcc/c-family/c-cppbuiltin.c > @@ -1450,6 +1450,8 @@ c_cpp_builtins (cpp_reader *pfile) > /* For libgcov. */ > builtin_define_with_int_value ("__LIBGCC_VTABLE_USES_DESCRIPTORS__", > TARGET_VTABLE_USES_DESCRIPTORS); > + builtin_define_with_int_value ("__LIBGCC_GCOV_TYPE_SIZE", > + TARGET_GCOV_TYPE_SIZE); The TARGET_* macros used to initialize targetm may only be defined to their final values in the architecture-specific .c file that actually defines targetm. All other files should access the hook via targetm, not the TARGET_* macros. (TARGET_VTABLE_USES_DESCRIPTORS in the diff context is a target macro, not a hook at all.) > +DEFHOOKPOD > +(gcov_type_size, > + "The gcov type size in bits. This type is used for example for counters\n\ > +incremented by profiling and code-coverage events. The default value is > 64,\n\ > +if the type size of long long is greater than 32, otherwise the default\n\ > +value is 32. A 64-bit type is recommended to avoid overflows of the\n\ > +counters. If the @option{-fprofile-update=atomic} is used, then the\n\ > +counters are incremented using atomic operations. Targets not supporting\n\ > +64-bit atomic operations may override the default value and request a > 32-bit\n\ > +type.", > + HOST_WIDE_INT, (LONG_LONG_TYPE_SIZE > 32 ? 64 : 32)) LONG_LONG_TYPE_SIZE may depend on command-line options passed to the compiler (it does for AVR). The hook thus needs to be a function returning the desired size. -- Joseph S. Myers jos...@codesourcery.com