linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/le: Avoid creatng R_PPC64_TOCSAVE relocations for modules.
@ 2014-03-12  4:12 Tony Breeds
  2014-04-06 23:55 ` Anton Blanchard
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Breeds @ 2014-03-12  4:12 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, LinuxPPC-dev; +Cc: Rusty Russell, Alan Modra

[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]

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.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
 arch/powerpc/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 0f4344e..fff3945 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -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
-- 
1.8.5.3

Yours Tony

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc/le: Avoid creatng R_PPC64_TOCSAVE relocations for modules.
  2014-03-12  4:12 [PATCH] powerpc/le: Avoid creatng R_PPC64_TOCSAVE relocations for modules Tony Breeds
@ 2014-04-06 23:55 ` Anton Blanchard
  0 siblings, 0 replies; 2+ messages in thread
From: Anton Blanchard @ 2014-04-06 23:55 UTC (permalink / raw)
  To: Tony Breeds; +Cc: Rusty Russell, LinuxPPC-dev, Alan Modra


Hi Tony,

> 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.

Signed-off-by: Anton Blanchard <anton@samba.org>

> +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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-06 23:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-12  4:12 [PATCH] powerpc/le: Avoid creatng R_PPC64_TOCSAVE relocations for modules Tony Breeds
2014-04-06 23:55 ` Anton Blanchard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).