Executables that are generated by Clang don't have a .shstrtab
section, and store section names in .strtab instead. We can store
section names generated by orc there in this case.

Signed-off-by: Simon Ser <cont...@emersion.fr>
---
 tools/objtool/elf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 4e60e105583..6b9705d8b55 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -507,7 +507,10 @@ struct section *elf_create_section(struct elf *elf, const 
char *name,
        /* Add section name to .shstrtab */
        shstrtab = find_section_by_name(elf, ".shstrtab");
        if (!shstrtab) {
-               WARN("can't find .shstrtab section");
+               shstrtab = find_section_by_name(elf, ".strtab");
+       }
+       if (!shstrtab) {
+               WARN("can't find .shstrtab or .strtab section");
                return NULL;
        }
 
-- 
2.18.0


Reply via email to