aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2018-07-09 12:17:22 -0400
committerIngo Molnar <mingo@kernel.org>2018-07-14 08:59:42 -0400
commit6d77d3b43ad84a48b502f02dc618e7c36737bdfe (patch)
treef4ce8047ac13a65209141973bb35b90b4c2f5ebe
parent2db39a2f491a48ec740e0214a7dd584eefc2137d (diff)
objtool: Use '.strtab' if '.shstrtab' doesn't exist, to support ORC tables on Clang
Clang puts its section header names in the '.strtab' section instead of '.shstrtab', which causes objtool to fail with a "can't find .shstrtab section" warning when attempting to write ORC metadata to an object file. If '.shstrtab' doesn't exist, use '.strtab' instead. Signed-off-by: Simon Ser <contact@emersion.fr> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/d1c1c3fe55872be433da7bc5e1860538506229ba.1531153015.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--tools/objtool/elf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 0d1acb704f64..7ec85d567598 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -519,10 +519,12 @@ struct section *elf_create_section(struct elf *elf, const char *name,
519 sec->sh.sh_flags = SHF_ALLOC; 519 sec->sh.sh_flags = SHF_ALLOC;
520 520
521 521
522 /* Add section name to .shstrtab */ 522 /* Add section name to .shstrtab (or .strtab for Clang) */
523 shstrtab = find_section_by_name(elf, ".shstrtab"); 523 shstrtab = find_section_by_name(elf, ".shstrtab");
524 if (!shstrtab)
525 shstrtab = find_section_by_name(elf, ".strtab");
524 if (!shstrtab) { 526 if (!shstrtab) {
525 WARN("can't find .shstrtab section"); 527 WARN("can't find .shstrtab or .strtab section");
526 return NULL; 528 return NULL;
527 } 529 }
528 530