Commit b09fb65e authored by Peter Zijlstra's avatar Peter Zijlstra

objtool: Remove INSN_STACK

With the unconditional use of handle_insn_ops(), INSN_STACK has lost
its purpose. Remove it.
Suggested-by: default avatarJulien Thierry <jthierry@redhat.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarMiroslav Benes <mbenes@suse.cz>
Acked-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20200428191659.854203028@infradead.org
parent 60041bcd
...@@ -21,7 +21,6 @@ enum insn_type { ...@@ -21,7 +21,6 @@ enum insn_type {
INSN_RETURN, INSN_RETURN,
INSN_EXCEPTION_RETURN, INSN_EXCEPTION_RETURN,
INSN_CONTEXT_SWITCH, INSN_CONTEXT_SWITCH,
INSN_STACK,
INSN_BUG, INSN_BUG,
INSN_NOP, INSN_NOP,
INSN_STAC, INSN_STAC,
......
...@@ -141,7 +141,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -141,7 +141,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
if (rex_w && !rex_b && modrm_mod == 3 && modrm_rm == 4) { if (rex_w && !rex_b && modrm_mod == 3 && modrm_rm == 4) {
/* add/sub reg, %rsp */ /* add/sub reg, %rsp */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_ADD; op->src.type = OP_SRC_ADD;
op->src.reg = op_to_cfi_reg[modrm_reg][rex_r]; op->src.reg = op_to_cfi_reg[modrm_reg][rex_r];
...@@ -154,7 +153,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -154,7 +153,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
case 0x50 ... 0x57: case 0x50 ... 0x57:
/* push reg */ /* push reg */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_REG; op->src.type = OP_SRC_REG;
op->src.reg = op_to_cfi_reg[op1 & 0x7][rex_b]; op->src.reg = op_to_cfi_reg[op1 & 0x7][rex_b];
...@@ -166,7 +164,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -166,7 +164,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
case 0x58 ... 0x5f: case 0x58 ... 0x5f:
/* pop reg */ /* pop reg */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_POP; op->src.type = OP_SRC_POP;
op->dest.type = OP_DEST_REG; op->dest.type = OP_DEST_REG;
...@@ -178,7 +175,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -178,7 +175,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
case 0x68: case 0x68:
case 0x6a: case 0x6a:
/* push immediate */ /* push immediate */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_CONST; op->src.type = OP_SRC_CONST;
op->dest.type = OP_DEST_PUSH; op->dest.type = OP_DEST_PUSH;
...@@ -196,7 +192,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -196,7 +192,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
if (modrm == 0xe4) { if (modrm == 0xe4) {
/* and imm, %rsp */ /* and imm, %rsp */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_AND; op->src.type = OP_SRC_AND;
op->src.reg = CFI_SP; op->src.reg = CFI_SP;
...@@ -215,7 +210,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -215,7 +210,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
break; break;
/* add/sub imm, %rsp */ /* add/sub imm, %rsp */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_ADD; op->src.type = OP_SRC_ADD;
op->src.reg = CFI_SP; op->src.reg = CFI_SP;
...@@ -229,7 +223,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -229,7 +223,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
if (rex_w && !rex_r && modrm_mod == 3 && modrm_reg == 4) { if (rex_w && !rex_r && modrm_mod == 3 && modrm_reg == 4) {
/* mov %rsp, reg */ /* mov %rsp, reg */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_REG; op->src.type = OP_SRC_REG;
op->src.reg = CFI_SP; op->src.reg = CFI_SP;
...@@ -242,7 +235,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -242,7 +235,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
if (rex_w && !rex_b && modrm_mod == 3 && modrm_rm == 4) { if (rex_w && !rex_b && modrm_mod == 3 && modrm_rm == 4) {
/* mov reg, %rsp */ /* mov reg, %rsp */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_REG; op->src.type = OP_SRC_REG;
op->src.reg = op_to_cfi_reg[modrm_reg][rex_r]; op->src.reg = op_to_cfi_reg[modrm_reg][rex_r];
...@@ -258,7 +250,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -258,7 +250,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
(modrm_mod == 1 || modrm_mod == 2) && modrm_rm == 5) { (modrm_mod == 1 || modrm_mod == 2) && modrm_rm == 5) {
/* mov reg, disp(%rbp) */ /* mov reg, disp(%rbp) */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_REG; op->src.type = OP_SRC_REG;
op->src.reg = op_to_cfi_reg[modrm_reg][rex_r]; op->src.reg = op_to_cfi_reg[modrm_reg][rex_r];
...@@ -270,7 +261,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -270,7 +261,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
} else if (rex_w && !rex_b && modrm_rm == 4 && sib == 0x24) { } else if (rex_w && !rex_b && modrm_rm == 4 && sib == 0x24) {
/* mov reg, disp(%rsp) */ /* mov reg, disp(%rsp) */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_REG; op->src.type = OP_SRC_REG;
op->src.reg = op_to_cfi_reg[modrm_reg][rex_r]; op->src.reg = op_to_cfi_reg[modrm_reg][rex_r];
...@@ -286,7 +276,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -286,7 +276,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
if (rex_w && !rex_b && modrm_mod == 1 && modrm_rm == 5) { if (rex_w && !rex_b && modrm_mod == 1 && modrm_rm == 5) {
/* mov disp(%rbp), reg */ /* mov disp(%rbp), reg */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_REG_INDIRECT; op->src.type = OP_SRC_REG_INDIRECT;
op->src.reg = CFI_BP; op->src.reg = CFI_BP;
...@@ -299,7 +288,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -299,7 +288,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
modrm_mod != 3 && modrm_rm == 4) { modrm_mod != 3 && modrm_rm == 4) {
/* mov disp(%rsp), reg */ /* mov disp(%rsp), reg */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_REG_INDIRECT; op->src.type = OP_SRC_REG_INDIRECT;
op->src.reg = CFI_SP; op->src.reg = CFI_SP;
...@@ -314,7 +302,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -314,7 +302,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
case 0x8d: case 0x8d:
if (sib == 0x24 && rex_w && !rex_b && !rex_x) { if (sib == 0x24 && rex_w && !rex_b && !rex_x) {
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
if (!insn.displacement.value) { if (!insn.displacement.value) {
/* lea (%rsp), reg */ /* lea (%rsp), reg */
...@@ -332,7 +319,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -332,7 +319,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
} else if (rex == 0x48 && modrm == 0x65) { } else if (rex == 0x48 && modrm == 0x65) {
/* lea disp(%rbp), %rsp */ /* lea disp(%rbp), %rsp */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_ADD; op->src.type = OP_SRC_ADD;
op->src.reg = CFI_BP; op->src.reg = CFI_BP;
...@@ -350,7 +336,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -350,7 +336,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
* Restoring rsp back to its original value after a * Restoring rsp back to its original value after a
* stack realignment. * stack realignment.
*/ */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_ADD; op->src.type = OP_SRC_ADD;
op->src.reg = CFI_R10; op->src.reg = CFI_R10;
...@@ -368,7 +353,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -368,7 +353,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
* Restoring rsp back to its original value after a * Restoring rsp back to its original value after a
* stack realignment. * stack realignment.
*/ */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_ADD; op->src.type = OP_SRC_ADD;
op->src.reg = CFI_R13; op->src.reg = CFI_R13;
...@@ -382,7 +366,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -382,7 +366,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
case 0x8f: case 0x8f:
/* pop to mem */ /* pop to mem */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_POP; op->src.type = OP_SRC_POP;
op->dest.type = OP_DEST_MEM; op->dest.type = OP_DEST_MEM;
...@@ -395,7 +378,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -395,7 +378,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
case 0x9c: case 0x9c:
/* pushf */ /* pushf */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_CONST; op->src.type = OP_SRC_CONST;
op->dest.type = OP_DEST_PUSHF; op->dest.type = OP_DEST_PUSHF;
...@@ -404,7 +386,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -404,7 +386,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
case 0x9d: case 0x9d:
/* popf */ /* popf */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_POPF; op->src.type = OP_SRC_POPF;
op->dest.type = OP_DEST_MEM; op->dest.type = OP_DEST_MEM;
...@@ -443,7 +424,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -443,7 +424,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
} else if (op2 == 0xa0 || op2 == 0xa8) { } else if (op2 == 0xa0 || op2 == 0xa8) {
/* push fs/gs */ /* push fs/gs */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_CONST; op->src.type = OP_SRC_CONST;
op->dest.type = OP_DEST_PUSH; op->dest.type = OP_DEST_PUSH;
...@@ -452,7 +432,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -452,7 +432,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
} else if (op2 == 0xa1 || op2 == 0xa9) { } else if (op2 == 0xa1 || op2 == 0xa9) {
/* pop fs/gs */ /* pop fs/gs */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_POP; op->src.type = OP_SRC_POP;
op->dest.type = OP_DEST_MEM; op->dest.type = OP_DEST_MEM;
...@@ -469,7 +448,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -469,7 +448,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
* mov bp, sp * mov bp, sp
* pop bp * pop bp
*/ */
*type = INSN_STACK;
ADD_OP(op) ADD_OP(op)
op->dest.type = OP_DEST_LEAVE; op->dest.type = OP_DEST_LEAVE;
...@@ -537,7 +515,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, ...@@ -537,7 +515,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
else if (modrm_reg == 6) { else if (modrm_reg == 6) {
/* push from mem */ /* push from mem */
*type = INSN_STACK;
ADD_OP(op) { ADD_OP(op) {
op->src.type = OP_SRC_CONST; op->src.type = OP_SRC_CONST;
op->dest.type = OP_DEST_PUSH; op->dest.type = OP_DEST_PUSH;
......
...@@ -2339,9 +2339,6 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, ...@@ -2339,9 +2339,6 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
} }
return 0; return 0;
case INSN_STACK:
break;
case INSN_STAC: case INSN_STAC:
if (state.uaccess) { if (state.uaccess) {
WARN_FUNC("recursive UACCESS enable", sec, insn->offset); WARN_FUNC("recursive UACCESS enable", sec, insn->offset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment