[PATCH v2 2/2] Hexagon: implement machine flag check

Mark Wielaard mark@klomp.org
Thu Apr 4 16:29:12 GMT 2024


Hi,

On Tue, 2024-04-02 at 21:38 +0000, Brian Cain wrote:
> > diff --git a/backends/hexagon_symbol.c b/backends/hexagon_symbol.c
> > index b341243e..1e681e9f 100644
> > --- a/backends/hexagon_symbol.c
> > +++ b/backends/hexagon_symbol.c
> > @@ -56,3 +56,11 @@ hexagon_reloc_simple_type (Ebl *ebl __attribute__
> > ((unused)), int type,
> >        return ELF_T_NUM;
> >      }
> >  }
> > +
> > +bool
> > +hexagon_machine_flag_check (GElf_Word flags)
> > +{
> > +  GElf_Word arch_variant = flags &~ EF_HEXAGON_MACH;
> > +  /* 0x8000 covers the "tiny core" arch variants. */
> > +  return arch_variant == 0 || arch_variant == 0x8000;
> > +}
> > --
> > 2.37.2
> 
> What about this instead?
> 
> bool hexagon_machine_flag_check(GElf_Word flags) {
> 	GElf_Word reserved_flags = ~(EF_HEXAGON_TINY | EF_HEXAGON_MACH);
> 
> 	return (flags & reserved_flags) == 0;
> }
> 
> ... implies a new EF_HEXAGON_TINY 0x8000 definition BTW.

You obviously know this architecture better than me. But is the TINY
flag (bit 15) appropriate for all machines? It looks like it can only
be set on V67 and V71. If so maybe just check those two explicitly?

Cheers,

Mark


More information about the Elfutils-devel mailing list