@@ -6,7 +6,7 @@
#define EX_ORIG_OFFSET 0
#define EX_NEW_OFFSET 4
-#define JUMP_ENTRY_SIZE 16
+#define JUMP_ENTRY_SIZE (8 + elf_addr_size(elf)) /* 12 on PPC32, 16 on PPC64 */
#define JUMP_ORIG_OFFSET 0
#define JUMP_NEW_OFFSET 4
#define JUMP_KEY_OFFSET 8
@@ -26,34 +26,6 @@ struct special_entry {
unsigned char key; /* jump_label key */
};
-static const struct special_entry entries[] = {
- {
- .sec = ".altinstructions",
- .group = true,
- .size = ALT_ENTRY_SIZE,
- .orig = ALT_ORIG_OFFSET,
- .orig_len = ALT_ORIG_LEN_OFFSET,
- .new = ALT_NEW_OFFSET,
- .new_len = ALT_NEW_LEN_OFFSET,
- .feature = ALT_FEATURE_OFFSET,
- },
- {
- .sec = "__jump_table",
- .jump_or_nop = true,
- .size = JUMP_ENTRY_SIZE,
- .orig = JUMP_ORIG_OFFSET,
- .new = JUMP_NEW_OFFSET,
- .key = JUMP_KEY_OFFSET,
- },
- {
- .sec = "__ex_table",
- .size = EX_ENTRY_SIZE,
- .orig = EX_ORIG_OFFSET,
- .new = EX_NEW_OFFSET,
- },
- {},
-};
-
void __weak arch_handle_alternative(unsigned short feature, struct special_alt *alt)
{
}
@@ -144,6 +116,33 @@ int special_get_alts(struct elf *elf, struct list_head *alts)
unsigned int nr_entries;
struct special_alt *alt;
int idx, ret;
+ const struct special_entry entries[] = {
+ {
+ .sec = ".altinstructions",
+ .group = true,
+ .size = ALT_ENTRY_SIZE,
+ .orig = ALT_ORIG_OFFSET,
+ .orig_len = ALT_ORIG_LEN_OFFSET,
+ .new = ALT_NEW_OFFSET,
+ .new_len = ALT_NEW_LEN_OFFSET,
+ .feature = ALT_FEATURE_OFFSET,
+ },
+ {
+ .sec = "__jump_table",
+ .jump_or_nop = true,
+ .size = JUMP_ENTRY_SIZE,
+ .orig = JUMP_ORIG_OFFSET,
+ .new = JUMP_NEW_OFFSET,
+ .key = JUMP_KEY_OFFSET,
+ },
+ {
+ .sec = "__ex_table",
+ .size = EX_ENTRY_SIZE,
+ .orig = EX_ORIG_OFFSET,
+ .new = EX_NEW_OFFSET,
+ },
+ {},
+ };
INIT_LIST_HEAD(alts);