From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Denys Vlasenko <dvlasenk@redhat.com>
Subject: Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings
Date: Thu, 2 Mar 2017 12:25:15 -0600 [thread overview]
Message-ID: <20170302182515.zybdzrnbf35hqzbm@treble> (raw)
In-Reply-To: <CAK8P3a3pSgmRXfd9WvfvLD6ptDS1NDS5rnqnNhQM77-4Qb+pMQ@mail.gmail.com>
On Wed, Mar 01, 2017 at 04:21:36PM +0100, Arnd Bergmann wrote:
> On Wed, Mar 1, 2017 at 3:31 PM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> > On Wed, Mar 01, 2017 at 10:34:42AM +0100, Arnd Bergmann wrote:
> >> On Tue, Oct 11, 2016 at 10:38 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> >> > On Tuesday, October 11, 2016 10:51:46 AM CEST Josh Poimboeuf wrote:
> >> >>
> >> >> 3) 0xFC244C03-config:
> >> >> drivers/scsi/fnic/fnic_main.o: warning: objtool: fnic_log_q_error() falls through to next function fnic_handle_link_event()
> >> >> drivers/scsi/snic/snic_res.o: warning: objtool: .text: unexpected end of section
> >> >>
> >> >> These look like another bad gcc bug which is truncating functions:
> >> >
> >> > Same bug for both of them?
> >>
> >> I ran into this one again today, after updating to the latest gcc-7.0.1:
> >>
> >> drivers/infiniband/sw/rxe/rxe_resp.o: warning: objtool:
> >> rxe_responder()+0xfe: sibling call from callable instruction with
> >> changed frame pointer
> >>
> >> Josh, did you get around to updating objtool the last time I reported it, or
> >> is it still the same problem? If this is a new variation, I can provide more
> >> details about the failure, otherwise I'll just ignore it for now.
> >
> > This one should have been fixed with:
> >
> > 3732710ff6f2 ("objtool: Improve rare switch jump table pattern detection")
>
> It was on the current linux-next, so that commit should certainly be included.
>
> > Can you attach the object file?
Here's the preliminary fix for this one (still needs more testing):
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index bd12eb1..7b718bb 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -806,11 +806,20 @@ static struct rela *find_switch_table(struct objtool_file *file,
insn->jump_dest->offset > orig_insn->offset))
break;
+ /* look for a rela 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;
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 0d7983a..d897702 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -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)
{
diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h
index aa1ff65..731973e 100644
--- a/tools/objtool/elf.h
+++ b/tools/objtool/elf.h
@@ -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);
next prev parent reply other threads:[~2017-03-02 18:34 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-10 12:56 [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Arnd Bergmann
2016-10-10 20:23 ` Josh Poimboeuf
2016-10-11 8:08 ` Arnd Bergmann
2016-10-11 12:20 ` Josh Poimboeuf
2016-10-11 13:30 ` Arnd Bergmann
2016-10-11 15:05 ` Josh Poimboeuf
2016-10-11 15:51 ` Josh Poimboeuf
2016-10-11 20:38 ` Arnd Bergmann
2016-10-12 13:01 ` Josh Poimboeuf
2016-10-13 12:46 ` Another gcc corruption bug (was Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings) Josh Poimboeuf
2016-10-13 17:57 ` Denys Vlasenko
2016-10-13 20:15 ` Josh Poimboeuf
2017-03-01 9:34 ` [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Arnd Bergmann
2017-03-01 9:45 ` Arnd Bergmann
2017-03-01 14:40 ` Josh Poimboeuf
2017-03-01 15:27 ` Arnd Bergmann
2017-03-01 16:53 ` Josh Poimboeuf
2017-03-01 22:05 ` Arnd Bergmann
2017-03-01 22:42 ` Arnd Bergmann
2017-03-02 1:03 ` Josh Poimboeuf
2017-03-02 6:31 ` Ingo Molnar
2017-03-02 12:49 ` Josh Poimboeuf
2017-03-02 13:46 ` Ingo Molnar
2017-03-02 14:08 ` Josh Poimboeuf
2017-03-02 14:46 ` Ingo Molnar
2017-03-02 22:49 ` Arnd Bergmann
2017-03-02 23:05 ` Josh Poimboeuf
2017-03-03 8:58 ` Arnd Bergmann
2017-03-03 11:27 ` Arnd Bergmann
2017-03-01 14:31 ` Josh Poimboeuf
2017-03-01 15:21 ` Arnd Bergmann
2017-03-02 18:25 ` Josh Poimboeuf [this message]
2017-03-02 22:43 ` Arnd Bergmann
2017-03-02 22:57 ` [PATCH] objtool: fix another gcc jump table detection issue Josh Poimboeuf
2017-03-02 23:01 ` Arnd Bergmann
2016-10-11 1:53 ` [PATCH] objtool: support '-mtune=atom' stack frame setup instruction Josh Poimboeuf
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=20170302182515.zybdzrnbf35hqzbm@treble \
--to=jpoimboe@redhat.com \
--cc=arnd@arndb.de \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).