blob: b21201bac6f87ab1def0d66eaff36333fe305bf4 [file] [log] [blame]
Antonio Nino Diaz0b1ab402018-12-05 15:38:39 +00001/*
Olivier Deprez6baf5b82021-05-14 19:04:40 +02002 * Copyright (c) 2018-2022, Arm Limited. All rights reserved.
Antonio Nino Diaz0b1ab402018-12-05 15:38:39 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <ivy_def.h>
8#include <platform_def.h>
9#include <xlat_tables_defs.h>
10
11OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
12OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
Olivier Deprez6baf5b82021-05-14 19:04:40 +020013
14#if IVY_SHIM == 1
Ruari Phipps1925b2a2020-09-10 14:05:55 +010015ENTRY(shim_entrypoint)
Olivier Deprez6baf5b82021-05-14 19:04:40 +020016#else
17ENTRY(ivy_entrypoint)
18#endif
19
Antonio Nino Diaz0b1ab402018-12-05 15:38:39 +000020
21SECTIONS
22{
23 . = IVY_IMAGE_BASE;
24
25 ASSERT(. == ALIGN(PAGE_SIZE),
26 "TEXT_START address is not aligned to PAGE_SIZE.")
27
Olivier Deprez6baf5b82021-05-14 19:04:40 +020028#if IVY_SHIM == 1
Ruari Phipps1925b2a2020-09-10 14:05:55 +010029
30 .shim_text : {
31 __SHIM_TEXT_START__ = .;
32 *spm_shim_entrypoint.o(.text*)
33 *(.vectors)
34 . = NEXT(PAGE_SIZE);
35 __SHIM_TEXT_END__ = .;
36 }
37
38 .shim_rodata : {
39 . = ALIGN(PAGE_SIZE);
40 __SHIM_RODATA_START__ = .;
41
42 . = NEXT(PAGE_SIZE);
43 __SHIM_RODATA_END__ = .;
44 }
45
46 .shim_data : {
47 . = ALIGN(PAGE_SIZE);
48 __SHIM_DATA_START__ = .;
49
50 . = NEXT(PAGE_SIZE);
51 __SHIM_DATA_END__ = .;
52 }
53
54 .shim_bss (NOLOAD) : {
55 . = ALIGN(PAGE_SIZE);
56 __SHIM_BSS_START__ = .;
57
58 *(.bss.shim_stacks)
59 *(.bss.tf_base_xlat_table)
60 *(.bss.tf_mmap)
61 *xlat_tables_context.o(COMMON)
62 *xlat_tables_context.o(xlat_table)
63
64 . = NEXT(PAGE_SIZE);
65 __SHIM_BSS_END__ = .;
66 }
67
Olivier Deprez6baf5b82021-05-14 19:04:40 +020068#endif
Ruari Phipps1925b2a2020-09-10 14:05:55 +010069
Antonio Nino Diaz0b1ab402018-12-05 15:38:39 +000070 .text : {
71 __TEXT_START__ = .;
72 *ivy_entrypoint.o(.text*)
73 *(.text*)
74 *(.vectors)
75 . = NEXT(PAGE_SIZE);
76 __TEXT_END__ = .;
77 }
78
79 .rodata : {
80 . = ALIGN(PAGE_SIZE);
81 __RODATA_START__ = .;
82 *(.rodata*)
Ruari Phipps1925b2a2020-09-10 14:05:55 +010083
Ruari Phipps9f1952c2020-08-24 11:32:32 +010084 /*
85 * Keep the .got section in the RO section as it is patched
86 * prior to enabling the MMU, so having it in RO is better for
87 * security. GOT is a table of addresses so ensure 8-byte alignment.
88 */
89 . = ALIGN(8);
90 __GOT_START__ = .;
91 *(.got)
92 __GOT_END__ = .;
93
Antonio Nino Diaz0b1ab402018-12-05 15:38:39 +000094 . = NEXT(PAGE_SIZE);
95 __RODATA_END__ = .;
96 }
97
98 .data : {
99 . = ALIGN(PAGE_SIZE);
100 __DATA_START__ = .;
101 *(.data*)
102 . = NEXT(PAGE_SIZE);
103 __DATA_END__ = .;
104 }
105
Ruari Phipps9f1952c2020-08-24 11:32:32 +0100106 /*
107 * .rela.dyn needs to come after .data for the read-elf utility
108 * to parse this section correctly. Ensure 8-byte alignment so
109 * that the fields of RELA data structure are aligned.
110 */
111 . = ALIGN(8);
112 __RELA_START__ = .;
113 .rela.dyn . : {
114 }
115 __RELA_END__ = .;
116
117
Antonio Nino Diaz0b1ab402018-12-05 15:38:39 +0000118 .bss (NOLOAD) : {
119 . = ALIGN(PAGE_SIZE);
120 __BSS_START__ = .;
121 *(SORT_BY_ALIGNMENT(.bss*))
122 *(COMMON)
123 . = NEXT(PAGE_SIZE);
124 __BSS_END__ = .;
125 }
126}