[PATCH v3 2/2] aarch64: Disable sysreg guards by default

Alice Carlotti alice.carlotti@arm.com
Thu Jul 10 16:48:03 GMT 2025


On Thu, Jul 10, 2025 at 09:11:18AM +0200, Jan Beulich wrote:
> On 10.07.2025 02:16, Alice Carlotti wrote:
> > --- a/opcodes/aarch64-opc.c
> > +++ b/opcodes/aarch64-opc.c
> > @@ -5162,6 +5162,13 @@ aarch64_sys_reg_alias_p (const uint32_t reg_flags)
> >    return (reg_flags & F_REG_ALIAS) != 0;
> >  }
> >  
> > +static bool aarch64_sysreg_checking_enabled = false;
> > +
> > +void aarch64_set_sysreg_checks (bool value)
> > +{
> > +  aarch64_sysreg_checking_enabled = value;
> > +}
> 
> While for gas this may be okay, such use of static variables isn't quite
> nice in what can be built as a shared library. Perhaps okay(ish) for the
> time being, but in the longer run (next release?) gas-only code may want
> moving to gas then?
> 
> Or, seeing there are only very few invocations of the two affected
> libopcode functions, maybe put the checks at the call sites instead of
> here?
> 
> Jan

Thanks for prompting me to look at the callers a bit more closely - for some
reason I thought these functions were called from within aarch64-opc.c.  I've
now also realised that this patch (and every other version so far) would have
inadvertently (at least from my perspective) disabled gating for system
instructions as well, not just system registers.

I'll move the checks into the callers, which will simplify things greatly.
I'll also hold off on the 1/2 patch for now, since most of the reason for the
refactoring no longer applies.

Alice


More information about the Binutils mailing list