Skip to content

Commit

Permalink
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
torvalds committed Mar 7, 2017
2 parents 9e91c14 + 5c51f4a commit c688f14
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion arch/avr32/oprofile/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

#include <linux/oprofile.h>
#include <linux/sched.h>
#include <linux/ptrace.h>
#include <linux/uaccess.h>

/* The first two words of each frame on the stack look like this if we have
Expand Down
2 changes: 1 addition & 1 deletion arch/h8300/kernel/ptrace_h.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

#include <linux/linkage.h>
#include <linux/sched.h>
#include <linux/sched/signal.h>
#include <asm/ptrace.h>

#define BREAKINST 0x5730 /* trapa #3 */
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/nwbutton.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/sched/signal.h>
#include <linux/interrupt.h>
#include <linux/time.h>
#include <linux/timer.h>
Expand Down
15 changes: 12 additions & 3 deletions tools/objtool/builtin-check.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,11 +805,20 @@ static struct rela *find_switch_table(struct objtool_file *file,
insn->jump_dest->offset > orig_insn->offset))
break;

/* look for a relocation which references .rodata */
text_rela = find_rela_by_dest_range(insn->sec, insn->offset,
insn->len);
if (text_rela && text_rela->sym == file->rodata->sym)
return find_rela_by_dest(file->rodata,
text_rela->addend);
if (!text_rela || text_rela->sym != file->rodata->sym)
continue;

/*
* Make sure the .rodata address isn't associated with a
* symbol. gcc jump tables are anonymous data.
*/
if (find_symbol_containing(file->rodata, text_rela->addend))
continue;

return find_rela_by_dest(file->rodata, text_rela->addend);
}

return NULL;
Expand Down
12 changes: 12 additions & 0 deletions tools/objtool/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset)
return NULL;
}

struct symbol *find_symbol_containing(struct section *sec, unsigned long offset)
{
struct symbol *sym;

list_for_each_entry(sym, &sec->symbol_list, list)
if (sym->type != STT_SECTION &&
offset >= sym->offset && offset < sym->offset + sym->len)
return sym;

return NULL;
}

struct rela *find_rela_by_dest_range(struct section *sec, unsigned long offset,
unsigned int len)
{
Expand Down
1 change: 1 addition & 0 deletions tools/objtool/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct elf {
struct elf *elf_open(const char *name);
struct section *find_section_by_name(struct elf *elf, const char *name);
struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset);
struct symbol *find_symbol_containing(struct section *sec, unsigned long offset);
struct rela *find_rela_by_dest(struct section *sec, unsigned long offset);
struct rela *find_rela_by_dest_range(struct section *sec, unsigned long offset,
unsigned int len);
Expand Down

0 comments on commit c688f14

Please sign in to comment.