Skip to content

Commit 96af6cd

Browse files
author
Ingo Molnar
committed
Revert "x86/objtool: Use asm macros to work around GCC inlining bugs"
This reverts commit c06c4d8. See this commit for details about the revert: e769742 ("Revert "x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs"") Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Borislav Petkov <bp@alien8.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Cc: Juergen Gross <jgross@suse.com> Cc: Richard Biener <rguenther@suse.de> Cc: Kees Cook <keescook@chromium.org> Cc: Segher Boessenkool <segher@kernel.crashing.org> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Nadav Amit <namit@vmware.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent ac18054 commit 96af6cd

File tree

2 files changed

+13
-45
lines changed

2 files changed

+13
-45
lines changed

arch/x86/kernel/macros.S

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@
55
* commonly used. The macros are precompiled into assmebly file which is later
66
* assembled together with each compiled file.
77
*/
8-
9-
#include <linux/compiler.h>

include/linux/compiler.h

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,22 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
9999
* unique, to convince GCC not to merge duplicate inline asm statements.
100100
*/
101101
#define annotate_reachable() ({ \
102-
asm volatile("ANNOTATE_REACHABLE counter=%c0" \
103-
: : "i" (__COUNTER__)); \
102+
asm volatile("%c0:\n\t" \
103+
".pushsection .discard.reachable\n\t" \
104+
".long %c0b - .\n\t" \
105+
".popsection\n\t" : : "i" (__COUNTER__)); \
104106
})
105107
#define annotate_unreachable() ({ \
106-
asm volatile("ANNOTATE_UNREACHABLE counter=%c0" \
107-
: : "i" (__COUNTER__)); \
108+
asm volatile("%c0:\n\t" \
109+
".pushsection .discard.unreachable\n\t" \
110+
".long %c0b - .\n\t" \
111+
".popsection\n\t" : : "i" (__COUNTER__)); \
108112
})
113+
#define ASM_UNREACHABLE \
114+
"999:\n\t" \
115+
".pushsection .discard.unreachable\n\t" \
116+
".long 999b - .\n\t" \
117+
".popsection\n\t"
109118
#else
110119
#define annotate_reachable()
111120
#define annotate_unreachable()
@@ -293,45 +302,6 @@ static inline void *offset_to_ptr(const int *off)
293302
return (void *)((unsigned long)off + *off);
294303
}
295304

296-
#else /* __ASSEMBLY__ */
297-
298-
#ifdef __KERNEL__
299-
#ifndef LINKER_SCRIPT
300-
301-
#ifdef CONFIG_STACK_VALIDATION
302-
.macro ANNOTATE_UNREACHABLE counter:req
303-
\counter:
304-
.pushsection .discard.unreachable
305-
.long \counter\()b -.
306-
.popsection
307-
.endm
308-
309-
.macro ANNOTATE_REACHABLE counter:req
310-
\counter:
311-
.pushsection .discard.reachable
312-
.long \counter\()b -.
313-
.popsection
314-
.endm
315-
316-
.macro ASM_UNREACHABLE
317-
999:
318-
.pushsection .discard.unreachable
319-
.long 999b - .
320-
.popsection
321-
.endm
322-
#else /* CONFIG_STACK_VALIDATION */
323-
.macro ANNOTATE_UNREACHABLE counter:req
324-
.endm
325-
326-
.macro ANNOTATE_REACHABLE counter:req
327-
.endm
328-
329-
.macro ASM_UNREACHABLE
330-
.endm
331-
#endif /* CONFIG_STACK_VALIDATION */
332-
333-
#endif /* LINKER_SCRIPT */
334-
#endif /* __KERNEL__ */
335305
#endif /* __ASSEMBLY__ */
336306

337307
/* Compile time object size, -1 for unknown */

0 commit comments

Comments
 (0)