[tip:core/urgent] objtool, compiler.h: Fix __unreachable section relocation size

From: tip-bot for Josh Poimboeuf
Date: Wed Mar 01 2017 - 08:26:29 EST


Commit-ID: 55149d06534ae2a7ba5f7a078353deb89b3fe891
Gitweb: http://git.kernel.org/tip/55149d06534ae2a7ba5f7a078353deb89b3fe891
Author: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
AuthorDate: Wed, 1 Mar 2017 00:05:04 -0600
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitDate: Wed, 1 Mar 2017 14:20:18 +0100

objtool, compiler.h: Fix __unreachable section relocation size

Linus reported the following commit broke module loading on his laptop:

d1091c7fa3d5 ("objtool: Improve detection of BUG() and other dead ends")

It showed errors like the following:

module: overflow in relocation type 10 val ffffffffc02afc81
module: 'nvme' likely not compiled with -mcmodel=kernel

The problem is that the __unreachable section addresses are stored using
the '.long' asm directive, which isn't big enough for .text section
kernel addresses. Use relative addresses instead:

".long %c0b - .\t\n"

Suggested-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Reported-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Fixes: d1091c7fa3d5 ("objtool: Improve detection of BUG() and other dead ends")
Link: 20170301060504.oltm3iws6fmubnom@treble">http://lkml.kernel.org/r/20170301060504.oltm3iws6fmubnom@treble
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
include/linux/compiler-gcc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 76e28c2..b6bb901 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -201,7 +201,7 @@
#define annotate_unreachable() ({ \
asm("%c0:\t\n" \
".pushsection __unreachable, \"a\"\t\n" \
- ".long %c0b\t\n" \
+ ".long %c0b - .\t\n" \
".popsection\t\n" : : "i" (__LINE__)); \
})
#else