History

objtool: Remove SAVE/RESTORE hints

The SAVE/RESTORE hints are now unused; remove them.

Peter Zijlstra committed 6 years ago

Commit c536ed21 parent 9f2dfd65 files · +6 −73Browse files

Unified · Split

5 files
  1. arch/x86/include/asm/orc_types.h +1 −3
  2. arch/x86/include/asm/unwind_hints.h +0 −27
  3. tools/arch/x86/include/asm/orc_types.h +1 −3
  4. tools/objtool/check.c +3 −39
  5. tools/objtool/check.h +1 −1
arch/x86/include/asm/orc_types.h+1−3
@@ -58,9 +58,7 @@ · 57 unmodified lines
5858 #define ORC_TYPE_CALL 0
5959 #define ORC_TYPE_REGS 1
6060 #define ORC_TYPE_REGS_IRET 2
61−#define UNWIND_HINT_TYPE_SAVE 3
62−#define UNWIND_HINT_TYPE_RESTORE 4
63−#define UNWIND_HINT_TYPE_RET_OFFSET 5
61+#define UNWIND_HINT_TYPE_RET_OFFSET 3
6462
6563 #ifndef __ASSEMBLY__
6664 /*
arch/x86/include/asm/unwind_hints.h+0−27
@@ -86,15 +86,6 @@ · 85 unmodified lines
8686 UNWIND_HINT sp_offset=\sp_offset
8787 .endm
8888
89−.macro UNWIND_HINT_SAVE
90− UNWIND_HINT type=UNWIND_HINT_TYPE_SAVE
91−.endm
92−
93−.macro UNWIND_HINT_RESTORE
94− UNWIND_HINT type=UNWIND_HINT_TYPE_RESTORE
95−.endm
96−
97−
9889 /*
9990 * RET_OFFSET: Used on instructions that terminate a function; mostly RETURN
10091 * and sibling calls. On these, sp_offset denotes the expected offset from
@@ -104,24 +95,6 @@ · 3 unmodified lines
10495 UNWIND_HINT type=UNWIND_HINT_TYPE_RET_OFFSET sp_offset=\sp_offset
10596 .endm
10697
107−#else /* !__ASSEMBLY__ */
108−
109−#define UNWIND_HINT(sp_reg, sp_offset, type, end) \
110− "987: \n\t" \
111− ".pushsection .discard.unwind_hints\n\t" \
112− /* struct unwind_hint */ \
113− ".long 987b - .\n\t" \
114− ".short " __stringify(sp_offset) "\n\t" \
115− ".byte " __stringify(sp_reg) "\n\t" \
116− ".byte " __stringify(type) "\n\t" \
117− ".byte " __stringify(end) "\n\t" \
118− ".balign 4 \n\t" \
119− ".popsection\n\t"
120−
121−#define UNWIND_HINT_SAVE UNWIND_HINT(0, 0, UNWIND_HINT_TYPE_SAVE, 0)
122−
123−#define UNWIND_HINT_RESTORE UNWIND_HINT(0, 0, UNWIND_HINT_TYPE_RESTORE, 0)
124−
12598 #endif /* __ASSEMBLY__ */
12699
127100 #endif /* _ASM_X86_UNWIND_HINTS_H */
tools/arch/x86/include/asm/orc_types.h+1−3
@@ -58,9 +58,7 @@ · 57 unmodified lines
5858 #define ORC_TYPE_CALL 0
5959 #define ORC_TYPE_REGS 1
6060 #define ORC_TYPE_REGS_IRET 2
61−#define UNWIND_HINT_TYPE_SAVE 3
62−#define UNWIND_HINT_TYPE_RESTORE 4
63−#define UNWIND_HINT_TYPE_RET_OFFSET 5
61+#define UNWIND_HINT_TYPE_RET_OFFSET 3
6462
6563 #ifndef __ASSEMBLY__
6664 /*
tools/objtool/check.c+3−39
@@ -1254,15 +1254,7 @@ static int read_unwind_hints(struct objtool_file *file) · 1253 unmodified lines
12541254
12551255 cfa = &insn->state.cfa;
12561256
1257− if (hint->type == UNWIND_HINT_TYPE_SAVE) {
1258− insn->save = true;
1259− continue;
1260−
1261− } else if (hint->type == UNWIND_HINT_TYPE_RESTORE) {
1262− insn->restore = true;
1263− insn->hint = true;
1264−
1265− } else if (hint->type == UNWIND_HINT_TYPE_RET_OFFSET) {
1257+ if (hint->type == UNWIND_HINT_TYPE_RET_OFFSET) {
12661258 insn->ret_offset = hint->sp_offset;
12671259 continue;
12681260 }
@@ -2113,37 +2105,9 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, · 844 unmodified lines
21132105 return 0;
21142106 }
21152107
2116− if (insn->hint) {
2117− if (insn->restore) {
2118− struct instruction *save_insn, *i;
2119−
2120− i = insn;
2121− save_insn = NULL;
2122− sym_for_each_insn_continue_reverse(file, func, i) {
2123− if (i->save) {
2124− save_insn = i;
2125− break;
2126− }
2127− }
2128−
2129− if (!save_insn) {
2130− WARN_FUNC("no corresponding CFI save for CFI restore",
2131− sec, insn->offset);
2132− return 1;
2133− }
2134−
2135− if (!save_insn->visited) {
2136− WARN_FUNC("objtool isn't smart enough to handle this CFI save/restore combo",
2137− sec, insn->offset);
2138− return 1;
2139− }
2140−
2141− insn->state = save_insn->state;
2142− }
2143−
2108+ if (insn->hint)
21442109 state = insn->state;
2145−
2146− } else
2110+ else
21472111 insn->state = state;
21482112
21492113 insn->visited |= visited;
tools/objtool/check.h+1−1
@@ -34,7 +34,7 @@ struct instruction { · 33 unmodified lines
3434 enum insn_type type;
3535 unsigned long immediate;
3636 bool alt_group, dead_end, ignore, ignore_alts;
37− bool hint, save, restore;
37+ bool hint;
3838 bool retpoline_safe;
3939 u8 visited;
4040 u8 ret_offset;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t