Simplify this by deciding load address at one place.

This commit is contained in:
uebayasi 2015-08-21 03:36:32 +00:00
parent 220951d1d4
commit 8e8896ca6f
2 changed files with 42 additions and 22 deletions

View File

@ -1,28 +1,24 @@
/* $NetBSD: ldscript.elf,v 1.4 2015/08/20 07:00:48 uebayasi Exp $ */
/* $NetBSD: ldscript.elf,v 1.5 2015/08/21 03:42:29 uebayasi Exp $ */
OUTPUT_ARCH(arm)
ENTRY(KERNEL_BASE_phys)
SECTIONS
{
KERNEL_BASE_phys = 0xF0000000;
KERNEL_BASE_virt = 0xF0000000;
/* Kernel start: */
.start (KERNEL_BASE_phys) :
.start :
{
*(.start)
} =0
}
/* Read-only sections, merged into text segment: */
.text (KERNEL_BASE_virt + SIZEOF(.start)) :
AT (LOADADDR(.start) + SIZEOF(.start))
.text :
{
*(.text)
*(.text.*)
*(.stub)
*(.glue_7t) *(.glue_7)
*(.rodata) *(.rodata.*)
} =0
}
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
@ -30,14 +26,12 @@ SECTIONS
boundary. */
. = ALIGN(0x8000);
.data :
AT (LOADADDR(.text) + (ADDR(.data) - ADDR(.text)))
{
__data_start = . ;
*(.data)
*(.data.*)
}
.sdata :
AT (LOADADDR(.data) + (ADDR(.sdata) - ADDR(.data)))
{
*(.sdata)
*(.sdata.*)
@ -73,3 +67,19 @@ SECTIONS
_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
PROVIDE (end = .);
}
SECTIONS
{
KERNEL_BASE_phys = 0xF0000000;
KERNEL_BASE_virt = 0xF0000000;
.start (KERNEL_BASE_phys) :
{
*(.start)
} =0
.text (KERNEL_BASE_virt + SIZEOF(.start)) :
AT (LOADADDR(.start) + SIZEOF(.start))
{
*(.text)
} =0
}

View File

@ -1,28 +1,24 @@
/* $NetBSD: ldscript.zaurus,v 1.7 2015/08/20 07:00:49 uebayasi Exp $ */
/* $NetBSD: ldscript.zaurus,v 1.8 2015/08/21 03:36:32 uebayasi Exp $ */
OUTPUT_ARCH(arm)
ENTRY(KERNEL_BASE_phys)
SECTIONS
{
KERNEL_BASE_phys = @KERNEL_BASE_PHYS@;
KERNEL_BASE_virt = @KERNEL_BASE_VIRT@;
/* Kernel start: */
.start (KERNEL_BASE_phys) :
.start :
{
*(.start)
} =0
}
/* Read-only sections, merged into text segment: */
.text (KERNEL_BASE_virt + SIZEOF(.start)) :
AT (LOADADDR(.start) + SIZEOF(.start))
.text :
{
*(.text)
*(.text.*)
*(.stub)
*(.glue_7t) *(.glue_7)
*(.rodata) *(.rodata.*)
} =0
}
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) }
PROVIDE (__exidx_start = .);
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
@ -34,14 +30,12 @@ SECTIONS
boundary. */
. = ALIGN(0x8000);
.data :
AT (LOADADDR(.text) + (ADDR(.data) - ADDR(.text)))
{
__data_start = . ;
*(.data)
*(.data.*)
}
.sdata :
AT (LOADADDR(.data) + (ADDR(.sdata) - ADDR(.data)))
{
*(.sdata)
*(.sdata.*)
@ -87,3 +81,19 @@ SECTIONS
*(.rela.eh_frame)
}
}
SECTIONS
{
KERNEL_BASE_phys = @KERNEL_BASE_PHYS@;
KERNEL_BASE_virt = @KERNEL_BASE_VIRT@;
.start (KERNEL_BASE_phys) :
{
*(.start)
} =0
.text (KERNEL_BASE_virt + SIZEOF(.start)) :
AT (LOADADDR(.start) + SIZEOF(.start))
{
*(.text)
} =0
}