objtool: skip non-text sections when adding return-thunk sites
authorThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 1 Jul 2022 12:00:45 +0000 (09:00 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Jul 2022 10:53:58 +0000 (12:53 +0200)
commitb0fb9784cf803472bbdcd3d98364c27966fee679
tree4ca023a0e5650c892a4914583ffd4d45dc56225d
parent1920e4be8a975f769a9c2d2e77a1f1a02c88b58a
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/objtool/check.c