aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-03-07 17:02:56 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-03-07 17:02:56 -0500
commitc688f14ccd4266289fd51e76210c13fdf67f1d9d (patch)
tree3bcf79ff8da8e83e7986c3db275261deb20bf10a
parent9e91c144e689bb780b412c2c7908b9cf7b96f31f (diff)
parent5c51f4ae84df0f9df33ac08aa5be50061a8b4242 (diff)
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core fixes from Ingo Molnar: "A couple of sched.h splitup related build fixes, plus an objtool fix" * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: objtool: Fix another GCC jump table detection issue drivers/char/nwbutton: Fix build breakage caused by include file reshuffling h8300: Fix build breakage caused by header file changes avr32: Fix build error caused by include file reshuffling
-rw-r--r--arch/avr32/oprofile/backtrace.c2
-rw-r--r--arch/h8300/kernel/ptrace_h.c2
-rw-r--r--drivers/char/nwbutton.c2
-rw-r--r--tools/objtool/builtin-check.c15
-rw-r--r--tools/objtool/elf.c12
-rw-r--r--tools/objtool/elf.h1
6 files changed, 28 insertions, 6 deletions
diff --git a/arch/avr32/oprofile/backtrace.c b/arch/avr32/oprofile/backtrace.c
index 75d9ad6f99cf..29cf2f191bfd 100644
--- a/arch/avr32/oprofile/backtrace.c
+++ b/arch/avr32/oprofile/backtrace.c
@@ -14,7 +14,7 @@
14 */ 14 */
15 15
16#include <linux/oprofile.h> 16#include <linux/oprofile.h>
17#include <linux/sched.h> 17#include <linux/ptrace.h>
18#include <linux/uaccess.h> 18#include <linux/uaccess.h>
19 19
20/* The first two words of each frame on the stack look like this if we have 20/* The first two words of each frame on the stack look like this if we have
diff --git a/arch/h8300/kernel/ptrace_h.c b/arch/h8300/kernel/ptrace_h.c
index fe3b5673baba..f5ff3b794c85 100644
--- a/arch/h8300/kernel/ptrace_h.c
+++ b/arch/h8300/kernel/ptrace_h.c
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <linux/sched.h> 12#include <linux/sched/signal.h>
13#include <asm/ptrace.h> 13#include <asm/ptrace.h>
14 14
15#define BREAKINST 0x5730 /* trapa #3 */ 15#define BREAKINST 0x5730 /* trapa #3 */
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c
index a5b1eb276c0b..e6d0d271c58c 100644
--- a/drivers/char/nwbutton.c
+++ b/drivers/char/nwbutton.c
@@ -6,7 +6,7 @@
6 6
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/sched.h> 9#include <linux/sched/signal.h>
10#include <linux/interrupt.h> 10#include <linux/interrupt.h>
11#include <linux/time.h> 11#include <linux/time.h>
12#include <linux/timer.h> 12#include <linux/timer.h>
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 4cfdbb5b6967..066086dd59a8 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -805,11 +805,20 @@ static struct rela *find_switch_table(struct objtool_file *file,
805 insn->jump_dest->offset > orig_insn->offset)) 805 insn->jump_dest->offset > orig_insn->offset))
806 break; 806 break;
807 807
808 /* look for a relocation which references .rodata */
808 text_rela = find_rela_by_dest_range(insn->sec, insn->offset, 809 text_rela = find_rela_by_dest_range(insn->sec, insn->offset,
809 insn->len); 810 insn->len);
810 if (text_rela && text_rela->sym == file->rodata->sym) 811 if (!text_rela || text_rela->sym != file->rodata->sym)
811 return find_rela_by_dest(file->rodata, 812 continue;
812 text_rela->addend); 813
814 /*
815 * Make sure the .rodata address isn't associated with a
816 * symbol. gcc jump tables are anonymous data.
817 */
818 if (find_symbol_containing(file->rodata, text_rela->addend))
819 continue;
820
821 return find_rela_by_dest(file->rodata, text_rela->addend);
813 } 822 }
814 823
815 return NULL; 824 return NULL;
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 0d7983ac63ef..d897702ce742 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -85,6 +85,18 @@ struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset)
85 return NULL; 85 return NULL;
86} 86}
87 87
88struct symbol *find_symbol_containing(struct section *sec, unsigned long offset)
89{
90 struct symbol *sym;
91
92 list_for_each_entry(sym, &sec->symbol_list, list)
93 if (sym->type != STT_SECTION &&
94 offset >= sym->offset && offset < sym->offset + sym->len)
95 return sym;
96
97 return NULL;
98}
99
88struct rela *find_rela_by_dest_range(struct section *sec, unsigned long offset, 100struct rela *find_rela_by_dest_range(struct section *sec, unsigned long offset,
89 unsigned int len) 101 unsigned int len)
90{ 102{
diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h
index aa1ff6596684..731973e1a3f5 100644
--- a/tools/objtool/elf.h
+++ b/tools/objtool/elf.h
@@ -79,6 +79,7 @@ struct elf {
79struct elf *elf_open(const char *name); 79struct elf *elf_open(const char *name);
80struct section *find_section_by_name(struct elf *elf, const char *name); 80struct section *find_section_by_name(struct elf *elf, const char *name);
81struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset); 81struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset);
82struct symbol *find_symbol_containing(struct section *sec, unsigned long offset);
82struct rela *find_rela_by_dest(struct section *sec, unsigned long offset); 83struct rela *find_rela_by_dest(struct section *sec, unsigned long offset);
83struct rela *find_rela_by_dest_range(struct section *sec, unsigned long offset, 84struct rela *find_rela_by_dest_range(struct section *sec, unsigned long offset,
84 unsigned int len); 85 unsigned int len);