diff options
author | Thadeu Lima de Souza Cascardo <cascardo@canonical.com> | 2022-07-01 15:00:45 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-25 12:26:37 +0300 |
commit | 446eb6f08936e6f87bea9f35be05556a7211df9b (patch) | |
tree | b6b25a25a7101d78395b03102a15a5a9a791a7e5 | |
parent | 8bdb25f7aee312450e9c9ac21ae209d9cf0602e5 (diff) | |
download | linux-446eb6f08936e6f87bea9f35be05556a7211df9b.tar.xz |
objtool: skip non-text sections when adding return-thunk sites
The .discard.text section is added in order to reserve BRK, with a
temporary function just so it can give it a size. This adds a relocation to
the return thunk, which objtool will add to the .return_sites section.
Linking will then fail as there are references to the .discard.text
section.
Do not add instructions from non-text sections to the list of return thunk
calls, avoiding the reference to .discard.text.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | tools/objtool/check.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 32203e458e44..95c2fd945a1b 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1090,7 +1090,9 @@ static void add_return_call(struct objtool_file *file, struct instruction *insn) insn->type = INSN_RETURN; insn->retpoline_safe = true; - list_add_tail(&insn->call_node, &file->return_thunk_list); + /* Skip the non-text sections, specially .discard ones */ + if (insn->sec->text) + list_add_tail(&insn->call_node, &file->return_thunk_list); } /* |