Skip to content

Commit b09fb65

Browse files
author
Peter Zijlstra
committed
objtool: Remove INSN_STACK
With the unconditional use of handle_insn_ops(), INSN_STACK has lost its purpose. Remove it. Suggested-by: Julien Thierry <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Miroslav Benes <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 60041bc commit b09fb65

File tree

3 files changed

+0
-27
lines changed

3 files changed

+0
-27
lines changed

tools/objtool/arch.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ enum insn_type {
2121
INSN_RETURN,
2222
INSN_EXCEPTION_RETURN,
2323
INSN_CONTEXT_SWITCH,
24-
INSN_STACK,
2524
INSN_BUG,
2625
INSN_NOP,
2726
INSN_STAC,

tools/objtool/arch/x86/decode.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
141141
if (rex_w && !rex_b && modrm_mod == 3 && modrm_rm == 4) {
142142

143143
/* add/sub reg, %rsp */
144-
*type = INSN_STACK;
145144
ADD_OP(op) {
146145
op->src.type = OP_SRC_ADD;
147146
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,
154153
case 0x50 ... 0x57:
155154

156155
/* push reg */
157-
*type = INSN_STACK;
158156
ADD_OP(op) {
159157
op->src.type = OP_SRC_REG;
160158
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,
166164
case 0x58 ... 0x5f:
167165

168166
/* pop reg */
169-
*type = INSN_STACK;
170167
ADD_OP(op) {
171168
op->src.type = OP_SRC_POP;
172169
op->dest.type = OP_DEST_REG;
@@ -178,7 +175,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
178175
case 0x68:
179176
case 0x6a:
180177
/* push immediate */
181-
*type = INSN_STACK;
182178
ADD_OP(op) {
183179
op->src.type = OP_SRC_CONST;
184180
op->dest.type = OP_DEST_PUSH;
@@ -196,7 +192,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
196192

197193
if (modrm == 0xe4) {
198194
/* and imm, %rsp */
199-
*type = INSN_STACK;
200195
ADD_OP(op) {
201196
op->src.type = OP_SRC_AND;
202197
op->src.reg = CFI_SP;
@@ -215,7 +210,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
215210
break;
216211

217212
/* add/sub imm, %rsp */
218-
*type = INSN_STACK;
219213
ADD_OP(op) {
220214
op->src.type = OP_SRC_ADD;
221215
op->src.reg = CFI_SP;
@@ -229,7 +223,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
229223
if (rex_w && !rex_r && modrm_mod == 3 && modrm_reg == 4) {
230224

231225
/* mov %rsp, reg */
232-
*type = INSN_STACK;
233226
ADD_OP(op) {
234227
op->src.type = OP_SRC_REG;
235228
op->src.reg = CFI_SP;
@@ -242,7 +235,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
242235
if (rex_w && !rex_b && modrm_mod == 3 && modrm_rm == 4) {
243236

244237
/* mov reg, %rsp */
245-
*type = INSN_STACK;
246238
ADD_OP(op) {
247239
op->src.type = OP_SRC_REG;
248240
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,
258250
(modrm_mod == 1 || modrm_mod == 2) && modrm_rm == 5) {
259251

260252
/* mov reg, disp(%rbp) */
261-
*type = INSN_STACK;
262253
ADD_OP(op) {
263254
op->src.type = OP_SRC_REG;
264255
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,
270261
} else if (rex_w && !rex_b && modrm_rm == 4 && sib == 0x24) {
271262

272263
/* mov reg, disp(%rsp) */
273-
*type = INSN_STACK;
274264
ADD_OP(op) {
275265
op->src.type = OP_SRC_REG;
276266
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,
286276
if (rex_w && !rex_b && modrm_mod == 1 && modrm_rm == 5) {
287277

288278
/* mov disp(%rbp), reg */
289-
*type = INSN_STACK;
290279
ADD_OP(op) {
291280
op->src.type = OP_SRC_REG_INDIRECT;
292281
op->src.reg = CFI_BP;
@@ -299,7 +288,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
299288
modrm_mod != 3 && modrm_rm == 4) {
300289

301290
/* mov disp(%rsp), reg */
302-
*type = INSN_STACK;
303291
ADD_OP(op) {
304292
op->src.type = OP_SRC_REG_INDIRECT;
305293
op->src.reg = CFI_SP;
@@ -314,7 +302,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
314302
case 0x8d:
315303
if (sib == 0x24 && rex_w && !rex_b && !rex_x) {
316304

317-
*type = INSN_STACK;
318305
ADD_OP(op) {
319306
if (!insn.displacement.value) {
320307
/* lea (%rsp), reg */
@@ -332,7 +319,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
332319
} else if (rex == 0x48 && modrm == 0x65) {
333320

334321
/* lea disp(%rbp), %rsp */
335-
*type = INSN_STACK;
336322
ADD_OP(op) {
337323
op->src.type = OP_SRC_ADD;
338324
op->src.reg = CFI_BP;
@@ -350,7 +336,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
350336
* Restoring rsp back to its original value after a
351337
* stack realignment.
352338
*/
353-
*type = INSN_STACK;
354339
ADD_OP(op) {
355340
op->src.type = OP_SRC_ADD;
356341
op->src.reg = CFI_R10;
@@ -368,7 +353,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
368353
* Restoring rsp back to its original value after a
369354
* stack realignment.
370355
*/
371-
*type = INSN_STACK;
372356
ADD_OP(op) {
373357
op->src.type = OP_SRC_ADD;
374358
op->src.reg = CFI_R13;
@@ -382,7 +366,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
382366

383367
case 0x8f:
384368
/* pop to mem */
385-
*type = INSN_STACK;
386369
ADD_OP(op) {
387370
op->src.type = OP_SRC_POP;
388371
op->dest.type = OP_DEST_MEM;
@@ -395,7 +378,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
395378

396379
case 0x9c:
397380
/* pushf */
398-
*type = INSN_STACK;
399381
ADD_OP(op) {
400382
op->src.type = OP_SRC_CONST;
401383
op->dest.type = OP_DEST_PUSHF;
@@ -404,7 +386,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
404386

405387
case 0x9d:
406388
/* popf */
407-
*type = INSN_STACK;
408389
ADD_OP(op) {
409390
op->src.type = OP_SRC_POPF;
410391
op->dest.type = OP_DEST_MEM;
@@ -443,7 +424,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
443424
} else if (op2 == 0xa0 || op2 == 0xa8) {
444425

445426
/* push fs/gs */
446-
*type = INSN_STACK;
447427
ADD_OP(op) {
448428
op->src.type = OP_SRC_CONST;
449429
op->dest.type = OP_DEST_PUSH;
@@ -452,7 +432,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
452432
} else if (op2 == 0xa1 || op2 == 0xa9) {
453433

454434
/* pop fs/gs */
455-
*type = INSN_STACK;
456435
ADD_OP(op) {
457436
op->src.type = OP_SRC_POP;
458437
op->dest.type = OP_DEST_MEM;
@@ -469,7 +448,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
469448
* mov bp, sp
470449
* pop bp
471450
*/
472-
*type = INSN_STACK;
473451
ADD_OP(op)
474452
op->dest.type = OP_DEST_LEAVE;
475453

@@ -537,7 +515,6 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
537515
else if (modrm_reg == 6) {
538516

539517
/* push from mem */
540-
*type = INSN_STACK;
541518
ADD_OP(op) {
542519
op->src.type = OP_SRC_CONST;
543520
op->dest.type = OP_DEST_PUSH;

tools/objtool/check.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,9 +2339,6 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
23392339
}
23402340
return 0;
23412341

2342-
case INSN_STACK:
2343-
break;
2344-
23452342
case INSN_STAC:
23462343
if (state.uaccess) {
23472344
WARN_FUNC("recursive UACCESS enable", sec, insn->offset);

0 commit comments

Comments
 (0)