1/*
2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
3 * Copyright 2015, 2016 Hesham Almatary <heshamelmatary@gmail.com>
4 * Copyright 2021, HENSOLDT Cyber
5 *
6 * SPDX-License-Identifier: GPL-2.0-only
7 */
8
9OUTPUT_ARCH(riscv)
10ENTRY(_start)
11
12#include <config.h>
13#define __ASSEMBLER__
14#include <hardware.h>
15#include <sel4/plat/api/constants.h>
16#include <plat/machine/devices_gen.h>
17
18KERNEL_OFFSET = KERNEL_ELF_BASE - KERNEL_ELF_PADDR_BASE;
19
20SECTIONS
21{
22    . = KERNEL_ELF_BASE;
23
24    .boot.text . : AT(ADDR(.boot.text) - KERNEL_OFFSET)
25    {
26        *(.boot.text)
27    }
28    .boot.rodata . : AT(ADDR(.boot.rodata) - KERNEL_OFFSET)
29    {
30        *(.boot.rodata)
31    }
32    .boot.data . : AT(ADDR(.boot.data) - KERNEL_OFFSET)
33    {
34        *(.boot.data)
35    }
36    . = ALIGN(4K);
37
38    ki_boot_end = .;
39
40    .text . : AT(ADDR(.text) - KERNEL_OFFSET)
41    {
42        /* Sit inside a large frame */
43        . = ALIGN(4K);
44
45
46        /* Standard kernel */
47        *(.text)
48    }
49
50    /* Start of data section */
51    _sdata = .;
52    .sdata : {
53        __global_pointer$ = . + 0x800;
54        *(.sdata*)
55    }
56    .srodata : {
57        *(.srodata*)
58    }
59
60    .rodata . : AT(ADDR(.rodata) - KERNEL_OFFSET)
61    {
62        *(.rodata)
63        *(.rodata.*)
64    }
65
66    .data . : AT(ADDR(.data) - KERNEL_OFFSET)
67    {
68        *(.data)
69    }
70
71    .bss . : AT(ADDR(.bss) - KERNEL_OFFSET)
72    {
73        *(.bss)
74        *(COMMON) /* fallback in case '-fno-common' is not used */
75        *(.sbss)
76
77        /* 4k breakpoint stack */
78        _breakpoint_stack_bottom = .;
79        . = . + 4K;
80        _breakpoint_stack_top = .;
81
82        /* large data such as the globals frame and global PD */
83        *(.bss.aligned)
84    }
85
86    . = ALIGN(4K);
87    ki_end = .;
88}
89