diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-12-27 20:08:23 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-12-27 20:08:23 +0300 |
commit | cce622ab9284a27257dd75bb35eccdd619bf96d1 (patch) | |
tree | 3384128c908f1d614c36627621d15b9e3c9dbd36 /tools/objtool/check.c | |
parent | 6be5f58215f1dcbd697a695ad5db9986c28c50c3 (diff) | |
parent | 44f6a7c0755d8dd453c70557e11687bb080a6f21 (diff) | |
download | linux-cce622ab9284a27257dd75bb35eccdd619bf96d1.tar.xz |
Merge tag 'objtool-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull objtool fix from Ingo Molnar:
"Fix a segfault that occurs when built with Clang"
* tag 'objtool-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
objtool: Fix seg fault with Clang non-section symbols
Diffstat (limited to 'tools/objtool/check.c')
-rw-r--r-- | tools/objtool/check.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index c6ab44543c92..5f8d3eed78a1 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -467,13 +467,20 @@ static int create_static_call_sections(struct objtool_file *file) /* populate reloc for 'addr' */ reloc = malloc(sizeof(*reloc)); + if (!reloc) { perror("malloc"); return -1; } memset(reloc, 0, sizeof(*reloc)); - reloc->sym = insn->sec->sym; - reloc->addend = insn->offset; + + insn_to_reloc_sym_addend(insn->sec, insn->offset, reloc); + if (!reloc->sym) { + WARN_FUNC("static call tramp: missing containing symbol", + insn->sec, insn->offset); + return -1; + } + reloc->type = R_X86_64_PC32; reloc->offset = idx * sizeof(struct static_call_site); reloc->sec = reloc_sec; |