Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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:

3d1e236022cc ("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 <fengguang.wu@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kbuild-all@01.org
Cc: tipbuild@zytor.com
Fixes: 3d1e236022cc ("objtool: Prevent GCC from merging annotate_unreachable()")
Link: http://lkml.kernel.org/r/20171103221941.cajpwszir7ujxyc4@treble
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Josh Poimboeuf and committed by
Ingo Molnar
ec1e1b61 da0db32b

+2 -2
+2 -2
include/linux/compiler.h
··· 191 191 asm("%c0:\n\t" \ 192 192 ".pushsection .discard.reachable\n\t" \ 193 193 ".long %c0b - .\n\t" \ 194 - ".popsection\n\t" : : "i" (__LINE__)); \ 194 + ".popsection\n\t" : : "i" (__COUNTER__)); \ 195 195 }) 196 196 #define annotate_unreachable() ({ \ 197 197 asm("%c0:\n\t" \ 198 198 ".pushsection .discard.unreachable\n\t" \ 199 199 ".long %c0b - .\n\t" \ 200 - ".popsection\n\t" : : "i" (__LINE__)); \ 200 + ".popsection\n\t" : : "i" (__COUNTER__)); \ 201 201 }) 202 202 #define ASM_UNREACHABLE \ 203 203 "999:\n\t" \