Hi Jan, I've forgot to add you (as x86 maintainer) for this patch which touches the x86 port. In this patch, we renamed the TAG_SIZE hook to TAG_BITSIZE for clarity, and it is needed for adding the ARM's MTE instructions to the hwasan.
I have bootstrap it and test it without any issue. Is it ok to commit it? Thank you, Claudiu On 8/13/25 1:42 PM, claudiu.zissulescu-iancule...@oracle.com wrote: > From: Indu Bhagat <indu.bha...@oracle.com> > > gcc/Changelog: > > * asan.h (HWASAN_TAG_SIZE): Use targetm.memtag.tag_bitsize. > * config/i386/i386.cc (ix86_memtag_tag_size): Rename to > ix86_memtag_tag_bitsize. > (TARGET_MEMTAG_TAG_SIZE): Renamed to TARGET_MEMTAG_TAG_BITSIZE. > * doc/tm.texi (TARGET_MEMTAG_TAG_SIZE): Likewise. > * doc/tm.texi.in (TARGET_MEMTAG_TAG_SIZE): Likewise. > * target.def (tag_size): Rename to tag_bitsize. > * targhooks.cc (default_memtag_tag_size): Rename to > default_memtag_tag_bitsize. > * targhooks.h (default_memtag_tag_size): Liewise. > > Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-iancule...@oracle.com> > --- > gcc/asan.h | 2 +- > gcc/config/i386/i386.cc | 8 ++++---- > gcc/doc/tm.texi | 2 +- > gcc/doc/tm.texi.in | 2 +- > gcc/target.def | 4 ++-- > gcc/targhooks.cc | 2 +- > gcc/targhooks.h | 2 +- > 7 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/gcc/asan.h b/gcc/asan.h > index 273d6745c58..064d4f24823 100644 > --- a/gcc/asan.h > +++ b/gcc/asan.h > @@ -103,7 +103,7 @@ extern hash_set <tree> *asan_used_labels; > independently here. */ > /* How many bits are used to store a tag in a pointer. > The default version uses the entire top byte of a pointer (i.e. 8 bits). > */ > -#define HWASAN_TAG_SIZE targetm.memtag.tag_size () > +#define HWASAN_TAG_SIZE targetm.memtag.tag_bitsize () > /* Tag Granule of HWASAN shadow stack. > This is the size in real memory that each byte in the shadow memory refers > to. I.e. if a variable is X bytes long in memory then its tag in shadow > diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc > index b64175d6c93..17faf7ebd24 100644 > --- a/gcc/config/i386/i386.cc > +++ b/gcc/config/i386/i386.cc > @@ -27095,9 +27095,9 @@ ix86_memtag_can_tag_addresses () > return ix86_lam_type != lam_none && TARGET_LP64; > } > > -/* Implement TARGET_MEMTAG_TAG_SIZE. */ > +/* Implement TARGET_MEMTAG_TAG_BITSIZE. */ > unsigned char > -ix86_memtag_tag_size () > +ix86_memtag_tag_bitsize () > { > return IX86_HWASAN_TAG_SIZE; > } > @@ -28071,8 +28071,8 @@ ix86_libgcc_floating_mode_supported_p > #undef TARGET_MEMTAG_UNTAGGED_POINTER > #define TARGET_MEMTAG_UNTAGGED_POINTER ix86_memtag_untagged_pointer > > -#undef TARGET_MEMTAG_TAG_SIZE > -#define TARGET_MEMTAG_TAG_SIZE ix86_memtag_tag_size > +#undef TARGET_MEMTAG_TAG_BITSIZE > +#define TARGET_MEMTAG_TAG_BITSIZE ix86_memtag_tag_bitsize > > #undef TARGET_GEN_CCMP_FIRST > #define TARGET_GEN_CCMP_FIRST ix86_gen_ccmp_first > diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi > index 5e305643b3a..3f87abf97b2 100644 > --- a/gcc/doc/tm.texi > +++ b/gcc/doc/tm.texi > @@ -12860,7 +12860,7 @@ At preset, this feature does not support address > spaces. It also requires > @code{Pmode} to be the same as @code{ptr_mode}. > @end deftypefn > > -@deftypefn {Target Hook} uint8_t TARGET_MEMTAG_TAG_SIZE () > +@deftypefn {Target Hook} uint8_t TARGET_MEMTAG_TAG_BITSIZE () > Return the size of a tag (in bits) for this platform. > > The default returns 8. > diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in > index eccc4d88493..040d26c40f1 100644 > --- a/gcc/doc/tm.texi.in > +++ b/gcc/doc/tm.texi.in > @@ -8124,7 +8124,7 @@ maintainer is familiar with. > > @hook TARGET_MEMTAG_CAN_TAG_ADDRESSES > > -@hook TARGET_MEMTAG_TAG_SIZE > +@hook TARGET_MEMTAG_TAG_BITSIZE > > @hook TARGET_MEMTAG_GRANULE_SIZE > > diff --git a/gcc/target.def b/gcc/target.def > index 38903eb567a..db48df9498d 100644 > --- a/gcc/target.def > +++ b/gcc/target.def > @@ -7457,11 +7457,11 @@ At preset, this feature does not support address > spaces. It also requires\n\ > bool, (), default_memtag_can_tag_addresses) > > DEFHOOK > -(tag_size, > +(tag_bitsize, > "Return the size of a tag (in bits) for this platform.\n\ > \n\ > The default returns 8.", > - uint8_t, (), default_memtag_tag_size) > + uint8_t, (), default_memtag_tag_bitsize) > > DEFHOOK > (granule_size, > diff --git a/gcc/targhooks.cc b/gcc/targhooks.cc > index c79458e374e..0696f95adeb 100644 > --- a/gcc/targhooks.cc > +++ b/gcc/targhooks.cc > @@ -2806,7 +2806,7 @@ default_memtag_can_tag_addresses () > } > > uint8_t > -default_memtag_tag_size () > +default_memtag_tag_bitsize () > { > return 8; > } > diff --git a/gcc/targhooks.h b/gcc/targhooks.h > index f16b58798c2..c9e57e475dc 100644 > --- a/gcc/targhooks.h > +++ b/gcc/targhooks.h > @@ -310,7 +310,7 @@ extern bool speculation_safe_value_not_needed (bool); > extern rtx default_speculation_safe_value (machine_mode, rtx, rtx, rtx); > > extern bool default_memtag_can_tag_addresses (); > -extern uint8_t default_memtag_tag_size (); > +extern uint8_t default_memtag_tag_bitsize (); > extern uint8_t default_memtag_granule_size (); > extern rtx default_memtag_insert_random_tag (rtx, rtx); > extern rtx default_memtag_add_tag (rtx, poly_int64, uint8_t);