[PATCH v6 1/2] opcodes: microblaze: Add new bit-field instructions
Frager, Neal
neal.frager@amd.com
Sun Oct 15 16:48:29 GMT 2023
Hi Michael,
> When I run the test suite I see many segfaults.
> Take a look at
> gas/config/tc-microblaze.c +418:
> md_begin() ...
> /* Insert unique names into hash table. */
> for (opcode = microblaze_opcodes; opcode->name; opcode ++)
> str_hash_insert (opcode_hash_control, opcode->name, opcode, 0);
> compare the end of the microblaze_opcodes table:
> binutils/opcodes/microblaze-opc.h +427
> microblaze_opcodes[] ...
> {"", 0, 0, 0, 0, 0, 0, 0, 0},
> It looks like there is a mismatch on termination condition.
> I changed this to
> {NULL, 0, 0, 0, 0, 0, 0, 0, 0},
> I'm at a loss to explain why this did not fail earlier.
I believe I know why this did not fail earlier.
In the past, the array size was larger than needed with a value of MAX_OPCODES that was larger than the number of elements in the array.
As part of this patch, I reduced the MAX_OPCODES to the exact number of elements in the array.
-#define MAX_OPCODES 300
+#define MAX_OPCODES 291
So in the past, there were extra NULL elements beyond the end of the array.
In any case, thank you for your review, fixing this issue and committing the patch!
Best regards,
Neal Frager
AMD
More information about the Binutils
mailing list