nabkah01 | 002e569 | 2022-10-10 12:36:46 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | |
| 8 | ENTRY(realm_entrypoint) |
| 9 | |
| 10 | #include <realm_def.h> |
| 11 | |
| 12 | MEMORY { |
| 13 | |
| 14 | RAM (rwx): ORIGIN = 0x0, LENGTH = REALM_MAX_LOAD_IMG_SIZE |
| 15 | } |
| 16 | |
| 17 | SECTIONS |
| 18 | { |
| 19 | ASSERT(. == ALIGN(PAGE_SIZE), |
| 20 | "TEXT_START address is not aligned to PAGE_SIZE.") |
| 21 | .text : { |
| 22 | __REALM_TEXT_START__ = .; |
| 23 | *realm_entrypoint.o(.text*) |
| 24 | *(.text*) |
| 25 | *(.vectors) |
| 26 | . = NEXT(PAGE_SIZE); |
| 27 | __REALM_TEXT_END__ = .; |
| 28 | }> RAM |
| 29 | |
| 30 | .rodata : { |
| 31 | . = ALIGN(PAGE_SIZE); |
| 32 | __REALM_RODATA_START__ = .; |
| 33 | *(.rodata*) |
| 34 | |
| 35 | /* |
| 36 | * Keep the .got section in the RO section as it is patched |
| 37 | * prior to enabling the MMU and having the .got in RO is better for |
| 38 | * security. GOT is a table of addresses so ensure 8-byte alignment. |
| 39 | */ |
| 40 | . = ALIGN(8); |
| 41 | __GOT_START__ = .; |
| 42 | *(.got) |
| 43 | __GOT_END__ = .; |
| 44 | |
| 45 | . = NEXT(PAGE_SIZE); |
| 46 | __REALM_RODATA_END__ = .; |
| 47 | |
| 48 | }> RAM |
| 49 | |
| 50 | .data : { |
| 51 | . = ALIGN(PAGE_SIZE); |
| 52 | __REALM_DATA_START__ = .; |
| 53 | *(.data*) |
| 54 | . = ALIGN(PAGE_SIZE); |
| 55 | . = NEXT(PAGE_SIZE); |
| 56 | __REALM_DATA_END__ = .; |
| 57 | }> RAM |
| 58 | |
| 59 | /* |
| 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 | }> RAM |
| 68 | __RELA_END__ = .; |
| 69 | |
| 70 | .bss (NOLOAD) : { |
| 71 | . = ALIGN(PAGE_SIZE); |
| 72 | __REALM_BSS_START__ = .; |
| 73 | *(SORT_BY_ALIGNMENT(.bss*)) |
| 74 | *(COMMON) |
| 75 | . = NEXT(PAGE_SIZE); |
| 76 | __REALM_BSS_END__ = .; |
| 77 | }> RAM |
| 78 | __REALM_BSS_SIZE__ = SIZEOF(.bss); |
| 79 | } |