Skip to contentSkip to conversation

powerpc/le: Avoid creatng R_PPC64_TOCSAVE relocations for modules.

PATCH In review Tony Breeds 2 participants 2 messages Mar 12, 2014 – Apr 6, 2014 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/le: Avoid creatng R_PPC64_TOCSAVE relocations for modules.

When building modules with a native le toolchain the linker will generate R_PPC64_TOCSAVE relocations when it's safe to omit saving r2 on a plt call. This isn't helpful in the conext of a kernel module and the kernel will fail to load those modules with an error like:
nf_conntrack: Unknown ADD relocation: 109

This patch tells the linker to avoid createing R_PPC64_TOCSAVE relocations allowing modules to load.

---
 arch/powerpc/Makefile | 3 +++
 1 file changed, 3 insertions(+)
arch/powerpc/Makefile +3 -0
index 0f4344e..fff3945 100644
@@ -74,6 +74,9 @@ override CROSS32AS += -mlittle-endian
 LDEMULATION	:= lppc
 GNUTARGET	:= powerpcle
 MULTIPLEWORD	:= -mno-multiple
+ifeq ($(call cc-option-yn,-mno-save-toc-indirect),y)
+       KBUILD_CFLAGS_MODULE += -mno-save-toc-indirect
+endif
 else
 ifeq ($(call cc-option-yn,-mbig-endian),y)
 override CC	+= -mbig-endian
Signature · 3 lines
1.8.5.3

Yours Tony
#1 lore raw

Hi Tony,

Quoted 8 lines

When building modules with a native le toolchain the linker will generate R_PPC64_TOCSAVE relocations when it's safe to omit saving r2 on a plt call. This isn't helpful in the conext of a kernel module and the kernel will fail to load those modules with an error like:
nf_conntrack: Unknown ADD relocation: 109

This patch tells the linker to avoid createing R_PPC64_TOCSAVE relocations allowing modules to load.

Looks good.

arch/powerpc/Makefile override CROSS32AS += -mlittle-endian · line 79

Quoted 3 lines
arch/powerpc/Makefile +3 -0
+ifeq ($(call cc-option-yn,-mno-save-toc-indirect),y)
+       KBUILD_CFLAGS_MODULE += -mno-save-toc-indirect
+endif

Low priority bikeshedding, but could we save ourselves a few lines with:

KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)

Anton