From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Dave Martin <dave.martin@linaro.org>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>,
Sachin Verma <imschnvrm@gmail.com>, Rabin Vincent <rabin@rab.in>,
Alexander Holler <holler@ahsoftware.de>,
lkml <linux-kernel@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
catalin.marinas@arm.com
Subject: Re: ARM: relocation out of range (when loading a module)
Date: Fri, 11 Feb 2011 14:42:07 +0000 [thread overview]
Message-ID: <20110211144207.GJ23404@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <AANLkTimW9zQ3EcEo8+gcxnS72Wa9VZELvrqdY+jP0B7W@mail.gmail.com>
On Fri, Feb 11, 2011 at 02:25:28PM +0000, Dave Martin wrote:
> if we can also move the initramfs somewhere less obstructive in the
> future, then so much the better.
This may do it, and it might even work. Not particularly well tested
yet. It'd be loads easier if we didn't have to worry about XIP.
arch/arm/kernel/etm.c | 2 +-
arch/arm/kernel/smp.c | 4 +-
arch/arm/kernel/vmlinux.lds.S | 133 +++++++++++++++++++++-------------------
arch/arm/mm/init.c | 2 +-
4 files changed, 74 insertions(+), 67 deletions(-)
diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c
index 11db628..ca477d2 100644
--- a/arch/arm/kernel/etm.c
+++ b/arch/arm/kernel/etm.c
@@ -114,7 +114,7 @@ static int trace_start(struct tracectx *t)
return -EFAULT;
}
- etm_setup_address_range(t, 1, (unsigned long)_stext,
+ etm_setup_address_range(t, 1, (unsigned long)_text,
(unsigned long)_etext, 0, 0);
etm_writel(t, 0, ETMR_TRACEENCTRL2);
etm_writel(t, 0, ETMR_TRACESSCTRL);
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 4539ebc..8ad77d3 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -95,7 +95,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
#ifndef CONFIG_HOTPLUG_CPU
identity_mapping_add(pgd, __pa(__init_begin), __pa(__init_end));
#endif
- identity_mapping_add(pgd, __pa(_stext), __pa(_etext));
+ identity_mapping_add(pgd, __pa(_text), __pa(_etext));
identity_mapping_add(pgd, __pa(_sdata), __pa(_edata));
}
@@ -143,7 +143,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
#ifndef CONFIG_HOTPLUG_CPU
identity_mapping_del(pgd, __pa(__init_begin), __pa(__init_end));
#endif
- identity_mapping_del(pgd, __pa(_stext), __pa(_etext));
+ identity_mapping_del(pgd, __pa(_text), __pa(_etext));
identity_mapping_del(pgd, __pa(_sdata), __pa(_edata));
}
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 45b5651..9cd098b 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -32,46 +32,98 @@ jiffies = jiffies_64 + 4;
SECTIONS
{
+ /*
+ * unwind exit sections must be discarded before the rest of the
+ * unwind sections get included.
+ */
+ /DISCARD/ : {
+ *(.ARM.exidx.exit.text)
+ *(.ARM.extab.exit.text)
+ ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
+ ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
+#ifndef CONFIG_HOTPLUG
+ *(.ARM.exidx.devexit.text)
+ *(.ARM.extab.devexit.text)
+#endif
+#ifndef CONFIG_MMU
+ *(.fixup)
+ *(__ex_table)
+#endif
+#ifndef CONFIG_SMP_ON_UP
+ *(.alt.smp.init)
+#endif
+ }
+
#ifdef CONFIG_XIP_KERNEL
. = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
#else
. = PAGE_OFFSET + TEXT_OFFSET;
#endif
- .init : { /* Init code and data */
- _stext = .;
- _sinittext = .;
- HEAD_TEXT
- INIT_TEXT
- _einittext = .;
+ _text = .;
+ HEAD_TEXT_SECTION
+
+ .text : { /* Real text segment */
+ _stext = .; /* Text and read-only data */
+ __exception_text_start = .;
+ *(.exception.text)
+ __exception_text_end = .;
+ IRQENTRY_TEXT
+ TEXT_TEXT
+ SCHED_TEXT
+ LOCK_TEXT
+ KPROBES_TEXT
+#ifdef CONFIG_MMU
+ *(.fixup)
+#endif
+ *(.gnu.warning)
+ *(.glue_7)
+ *(.glue_7t)
+ . = ALIGN(4);
+ *(.got) /* Global offset table */
+ ARM_CPU_KEEP(PROC_INFO)
+ _etext = .; /* End of text and rodata section */
+ }
+
+#ifndef CONFIG_XIP_KERNEL
+ . = ALIGN(PAGE_SIZE);
+ __init_begin = .;
+#endif
+ INIT_TEXT_SECTION(0)
+ .init.proc.info : {
ARM_CPU_DISCARD(PROC_INFO)
+ }
+ .init.arch.info : {
__arch_info_begin = .;
*(.arch.info.init)
__arch_info_end = .;
+ }
+ .init.tagtable : {
__tagtable_begin = .;
*(.taglist.init)
__tagtable_end = .;
+ }
#ifdef CONFIG_SMP_ON_UP
+ .init.smpalt : {
__smpalt_begin = .;
*(.alt.smp.init)
__smpalt_end = .;
+ }
#endif
-
+ .init.pv_table : {
__pv_table_begin = .;
*(.pv_table)
__pv_table_end = .;
-
+ }
+ .init.data : {
+#ifndef CONFIG_XIP_KERNEL
+ INIT_DATA
+#endif
INIT_SETUP(16)
-
INIT_CALLS
CON_INITCALL
SECURITY_INITCALL
INIT_RAM_FS
-
-#ifndef CONFIG_XIP_KERNEL
- __init_begin = _stext;
- INIT_DATA
-#endif
}
PERCPU(PAGE_SIZE)
@@ -79,49 +131,10 @@ SECTIONS
#ifndef CONFIG_XIP_KERNEL
. = ALIGN(PAGE_SIZE);
__init_end = .;
-#endif
- /*
- * unwind exit sections must be discarded before the rest of the
- * unwind sections get included.
- */
- /DISCARD/ : {
- *(.ARM.exidx.exit.text)
- *(.ARM.extab.exit.text)
- ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
- ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
-#ifndef CONFIG_HOTPLUG
- *(.ARM.exidx.devexit.text)
- *(.ARM.extab.devexit.text)
+ _data = .;
+ _sdata = .;
#endif
-#ifndef CONFIG_MMU
- *(.fixup)
- *(__ex_table)
-#endif
- }
-
- .text : { /* Real text segment */
- _text = .; /* Text and read-only data */
- __exception_text_start = .;
- *(.exception.text)
- __exception_text_end = .;
- IRQENTRY_TEXT
- TEXT_TEXT
- SCHED_TEXT
- LOCK_TEXT
- KPROBES_TEXT
-#ifdef CONFIG_MMU
- *(.fixup)
-#endif
- *(.gnu.warning)
- *(.rodata)
- *(.rodata.*)
- *(.glue_7)
- *(.glue_7t)
- . = ALIGN(4);
- *(.got) /* Global offset table */
- ARM_CPU_KEEP(PROC_INFO)
- }
RO_DATA(PAGE_SIZE)
@@ -142,8 +155,6 @@ SECTIONS
}
#endif
- _etext = .; /* End of text and rodata section */
-
#ifdef CONFIG_XIP_KERNEL
__data_loc = ALIGN(4); /* location in binary */
. = PAGE_OFFSET + TEXT_OFFSET;
@@ -153,8 +164,10 @@ SECTIONS
#endif
.data : AT(__data_loc) {
+#ifdef CONFIG_XIP_KERNEL
_data = .; /* address in memory */
_sdata = .;
+#endif
/*
* first, the init task union, aligned
@@ -259,12 +272,6 @@ SECTIONS
/* Default discards */
DISCARDS
-
-#ifndef CONFIG_SMP_ON_UP
- /DISCARD/ : {
- *(.alt.smp.init)
- }
-#endif
}
/*
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index cddd684..9e3c3c3 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -294,7 +294,7 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
#ifdef CONFIG_XIP_KERNEL
memblock_reserve(__pa(_sdata), _end - _sdata);
#else
- memblock_reserve(__pa(_stext), _end - _stext);
+ memblock_reserve(__pa(_text), _end - _text);
#endif
#ifdef CONFIG_BLK_DEV_INITRD
if (phys_initrd_size &&
next prev parent reply other threads:[~2011-02-11 14:43 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-10 18:16 Alexander Holler
2011-01-10 22:26 ` Nicolas Pitre
2011-01-11 6:34 ` Alexander Holler
2011-01-11 15:17 ` Alexander Holler
2011-01-11 15:57 ` Russell King - ARM Linux
2011-01-11 16:02 ` Nicolas Pitre
2011-01-11 15:46 ` Rabin Vincent
2011-01-11 15:59 ` Russell King - ARM Linux
2011-01-12 3:00 ` Alexander Holler
2011-01-12 16:05 ` Dave Martin
2011-01-12 16:23 ` Russell King - ARM Linux
2011-01-12 18:28 ` Nicolas Pitre
2011-01-12 18:42 ` Russell King - ARM Linux
2011-01-12 18:55 ` Nicolas Pitre
2011-01-25 8:44 ` Sachin Verma
2011-01-25 13:23 ` Catalin Marinas
2011-01-27 5:43 ` Nicolas Pitre
2011-02-10 15:43 ` Russell King - ARM Linux
2011-02-10 19:41 ` Nicolas Pitre
2011-02-11 9:31 ` Dave Martin
2011-02-11 9:38 ` Russell King - ARM Linux
2011-02-11 9:45 ` Dave Martin
2011-02-11 13:55 ` Nicolas Pitre
2011-02-11 13:51 ` Nicolas Pitre
2011-02-11 14:25 ` Dave Martin
2011-02-11 14:42 ` Russell King - ARM Linux [this message]
2011-02-12 19:52 ` Nicolas Pitre
2011-01-13 5:50 ` Alexander Holler
2011-01-13 10:04 ` Russell King - ARM Linux
2011-01-13 14:36 ` Alexander Holler
2011-01-12 16:25 ` Matthieu CASTET
2011-01-12 16:38 ` Russell King - ARM Linux
2011-01-11 16:01 ` Nicolas Pitre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110211144207.GJ23404@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=catalin.marinas@arm.com \
--cc=dave.martin@linaro.org \
--cc=holler@ahsoftware.de \
--cc=imschnvrm@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.pitre@linaro.org \
--cc=rabin@rab.in \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®