On Tue, Aug 10, 2021 at 8:07 AM Sebastian Huber
<sebastian.hu...@embedded-brains.de> wrote:
>
> On 09/08/2021 14:13, Richard Biener wrote:
> >>> But I guess using 32bit counters on sparc-rtems might be the way to
> >>> go ...
> >> Yes, you somehow just have to make sure that your test programs don't
> >> overflow the counters.
> > Right - thus in principle it would be "nice" to allow to alter this with
> > a command-line switch (even per TU in case 64bit is slow).
>
> Setting the gcov type size per TU would require to store this
> information in the object so that libgcov is able to know which type
> size was used (probably somewhere in struct gcov_info). Currently, the
> gcov type size for libgcov is hard coded in "libgcc/libgcov.h":
>
> #if __CHAR_BIT__ == 8
> typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI)));
> typedef unsigned gcov_position_t __attribute__ ((mode (SI)));
> #if GCOV_TYPE_SIZE > 32
> typedef signed gcov_type __attribute__ ((mode (DI)));
> typedef unsigned gcov_type_unsigned __attribute__ ((mode (DI)));
> #else
> typedef signed gcov_type __attribute__ ((mode (SI)));
> typedef unsigned gcov_type_unsigned __attribute__ ((mode (SI)));
> #endif
> #else
> #if __CHAR_BIT__ == 16
> typedef unsigned gcov_unsigned_t __attribute__ ((mode (HI)));
> typedef unsigned gcov_position_t __attribute__ ((mode (HI)));
> #if GCOV_TYPE_SIZE > 32
> typedef signed gcov_type __attribute__ ((mode (SI)));
> typedef unsigned gcov_type_unsigned __attribute__ ((mode (SI)));
> #else
> typedef signed gcov_type __attribute__ ((mode (HI)));
> typedef unsigned gcov_type_unsigned __attribute__ ((mode (HI)));
> #endif
> #else
> typedef unsigned gcov_unsigned_t __attribute__ ((mode (QI)));
> typedef unsigned gcov_position_t __attribute__ ((mode (QI)));
> #if GCOV_TYPE_SIZE > 32
> typedef signed gcov_type __attribute__ ((mode (HI)));
> typedef unsigned gcov_type_unsigned __attribute__ ((mode (HI)));
> #else
> typedef signed gcov_type __attribute__ ((mode (QI)));
> typedef unsigned gcov_type_unsigned __attribute__ ((mode (QI)));
> #endif
> #endif
> #endif
>
> Why is the mode attribute used here? Wouldn't this work also?

I suppose this is historic.

> typedef gcov_unsigned_t __UINT32_TYPE__;
> typedef gcov_position_t __UINT32_TYPE__;
> #if GCOV_TYPE_SIZE > 32
> typedef gcov_type __INT64_TYPE__;
> typedef gcov_type_unsigned __UINT64_TYPE__;
> #else
> typedef gcov_type __INT32_TYPE__;
> typedef gcov_type_unsigned __UINT32_TYPE__;
> #endif

Or simply use stdint.h names, since this is for the target
GCC arranges for an appropriate stdint header.

blaming a bit yields

commit 9b514d25867f14eb1b430765ba6d5083e592fcd7
Author: Nathan Sidwell <nat...@codesourcery.com>
Date:   Sat May 10 19:02:21 2003 +0000

    defaults.h (GCOV_TYPE_SIZE): Remove.

            * defaults.h (GCOV_TYPE_SIZE): Remove.
...

so - as we're about to re-introduce that let's as Nathan if he remembers
why we removed it ;)  (well, no target overrided the macro)

Richard.

> --
> 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/

Reply via email to