summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2008-02-27 00:03:23 +0000
committermarcel <marcel@FreeBSD.org>2008-02-27 00:03:23 +0000
commitbcd067ff4ff4fa9e5ca8c53935834e040876eb18 (patch)
tree38c255abb7cb79ddac9431d5f9a15770e10b7d35
parentd31421516954ecd696fe6bf3713be3a5ff22f0ef (diff)
downloadFreeBSD-src-bcd067ff4ff4fa9e5ca8c53935834e040876eb18.zip
FreeBSD-src-bcd067ff4ff4fa9e5ca8c53935834e040876eb18.tar.gz
Avoid hardcoding the kernel link address in the linker script.
Use KERNBASE instead. While here, move the text sections forward to the beginning of the text segment.
-rw-r--r--sys/conf/ldscript.powerpc25
-rw-r--r--sys/powerpc/aim/locore.S6
-rw-r--r--sys/powerpc/powerpc/genassym.c1
3 files changed, 22 insertions, 10 deletions
diff --git a/sys/conf/ldscript.powerpc b/sys/conf/ldscript.powerpc
index fac182d..b7038bf 100644
--- a/sys/conf/ldscript.powerpc
+++ b/sys/conf/ldscript.powerpc
@@ -10,7 +10,20 @@ PROVIDE (__stack = 0);
SECTIONS
{
/* Read-only sections, merged into text segment: */
- . = 0x00100000 + SIZEOF_HEADERS;
+
+ . = kernbase + SIZEOF_HEADERS;
+
+ .text :
+ {
+ *(.text)
+ *(.stub)
+ /* .gnu.warning sections are handled specially by elf32.em. */
+ *(.gnu.warning)
+ *(.gnu.linkonce.t*)
+ } =0
+ _etext = .;
+ PROVIDE (etext = .);
+
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
@@ -37,15 +50,7 @@ SECTIONS
.rela.sbss : { *(.rela.sbss) }
.rela.sdata2 : { *(.rela.sdata2) }
.rela.sbss2 : { *(.rela.sbss2) }
- .text :
- {
- *(.text)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- *(.gnu.linkonce.t*)
- } =0
- _etext = .;
- PROVIDE (etext = .);
+
.init : { *(.init) } =0
.fini : { *(.fini) } =0
.rodata : { *(.rodata) *(.gnu.linkonce.r*) }
diff --git a/sys/powerpc/aim/locore.S b/sys/powerpc/aim/locore.S
index 98864fb..e566e4d 100644
--- a/sys/powerpc/aim/locore.S
+++ b/sys/powerpc/aim/locore.S
@@ -72,6 +72,12 @@
mfsprg0 r
/*
+ * Compiled KERNBASE location and the kernel load address
+ */
+ .globl kernbase
+ .set kernbase, KERNBASE
+
+/*
* Globals
*/
.data
diff --git a/sys/powerpc/powerpc/genassym.c b/sys/powerpc/powerpc/genassym.c
index 5c276b1..57abec1 100644
--- a/sys/powerpc/powerpc/genassym.c
+++ b/sys/powerpc/powerpc/genassym.c
@@ -152,4 +152,5 @@ ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
ASSYM(SF_UC, offsetof(struct sigframe, sf_uc));
+ASSYM(KERNBASE, KERNBASE);
ASSYM(MAXCOMLEN, MAXCOMLEN);
OpenPOWER on IntegriCloud