blob: 11b28ba95a3a62b9645e801f6bdddaaaff14d891 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
Olivier Deprez1d2b88d2020-03-06 17:17:56 +01002 * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Antonio Nino Diaz54287c82018-12-05 15:37:33 +00007#include <cactus_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{
Antonio Nino Diaz4762fef2018-06-29 14:58:04 +010017 . = CACTUS_IMAGE_BASE;
18
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*)
Antonio Nino Diaz54287c82018-12-05 15:37:33 +000055 . = NEXT(PAGE_SIZE);
56 __DATA_END__ = .;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020057 }
58
Olivier Deprez1d2b88d2020-03-06 17:17:56 +010059 /*
60 * .rela.dyn needs to come after .data for the read-elf utility to parse
61 * this section correctly. Ensure 8-byte alignment so that the fields of
62 * RELA data structure are aligned.
63 */
64 . = ALIGN(8);
65 __RELA_START__ = .;
66 .rela.dyn . : {
67 }
68 __RELA_END__ = .;
69
Antonio Nino Diaz54287c82018-12-05 15:37:33 +000070 .bss (NOLOAD) : {
71 . = ALIGN(PAGE_SIZE);
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020072 __BSS_START__ = .;
73 *(SORT_BY_ALIGNMENT(.bss*))
74 *(COMMON)
J-Alves63cdaa72020-10-08 17:22:45 +010075 *(xlat_table*)
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020076 . = NEXT(PAGE_SIZE);
77 __BSS_END__ = .;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020078 }
79}