[tip: objtool/core] objtool: Skip ORC entry creation for non-text sections

From: tip-bot2 for Julien Thierry
Date: Thu Sep 10 2020 - 14:58:35 EST

The following commit has been merged into the objtool/core branch of tip:

Commit-ID: 3eaecac88a17f7fdf29561a197dc728f7f697c60
Gitweb: https://git.kernel.org/tip/3eaecac88a17f7fdf29561a197dc728f7f697c60
Author: Julien Thierry <jthierry@xxxxxxxxxx>
AuthorDate: Tue, 25 Aug 2020 13:47:41 +01:00
Committer: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
CommitterDate: Tue, 01 Sep 2020 17:19:11 -05:00

objtool: Skip ORC entry creation for non-text sections

Orc generation is only done for text sections, but some instructions
can be found in non-text sections (e.g. .discard.text sections).

Skip setting their orc sections since their whole sections will be
skipped for orc generation.

Reviewed-by: Miroslav Benes <mbenes@xxxxxxx>
Signed-off-by: Julien Thierry <jthierry@xxxxxxxxxx>
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
tools/objtool/orc_gen.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/tools/objtool/orc_gen.c b/tools/objtool/orc_gen.c
index e6b2363..22fe439 100644
--- a/tools/objtool/orc_gen.c
+++ b/tools/objtool/orc_gen.c
@@ -18,6 +18,9 @@ int create_orc(struct objtool_file *file)
struct cfi_reg *cfa = &insn->cfi.cfa;
struct cfi_reg *bp = &insn->cfi.regs[CFI_BP];

+ if (!insn->sec->text)
+ continue;
orc->end = insn->cfi.end;

if (cfa->base == CFI_UNDEFINED) {