94 lines
1.8 KiB
Plaintext
94 lines
1.8 KiB
Plaintext
OUTPUT_FORMAT("elf32-littleriscv")
|
|
OUTPUT_ARCH(riscv)
|
|
ENTRY(_start)
|
|
|
|
MEMORY
|
|
{
|
|
RAM (rwx) : ORIGIN = 0x80000000, LENGTH = 16M
|
|
}
|
|
|
|
PHDRS
|
|
{
|
|
text PT_LOAD FLAGS(5); /* read + execute */
|
|
data PT_LOAD FLAGS(6); /* read + write */
|
|
tls PT_TLS FLAGS(4); /* TLS template */
|
|
}
|
|
|
|
SECTIONS
|
|
{
|
|
. = ORIGIN(RAM);
|
|
|
|
.text : ALIGN(4)
|
|
{
|
|
KEEP(*(.vectors))
|
|
*(.text.startup .text.startup.*)
|
|
*(.text .text.*)
|
|
} > RAM :text
|
|
|
|
.rodata : ALIGN(4)
|
|
{
|
|
*(.rodata .rodata.*)
|
|
} > RAM :text
|
|
|
|
.data : ALIGN(16)
|
|
{
|
|
__data_start = .;
|
|
*(.data .data.*)
|
|
*(.sdata .sdata.*)
|
|
__data_end = .;
|
|
} > RAM :data
|
|
|
|
.tdata : ALIGN(16)
|
|
{
|
|
__tls_start = .;
|
|
*(.tdata .tdata.* .gnu.linkonce.td.*)
|
|
__tdata_end = .;
|
|
} > RAM :data :tls
|
|
|
|
.tbss (NOLOAD) : ALIGN(16)
|
|
{
|
|
__tbss_start = .;
|
|
*(.tbss .tbss.* .gnu.linkonce.tb.*)
|
|
*(.tcommon)
|
|
__tbss_end = .;
|
|
} > RAM :data :tls
|
|
|
|
/* GNU ld does not advance the normal location counter for TLS NOBITS. */
|
|
.tbss_space (NOLOAD) : ALIGN(16)
|
|
{
|
|
. = ADDR(.tbss) + SIZEOF(.tbss);
|
|
} > RAM :data
|
|
|
|
.bss (NOLOAD) : ALIGN(16)
|
|
{
|
|
__bss_start = .;
|
|
*(.bss .bss.* COMMON)
|
|
*(.sbss .sbss.*)
|
|
__bss_end = .;
|
|
} > RAM :data
|
|
|
|
. = ALIGN(16);
|
|
__heap_start = .;
|
|
_end = __heap_start;
|
|
PROVIDE(end = __heap_start);
|
|
|
|
__stack_top = ORIGIN(RAM) + LENGTH(RAM);
|
|
__stack_reserve = 64K;
|
|
__stack_bottom = __stack_top - __stack_reserve;
|
|
__heap_end = __stack_bottom;
|
|
__global_pointer$ = __data_start + 0x800;
|
|
|
|
/DISCARD/ :
|
|
{
|
|
*(.comment)
|
|
*(.note .note.*)
|
|
}
|
|
}
|
|
|
|
ASSERT(__heap_start <= __heap_end,
|
|
"C09: heap overlaps the reserved 64 KiB stack")
|
|
ASSERT((__heap_start & 15) == 0,
|
|
"C09: __heap_start must be 16-byte aligned")
|
|
ASSERT((__heap_end & 15) == 0,
|
|
"C09: __heap_end must be 16-byte aligned")
|