From patchwork Sun Nov 24 22:46:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 3227231 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 23C42C045B for ; Sun, 24 Nov 2013 22:47:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10FD12018C for ; Sun, 24 Nov 2013 22:47:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 067202016D for ; Sun, 24 Nov 2013 22:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751766Ab3KXWrF (ORCPT ); Sun, 24 Nov 2013 17:47:05 -0500 Received: from mout.gmx.net ([212.227.17.21]:56567 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751426Ab3KXWrE (ORCPT ); Sun, 24 Nov 2013 17:47:04 -0500 Received: from p100.box ([84.173.64.219]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0LkgAG-1VCU6524hQ-00aWAU for ; Sun, 24 Nov 2013 23:47:02 +0100 Date: Sun, 24 Nov 2013 23:46:59 +0100 From: Helge Deller To: linux-parisc@vger.kernel.org, James Bottomley Subject: Re: [PATCH] parisc: vmlinux.lds.S: fix linkage of the 64bit SMP debian kernel Message-ID: <20131124224659.GA7628@p100.box> References: <20131122162952.GA10699@ls3530.dhcp.wdf.sap.corp> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20131122162952.GA10699@ls3530.dhcp.wdf.sap.corp> User-Agent: Mutt/1.5.21 (2010-09-15) X-Provags-ID: V03:K0:k57itpwgLVZH8blWWX0dFILbE71zSSKG308TYMNSsk3MvPRhjBG GZNP5WbX0nnechPLmoc9ByLa0wZwPNw8ji8vlDUlysdQMaeAlMmSRAZqtJ6UF6OuKLbUCd1 ++tNKDXRLSqqPfZe9WxPBWvXbSM3NRNWyt9i931j1S68JMH3WXJWVSUai5Ec8UvcQk9H/oT tIP6khPuEpCbi4ISfAaQA== Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Here is an updated (complete) patch. * Helge Deller : > When building the 64bit SMP kernel for debian it may happen that it becomes too > big so that functions in the .init.text or .exit.text may not be able to reach > important kernel functions in the .text section. Main reason why this happens > with a 64bit kernel build is that we include the linkage tables (.opd, .plt, > .dlt) in that data section. Those linkage tables tend to become huge, and > since they are located between the .text and the .init sections the distance > gets too far. > > If the linker fails to link vmlinux, it will either crash without any error > message, or it will - with newer linker versions - report the following error: > > hppa64-linux-gnu-ld: drivers/built-in.o(.exit.text+0xc4): cannot reach _raw_read_lock > drivers/built-in.o: In function `pdc_stable_exit': > drivers/parisc/pdc_stable.o:(.exit.text+0xc4): relocation truncated to fit: R_PARISC_PCREL22F against symbol `_raw_read_lock' defined in .spinlock.text section in kernel/built-in.o > > We have three options to solve this issue: > a) Turn on CONFIG_MLONGCALLS, which will instruct the compiler to use the > -mlongcall option. But this option will hurt performance. > b) Tell the linker (via vmlinux.lds.S) to move the .init.text and .exit.text > sections into the normal .text section. Downside here is, that those sections > will not be discarded at runtime. > c) Move the linkage tables somewhere else. Even if this would be possible I did > not find a nice solution without any other bad side effects. > > Since we are compiling a 64bit kernel which usually runs on machines with lots > of memory, I preferred option b) since performance is usually more imortant than > some lost memory area. > > Signed-off-by: Helge Deller --- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index 4bb095a..4d7a1f0 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S @@ -23,13 +23,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * Put page table entries (swapper_pg_dir) as the first thing in .bss. This + * will ensure that it has .bss alignment (PAGE_SIZE). + */ +#define BSS_FIRST_SECTIONS *(.data..vm0.pmd) \ + *(.data..vm0.pgd) \ + *(.data..vm0.pte) + #include + /* needed for the processor specific cache alignment size */ #include #include #include #include - + /* ld script to make hppa Linux kernel */ #ifndef CONFIG_64BIT OUTPUT_FORMAT("elf32-hppa-linux") @@ -53,6 +63,7 @@ SECTIONS .head ALIGN(16) : { HEAD_TEXT } = 0 + .text ALIGN(16) : { TEXT_TEXT SCHED_TEXT @@ -64,17 +75,23 @@ SECTIONS *(.text.do_sigaltstack) *(.text.do_fork) *(.text.*) +#if defined(CONFIG_64BIT) && !defined(CONFIG_MLONGCALLS) + EXIT_TEXT +#endif *(.fixup) *(.lock.text) /* out-of-line lock text */ *(.gnu.warning) } +#if defined(CONFIG_64BIT) && !defined(CONFIG_MLONGCALLS) + INIT_TEXT_SECTION(16) +#endif /* End of text section */ _etext = .; /* Start of data section */ _sdata = .; - RODATA + RO_DATA_SECTION(PAGE_SIZE) /* writeable */ /* Make sure this is page aligned so @@ -107,45 +124,36 @@ SECTIONS _edata = .; /* BSS */ - __bss_start = .; - /* page table entries need to be PAGE_SIZE aligned */ - . = ALIGN(PAGE_SIZE); - .data..vmpages : { - *(.data..vm0.pmd) - *(.data..vm0.pgd) - *(.data..vm0.pte) - } - .bss : { - *(.bss) - *(COMMON) - } - __bss_stop = .; + BSS_SECTION(16, PAGE_SIZE, 16) + #ifdef CONFIG_64BIT + /* Linkage tables are huge. */ . = ALIGN(16); /* Linkage tables */ .opd : { *(.opd) - } PROVIDE (__gp = .); + } PROVIDE (__gp = .); .plt : { *(.plt) - } + } .dlt : { *(.dlt) } #endif - /* reserve space for interrupt stack by aligning __init* to 16k */ - . = ALIGN(16384); - __init_begin = .; - INIT_TEXT_SECTION(16384) . = ALIGN(PAGE_SIZE); - INIT_DATA_SECTION(16) + __init_begin = .; + +#if !defined(CONFIG_64BIT) || defined(CONFIG_MLONGCALLS) + INIT_TEXT_SECTION(16) /* we have to discard exit text and such at runtime, not link time */ .exit.text : { EXIT_TEXT } +#endif + INIT_DATA_SECTION(16) .exit.data : { EXIT_DATA