From patchwork Wed Oct 3 03:43:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pratyush ANAND X-Patchwork-Id: 1540191 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 59396DF283 for ; Wed, 3 Oct 2012 03:47:36 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TJFsO-0007SI-1b; Wed, 03 Oct 2012 03:44:00 +0000 Received: from eu1sys200aog112.obsmtp.com ([207.126.144.133]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1TJFsK-0007S4-Ti for linux-arm-kernel@lists.infradead.org; Wed, 03 Oct 2012 03:43:57 +0000 Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob112.postini.com ([207.126.147.11]) with SMTP ID DSNKUGu0dEneDdlTY1F1xGbTmHZIG+JcaHqa@postini.com; Wed, 03 Oct 2012 03:43:56 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 8584CC4; Wed, 3 Oct 2012 03:35:31 +0000 (GMT) Received: from Webmail-ap.st.com (eapex1hubcas3.st.com [10.80.176.67]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id ABC51C43; Wed, 3 Oct 2012 03:43:44 +0000 (GMT) Received: from localhost (10.199.81.103) by Webmail-ap.st.com (10.80.176.7) with Microsoft SMTP Server (TLS) id 8.3.245.1; Wed, 3 Oct 2012 11:43:44 +0800 From: Pratyush Anand To: Subject: [PATCH] ARM: MMUless Core: Fix insmod error - module relocation out of range Date: Wed, 3 Oct 2012 09:13:39 +0530 Message-ID: <4995c6bc655337598b88bef025cd48b320c2ada0.1349235619.git.pratyush.anand@st.com> X-Mailer: git-send-email 1.7.5.4 MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [207.126.144.133 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Pratyush Anand , spear-devel@list.st.com, Neha MAKHIJA , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Neha MAKHIJA ARM supports 32Mb jump. Hence branch instruction has a limited range. For MMU systems, the module area is located just before the kernel memory because this allows function calls to be linked directly without any indirect branches. In case of MMU-less system, Module area is given whole of the DDR address space. Since, module_alloc() calls vmalloc(), the module area goes outside the allowed jump range. Due to this insmod will not be able to load the modules giving out of range relocation errors. Solution - Add the mlong-calls flags while compiling the modules. This tells the compiler to perform function calls by first loading the address of the function and then performing a subroutine function call on this register. Signed-off-by: Neha Makhija Signed-off-by: Pratyush Anand --- arch/arm/Makefile | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 88eec8f..78b5c12 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -112,6 +112,10 @@ CFLAGS_MODULE +=-fno-optimize-sibling-calls endif endif +ifeq ($(CONFIG_MMU),) +CFLAGS_MODULE +=-mlong-calls +endif + # Need -Uarm for gcc < 3.x KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_THUMB2) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_THUMB2) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float