From patchwork Wed Mar 12 04:12:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Breeds X-Patchwork-Id: 329296 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id CD7CC2C0148 for ; Wed, 12 Mar 2014 15:12:35 +1100 (EST) Received: from thor.bakeyournoodle.com (ppp121-45-222-198.lns20.cbr1.internode.on.net [121.45.222.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id C12DB2C00CA; Wed, 12 Mar 2014 15:12:02 +1100 (EST) Date: Wed, 12 Mar 2014 15:12:01 +1100 From: Tony Breeds To: Benjamin Herrenschmidt , LinuxPPC-dev Subject: [PATCH] powerpc/le: Avoid creatng R_PPC64_TOCSAVE relocations for modules. Message-ID: <20140312041201.GA13555@thor.bakeyournoodle.com> Mail-Followup-To: Benjamin Herrenschmidt , LinuxPPC-dev , Rusty Russell , Alan Modra MIME-Version: 1.0 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Rusty Russell , Alan Modra X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 Signed-off-by: Anton Blanchard --- 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