summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2019-07-18 20:50:48 +0200
committerThomas Gleixner <tglx@linutronix.de>2019-07-18 20:50:48 +0200
commit54f698f31e595f3f0caf28bfe2bde0c3373f9a60 (patch)
tree143df87eb2e09ccf20e0eff0890685ac5fbca431 /tools
parentcac9b9a4b08304f11daace03b8b48659355e44c1 (diff)
parente55a73251da335873a6e87d68fb17e5aabb8978e (diff)
Merge branch 'x86/debug' into core/urgent
Pick up the two pending objtool patches as the next round of objtool fixes depend on them.
Diffstat (limited to 'tools')
-rw-r--r--tools/objtool/check.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index de8f40730b37..2f8ba0368231 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -18,6 +18,8 @@
#define FAKE_JUMP_OFFSET -1
+#define C_JUMP_TABLE_SECTION ".rodata..c_jump_table"
+
struct alternative {
struct list_head list;
struct instruction *insn;
@@ -1035,9 +1037,15 @@ static struct rela *find_switch_table(struct objtool_file *file,
/*
* Make sure the .rodata address isn't associated with a
- * symbol. gcc jump tables are anonymous data.
+ * symbol. GCC jump tables are anonymous data.
+ *
+ * Also support C jump tables which are in the same format as
+ * switch jump tables. For objtool to recognize them, they
+ * need to be placed in the C_JUMP_TABLE_SECTION section. They
+ * have symbols associated with them.
*/
- if (find_symbol_containing(rodata_sec, table_offset))
+ if (find_symbol_containing(rodata_sec, table_offset) &&
+ strcmp(rodata_sec->name, C_JUMP_TABLE_SECTION))
continue;
rodata_rela = find_rela_by_dest(rodata_sec, table_offset);
@@ -1277,13 +1285,18 @@ static void mark_rodata(struct objtool_file *file)
bool found = false;
/*
- * This searches for the .rodata section or multiple .rodata.func_name
- * sections if -fdata-sections is being used. The .str.1.1 and .str.1.8
- * rodata sections are ignored as they don't contain jump tables.
+ * Search for the following rodata sections, each of which can
+ * potentially contain jump tables:
+ *
+ * - .rodata: can contain GCC switch tables
+ * - .rodata.<func>: same, if -fdata-sections is being used
+ * - .rodata..c_jump_table: contains C annotated jump tables
+ *
+ * .rodata.str1.* sections are ignored; they don't contain jump tables.
*/
for_each_sec(file, sec) {
- if (!strncmp(sec->name, ".rodata", 7) &&
- !strstr(sec->name, ".str1.")) {
+ if ((!strncmp(sec->name, ".rodata", 7) && !strstr(sec->name, ".str1.")) ||
+ !strcmp(sec->name, C_JUMP_TABLE_SECTION)) {
sec->rodata = true;
found = true;
}