Skip to content

Commit ec1e1b6

Browse files
jpoimboeIngo Molnar
authored andcommitted
objtool: Prevent GCC from merging annotate_unreachable(), take 2
This fixes the following warning with GCC 4.6: mm/migrate.o: warning: objtool: migrate_misplaced_transhuge_page()+0x71: unreachable instruction The problem is that the compiler merged identical annotate_unreachable() inline asm blocks, resulting in a missing 'unreachable' annotation. This problem happened before, and was partially fixed with: 3d1e236 ("objtool: Prevent GCC from merging annotate_unreachable()") That commit tried to ensure that each instance of the annotate_unreachable() inline asm statement has a unique label. It used the __LINE__ macro to generate the label number. However, even the line number isn't necessarily unique when used in an inline function with multiple callers (in this case, __alloc_pages_node()'s use of VM_BUG_ON). Reported-by: kbuild test robot <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Fixes: 3d1e236 ("objtool: Prevent GCC from merging annotate_unreachable()") Link: http://lkml.kernel.org/r/20171103221941.cajpwszir7ujxyc4@treble Signed-off-by: Ingo Molnar <[email protected]>
1 parent da0db32 commit ec1e1b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/compiler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
191191
asm("%c0:\n\t" \
192192
".pushsection .discard.reachable\n\t" \
193193
".long %c0b - .\n\t" \
194-
".popsection\n\t" : : "i" (__LINE__)); \
194+
".popsection\n\t" : : "i" (__COUNTER__)); \
195195
})
196196
#define annotate_unreachable() ({ \
197197
asm("%c0:\n\t" \
198198
".pushsection .discard.unreachable\n\t" \
199199
".long %c0b - .\n\t" \
200-
".popsection\n\t" : : "i" (__LINE__)); \
200+
".popsection\n\t" : : "i" (__COUNTER__)); \
201201
})
202202
#define ASM_UNREACHABLE \
203203
"999:\n\t" \

0 commit comments

Comments
 (0)