diff mbox

linker problem with xip kernel and recent toolchains

Message ID 1355249468.19818.23.camel@hornet (mailing list archive)
State New, archived
Headers show

Commit Message

Pawel Moll Dec. 11, 2012, 6:11 p.m. UTC
On Tue, 2012-12-11 at 13:43 +0000, Marc Kleine-Budde wrote:
> What about putting the notes section into the read only segment, i.e.
> the ROM?

Could you, please, try the change below? It seems to do the job for me.

Pawe?

8<-------------------------
From 01fe7810cfded11aff03d216d2adbcf673e78f65 Mon Sep 17 00:00:00 2001
From: Pawel Moll <pawel.moll@arm.com>
Date: Tue, 11 Dec 2012 18:09:14 +0000
Subject: [PATCH] ARM: vmlinux.lds: Move .notes section next to the rodata

The .notes, being read-only data by nature, was placed between
read-write .data and .bss. This was harmful in case of XIP
images, as it was placed in the RAM range, most likely far
from the ROM address, inflating the XIP images.

Moving the .notes at the end of the read-only section
(consisting of .text, .rodata and unwind info) fixes the problem.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
 arch/arm/kernel/vmlinux.lds.S |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Marc Kleine-Budde Dec. 12, 2012, 8:22 a.m. UTC | #1
On 12/11/2012 07:11 PM, Pawel Moll wrote:
> On Tue, 2012-12-11 at 13:43 +0000, Marc Kleine-Budde wrote:
>> What about putting the notes section into the read only segment, i.e.
>> the ROM?
> 
> Could you, please, try the change below? It seems to do the job for me.

Works for me. The kernel image links to 640 KiB again.

> 8<-------------------------
> From 01fe7810cfded11aff03d216d2adbcf673e78f65 Mon Sep 17 00:00:00 2001
> From: Pawel Moll <pawel.moll@arm.com>
> Date: Tue, 11 Dec 2012 18:09:14 +0000
> Subject: [PATCH] ARM: vmlinux.lds: Move .notes section next to the rodata
> 
> The .notes, being read-only data by nature, was placed between
> read-write .data and .bss. This was harmful in case of XIP
> images, as it was placed in the RAM range, most likely far
> from the ROM address, inflating the XIP images.
> 
> Moving the .notes at the end of the read-only section
> (consisting of .text, .rodata and unwind info) fixes the problem.
> 
> Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Marc Kleine-Budde <mkl@pengutronix.de>

Marc
Baruch Siach Dec. 12, 2012, 8:44 a.m. UTC | #2
Hi Marc,

On Wed, Dec 12, 2012 at 09:22:09AM +0100, Marc Kleine-Budde wrote:
> On 12/11/2012 07:11 PM, Pawel Moll wrote:
> > On Tue, 2012-12-11 at 13:43 +0000, Marc Kleine-Budde wrote:
> >> What about putting the notes section into the read only segment, i.e.
> >> the ROM?
> > 
> > Could you, please, try the change below? It seems to do the job for me.
> 
> Works for me. The kernel image links to 640 KiB again.

Thant's the lowest figure I've ever seen for a kernel image. How do you get 
there?

baruch
Marc Kleine-Budde Dec. 12, 2012, 8:49 a.m. UTC | #3
On 12/12/2012 09:44 AM, Baruch Siach wrote:
> Hi Marc,
> 
> On Wed, Dec 12, 2012 at 09:22:09AM +0100, Marc Kleine-Budde wrote:
>> On 12/11/2012 07:11 PM, Pawel Moll wrote:
>>> On Tue, 2012-12-11 at 13:43 +0000, Marc Kleine-Budde wrote:
>>>> What about putting the notes section into the read only segment, i.e.
>>>> the ROM?
>>>
>>> Could you, please, try the change below? It seems to do the job for me.
>>
>> Works for me. The kernel image links to 640 KiB again.
> 
> Thant's the lowest figure I've ever seen for a kernel image. How do you get 
> there?

It's for a nommu, armv7-m with thumb2 code. It doesn't have much
features, it lack /proc, /sys and even the networking subsystem. You can
find the .config in my previous mail [1].

Marc

[1] http://www.spinics.net/lists/arm-kernel/msg212007.html
Pawel Moll Dec. 13, 2012, 1:20 p.m. UTC | #4
On Wed, 2012-12-12 at 08:22 +0000, Marc Kleine-Budde wrote:
> On 12/11/2012 07:11 PM, Pawel Moll wrote:
> > On Tue, 2012-12-11 at 13:43 +0000, Marc Kleine-Budde wrote:
> >> What about putting the notes section into the read only segment, i.e.
> >> the ROM?
> > 
> > Could you, please, try the change below? It seems to do the job for me.
> 
> Works for me. The kernel image links to 640 KiB again.

Cool, I'll get it into Russell's patch system then (with your Reported-
and Tested-by).

Thanks!

Pawe?
diff mbox

Patch

diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 36ff15b..31fa80e 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -131,6 +131,8 @@  SECTIONS
 	}
 #endif
 
+	NOTES
+
 	_etext = .;			/* End of text and rodata section */
 
 #ifndef CONFIG_XIP_KERNEL
@@ -296,8 +298,6 @@  SECTIONS
 	}
 #endif
 
-	NOTES
-
 	BSS_SECTION(0, 0, 0)
 	_end = .;