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
58#define ORC_TYPE_CALL 058#define ORC_TYPE_CALL 0
59#define ORC_TYPE_REGS 159#define ORC_TYPE_REGS 1
60#define ORC_TYPE_REGS_IRET 260#define ORC_TYPE_REGS_IRET 2
61#define UNWIND_HINT_TYPE_SAVE 361#define UNWIND_HINT_TYPE_RET_OFFSET 3
62#define UNWIND_HINT_TYPE_RESTORE 4
63#define UNWIND_HINT_TYPE_RET_OFFSET 5
64 62
65#ifndef __ASSEMBLY__63#ifndef __ASSEMBLY__
66/*64/*
arch/x86/include/asm/unwind_hints.h+0−27
@@ -86,15 +86,6 @@ · 85 unmodified lines
86 UNWIND_HINT sp_offset=\sp_offset86 UNWIND_HINT sp_offset=\sp_offset
87.endm87.endm
88 88
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
98/*89/*
99 * RET_OFFSET: Used on instructions that terminate a function; mostly RETURN90 * RET_OFFSET: Used on instructions that terminate a function; mostly RETURN
100 * and sibling calls. On these, sp_offset denotes the expected offset from91 * and sibling calls. On these, sp_offset denotes the expected offset from
@@ -104,24 +95,6 @@ · 3 unmodified lines
104 UNWIND_HINT type=UNWIND_HINT_TYPE_RET_OFFSET sp_offset=\sp_offset95 UNWIND_HINT type=UNWIND_HINT_TYPE_RET_OFFSET sp_offset=\sp_offset
105.endm96.endm
106 97
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
125#endif /* __ASSEMBLY__ */98#endif /* __ASSEMBLY__ */
126 99
127#endif /* _ASM_X86_UNWIND_HINTS_H */100#endif /* _ASM_X86_UNWIND_HINTS_H */
tools/arch/x86/include/asm/orc_types.h+1−3
@@ -58,9 +58,7 @@ · 57 unmodified lines
58#define ORC_TYPE_CALL 058#define ORC_TYPE_CALL 0
59#define ORC_TYPE_REGS 159#define ORC_TYPE_REGS 1
60#define ORC_TYPE_REGS_IRET 260#define ORC_TYPE_REGS_IRET 2
61#define UNWIND_HINT_TYPE_SAVE 361#define UNWIND_HINT_TYPE_RET_OFFSET 3
62#define UNWIND_HINT_TYPE_RESTORE 4
63#define UNWIND_HINT_TYPE_RET_OFFSET 5
64 62
65#ifndef __ASSEMBLY__63#ifndef __ASSEMBLY__
66/*64/*
tools/objtool/check.c+3−39
@@ -1254,15 +1254,7 @@ static int read_unwind_hints(struct objtool_file *file) · 1253 unmodified lines
1254 1254
1255 cfa = &insn->state.cfa;1255 cfa = &insn->state.cfa;
1256 1256
1257 if (hint->type == UNWIND_HINT_TYPE_SAVE) {1257 if (hint->type == UNWIND_HINT_TYPE_RET_OFFSET) {
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) {
1266 insn->ret_offset = hint->sp_offset;1258 insn->ret_offset = hint->sp_offset;
1267 continue;1259 continue;
1268 }1260 }
@@ -2113,37 +2105,9 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, · 844 unmodified lines
2113 return 0;2105 return 0;
2114 }2106 }
2115 2107
2116 if (insn->hint) {2108 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
2144 state = insn->state;2109 state = insn->state;
2145 2110 else
2146 } else
2147 insn->state = state;2111 insn->state = state;
2148 2112
2149 insn->visited |= visited;2113 insn->visited |= visited;
tools/objtool/check.h+1−1
@@ -34,7 +34,7 @@ struct instruction { · 33 unmodified lines
34 enum insn_type type;34 enum insn_type type;
35 unsigned long immediate;35 unsigned long immediate;
36 bool alt_group, dead_end, ignore, ignore_alts;36 bool alt_group, dead_end, ignore, ignore_alts;
37 bool hint, save, restore;37 bool hint;
38 bool retpoline_safe;38 bool retpoline_safe;
39 u8 visited;39 u8 visited;
40 u8 ret_offset;40 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