[PATCH] aarch64: Don't assert on long system registers
Nick Clifton
nickc@redhat.com
Wed Jul 22 14:38:15 GMT 2020
Hi Alex,
> OK for master?
Sorry - I do not like this assumption:
/* Assume that our buffer is big enough for any valid system register. */
You never know - one day there might be an extra long system register name.
I think that it would be better to provide a definition for the maximum
length include/opcode/aarch64.h and then use it the code you are patching.
Something like:
aarch64.h:
#define MAX_SYSREG_NAME_LEN 32
typedef struct
{
const char name[MAX_SYSREG_NAME_LEN];
aarch64_insn value;
uint32_t flags;
[....]
tc-aarch64.c:
static int
parse_sys_reg (char **str, struct hash_control *sys_regs,
int imple_defined_p, int pstatefield_p,
uint32_t* flags)
{
char *p, *q;
char buf[MAX_SYSREG_NAME_LEN];
[...]
/* If the name is longer than our buffer then it cannot be valid. */
if (p - buf != q - *str)
return PARSE_FAIL;
If an extra long system register name is ever defined then the
initialisation code in opcodes/aarch64-opc.c should fail (at
compile time) and the #define can be increased to accommodate the
new maximum length.
Cheers
Nick
More information about the Binutils
mailing list