5a77287
From 414794ae6a59c38f6e5793ad50df97cba3dda4e3 Mon Sep 17 00:00:00 2001
5a77287
From: Tony Breeds <tony@bakeyournoodle.com>
5a77287
Date: Thu, 30 Jan 2014 19:58:55 +1100
5a77287
Subject: [PATCH] powerpc/le: Avoid creatng R_PPC64_TOCSAVE relocations for
5a77287
 modules.
5a77287
5a77287
When building modules with a native le toolchain the linker will
5a77287
generate R_PPC64_TOCSAVE relocations when it's safe to omit saving r2 on
5a77287
a plt call.  This isn't helpful in the conext of a kernel module and the
5a77287
kernel will fail to load those modules with an error like:
5a77287
	nf_conntrack: Unknown ADD relocation: 109
5a77287
5a77287
This patch tells the linker to avoid createing R_PPC64_TOCSAVE
5a77287
relocations allowing modules to load.
5a77287
5a77287
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
5a77287
---
5a77287
 arch/powerpc/Makefile | 3 +++
5a77287
 1 file changed, 3 insertions(+)
5a77287
5a77287
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
5a77287
index 0f4344e..fff3945 100644
5a77287
--- a/arch/powerpc/Makefile
5a77287
+++ b/arch/powerpc/Makefile
5a77287
@@ -74,6 +74,9 @@ override CROSS32AS += -mlittle-endian
5a77287
 LDEMULATION	:= lppc
5a77287
 GNUTARGET	:= powerpcle
5a77287
 MULTIPLEWORD	:= -mno-multiple
5a77287
+ifeq ($(call cc-option-yn,-mno-save-toc-indirect),y)
5a77287
+       KBUILD_CFLAGS_MODULE += -mno-save-toc-indirect
5a77287
+endif
5a77287
 else
5a77287
 ifeq ($(call cc-option-yn,-mbig-endian),y)
5a77287
 override CC	+= -mbig-endian
5a77287
--