Alternative code, including jump table and exception table, is represented with the same struct alternative structure. But there is no obvious way to identify whether the struct represents alternative instructions, a jump table or an exception table. So add a type to struct alternative to clearly identify the type of alternative.
Showing the changes to tools/objtool/include/objtool (1 of 2 files). Show all
Unified · Split
| @@ -38,6 +38,18 @@ struct alt_group { · 37 unmodified lines | |||
| 38 | bool ignore; | 38 | bool ignore; |
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | enum alternative_type { | ||
| 42 | ALT_TYPE_INSTRUCTIONS, | ||
| 43 | ALT_TYPE_JUMP_TABLE, | ||
| 44 | ALT_TYPE_EX_TABLE, | ||
| 45 | }; | ||
| 46 | |||
| 47 | struct alternative { | ||
| 48 | struct alternative *next; | ||
| 49 | struct instruction *insn; | ||
| 50 | enum alternative_type type; | ||
| 51 | }; | ||
| 52 | |||
| 41 | #define INSN_CHUNK_BITS 8 | 53 | #define INSN_CHUNK_BITS 8 |
| 42 | #define INSN_CHUNK_SIZE (1 << INSN_CHUNK_BITS) | 54 | #define INSN_CHUNK_SIZE (1 << INSN_CHUNK_BITS) |
| 43 | #define INSN_CHUNK_MAX (INSN_CHUNK_SIZE - 1) | 55 | #define INSN_CHUNK_MAX (INSN_CHUNK_SIZE - 1) |