[RFC v5 16/57] objtool: Support restoring BP from the stack without POP

From: Julien Thierry
Date: Thu Jan 09 2020 - 11:05:12 EST


Support instruction that set BP to its previous value (base on the
current CFA state) from the stack without modifying the stack pointer.

Signed-off-by: Julien Thierry <jthierry@xxxxxxxxxx>
---
tools/objtool/check.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 5b2539eaccba..0a5c51e4e24c 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1507,6 +1507,12 @@ static int update_insn_state(struct instruction *insn, struct insn_state *state)
cfa->base = state->drap_reg;
cfa->offset = 0;
state->drap_offset = -1;
+ } else if (!state->drap && op->src.reg == CFI_SP &&
+ op->dest.reg == cfa->base) {
+
+ /* mov disp(%rsp), %rbp */
+ cfa->base = CFI_SP;
+ cfa->offset += op->src.offset;
}

if (state->drap && op->src.reg == CFI_BP &&
--
2.21.0