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.
This commit is contained in:
Marcel Moolenaar 2008-02-27 00:03:23 +00:00
parent 4c2d7071c5
commit 8678a43066
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=176617
3 changed files with 22 additions and 10 deletions

View File

@ -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*) }

View File

@ -71,6 +71,12 @@
#define GET_CPUINFO(r) \
mfsprg0 r
/*
* Compiled KERNBASE location and the kernel load address
*/
.globl kernbase
.set kernbase, KERNBASE
/*
* Globals
*/

View File

@ -152,4 +152,5 @@ ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
ASSYM(SF_UC, offsetof(struct sigframe, sf_uc));
ASSYM(KERNBASE, KERNBASE);
ASSYM(MAXCOMLEN, MAXCOMLEN);