[PATCH] objtool, module: discard __unreachable section for modules

From: Josh Poimboeuf
Date: Wed Mar 01 2017 - 10:21:51 EST


The __unreachable section is only used at compile time. It's discarded
for vmlinux but it should also be discarded for modules.

Fixes: d1091c7fa3d5 ("objtool: Improve detection of BUG() and other dead ends")
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
scripts/module-common.lds | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/module-common.lds b/scripts/module-common.lds
index 73a2c7d..936a3c6 100644
--- a/scripts/module-common.lds
+++ b/scripts/module-common.lds
@@ -4,7 +4,10 @@
* combine them automatically.
*/
SECTIONS {
- /DISCARD/ : { *(.discard) }
+ /DISCARD/ : {
+ *(.discard)
+ *(__unreachable)
+ }

__ksymtab 0 : { *(SORT(___ksymtab+*)) }
__ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) }
--
2.7.4