From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
Arnd Bergmann <arnd@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: objtool crashes with some clang produced .o files
Date: Fri, 11 Dec 2020 10:37:48 -0600 [thread overview]
Message-ID: <20201211163748.b37gashl6an6misu@treble> (raw)
In-Reply-To: <20201211093205.GU2414@hirez.programming.kicks-ass.net>
On Fri, Dec 11, 2020 at 10:32:05AM +0100, Peter Zijlstra wrote:
> Looking at elf.c, it seems we're missing an STT_SECTION symbol for
> .text.
>
> And indeed, when I add -fno-asynchronous-unwind-tables to clang-11, that
> goes missing from the readelf .symtab listing. Help ?!
I had a similar problem with ORC relocations:
e81e07244325 ("objtool: Support Clang non-section symbols in ORC generation")
If Clang strips the section symbol then we have to find the function
symbol instead.
Does this fix it?
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index c6ab44543c92..9bc18864154f 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -472,8 +472,25 @@ static int create_static_call_sections(struct objtool_file *file)
return -1;
}
memset(reloc, 0, sizeof(*reloc));
- reloc->sym = insn->sec->sym;
- reloc->addend = insn->offset;
+
+ if (insn->sec->sym) {
+ reloc->sym = insn->sec->sym;
+ reloc->addend = insn->offset;
+ } else {
+ reloc->sym = find_symbol_containing(insn->sec, insn->offset);
+ if (!reloc->sym) {
+ WARN_FUNC("can't create static call: missing containing symbol",
+ insn->sec, insn->offset);
+ return -1;
+ }
+
+ reloc->addend = insn->offset - reloc->sym->offset;
+ }
+
reloc->type = R_X86_64_PC32;
reloc->offset = idx * sizeof(struct static_call_site);
reloc->sec = reloc_sec;
next prev parent reply other threads:[~2020-12-11 17:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-03 13:56 Arnd Bergmann
2020-12-10 23:35 ` Nick Desaulniers
2020-12-11 8:45 ` Peter Zijlstra
2020-12-11 9:32 ` Peter Zijlstra
2020-12-11 16:37 ` Josh Poimboeuf [this message]
2020-12-11 16:49 ` Peter Zijlstra
2020-12-11 17:46 ` Josh Poimboeuf
2020-12-11 20:57 ` Nick Desaulniers
2020-12-12 0:42 ` Nick Desaulniers
2020-12-12 0:47 ` Nick Desaulniers
2020-12-14 12:49 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201211163748.b37gashl6an6misu@treble \
--to=jpoimboe@redhat.com \
--cc=arnd@kernel.org \
--cc=clang-built-linux@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®