blob: afd72cbc629f7a2e46b5786fc3b3e4cf6e2092a4 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
Daniel Boulbyf3da5912022-04-01 12:31:52 +01002 * Copyright (c) 2017-2022, Arm Limited. All rights reserved.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Daniel Boulbyf3da5912022-04-01 12:31:52 +01007#include <sp_def.h>
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02008#include <platform_def.h>
9#include <xlat_tables_defs.h>
10
11OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
12OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
13ENTRY(cactus_entrypoint)
14
15SECTIONS
16{
Daniel Boulbyf3da5912022-04-01 12:31:52 +010017 . = SP_IMAGE_BASE;
Antonio Nino Diaz4762fef2018-06-29 14:58:04 +010018
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020019 ASSERT(. == ALIGN(PAGE_SIZE),
20 "TEXT_START address is not aligned to PAGE_SIZE.")
21
22 .text : {
23 __TEXT_START__ = .;
24 *cactus_entrypoint.o(.text*)
25 *(.text*)
26 *(.vectors)
27 . = NEXT(PAGE_SIZE);
28 __TEXT_END__ = .;
29 }
30
31 .rodata : {
32 . = ALIGN(PAGE_SIZE);
33 __RODATA_START__ = .;
34 *(.rodata*)
Olivier Deprez1d2b88d2020-03-06 17:17:56 +010035
36 /*
37 * Keep the .got section in the RO section as it is patched
38 * prior to enabling the MMU and having the .got in RO is better for
39 * security. GOT is a table of addresses so ensure 8-byte alignment.
40 */
41 . = ALIGN(8);
42 __GOT_START__ = .;
43 *(.got)
44 __GOT_END__ = .;
45
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020046 . = NEXT(PAGE_SIZE);
47 __RODATA_END__ = .;
Olivier Deprez1d2b88d2020-03-06 17:17:56 +010048
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020049 }
50
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020051 .data : {
52 . = ALIGN(PAGE_SIZE);
Antonio Nino Diaz54287c82018-12-05 15:37:33 +000053 __DATA_START__ = .;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020054 *(.data*)
J-Alves0e1e7ca2021-01-25 14:11:06 +000055 . = ALIGN(PAGE_SIZE);
56 cactus_cmd_handler_begin = .;
57 KEEP(*(.cactus_handler))
58 cactus_cmd_handler_end = .;
Antonio Nino Diaz54287c82018-12-05 15:37:33 +000059 . = NEXT(PAGE_SIZE);
60 __DATA_END__ = .;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020061 }
62
Olivier Deprez1d2b88d2020-03-06 17:17:56 +010063 /*
64 * .rela.dyn needs to come after .data for the read-elf utility to parse
65 * this section correctly. Ensure 8-byte alignment so that the fields of
66 * RELA data structure are aligned.
67 */
68 . = ALIGN(8);
69 __RELA_START__ = .;
70 .rela.dyn . : {
71 }
72 __RELA_END__ = .;
73
Antonio Nino Diaz54287c82018-12-05 15:37:33 +000074 .bss (NOLOAD) : {
75 . = ALIGN(PAGE_SIZE);
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020076 __BSS_START__ = .;
77 *(SORT_BY_ALIGNMENT(.bss*))
78 *(COMMON)
J-Alves63cdaa72020-10-08 17:22:45 +010079 *(xlat_table*)
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020080 . = NEXT(PAGE_SIZE);
81 __BSS_END__ = .;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020082 }
83}