Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 1 | /* |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2021, Arm Limited. All rights reserved. |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 3 | * |
| 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 | |
| 11 | OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) |
| 12 | OUTPUT_ARCH(PLATFORM_LINKER_ARCH) |
Ruari Phipps | 1925b2a | 2020-09-10 14:05:55 +0100 | [diff] [blame] | 13 | ENTRY(shim_entrypoint) |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 14 | |
| 15 | SECTIONS |
| 16 | { |
| 17 | . = IVY_IMAGE_BASE; |
| 18 | |
| 19 | ASSERT(. == ALIGN(PAGE_SIZE), |
| 20 | "TEXT_START address is not aligned to PAGE_SIZE.") |
| 21 | |
Ruari Phipps | 1925b2a | 2020-09-10 14:05:55 +0100 | [diff] [blame] | 22 | /*----------------- START S-EL1 SHIM ----------------*/ |
| 23 | |
| 24 | .shim_text : { |
| 25 | __SHIM_TEXT_START__ = .; |
| 26 | *spm_shim_entrypoint.o(.text*) |
| 27 | *(.vectors) |
| 28 | . = NEXT(PAGE_SIZE); |
| 29 | __SHIM_TEXT_END__ = .; |
| 30 | } |
| 31 | |
| 32 | .shim_rodata : { |
| 33 | . = ALIGN(PAGE_SIZE); |
| 34 | __SHIM_RODATA_START__ = .; |
| 35 | |
| 36 | . = NEXT(PAGE_SIZE); |
| 37 | __SHIM_RODATA_END__ = .; |
| 38 | } |
| 39 | |
| 40 | .shim_data : { |
| 41 | . = ALIGN(PAGE_SIZE); |
| 42 | __SHIM_DATA_START__ = .; |
| 43 | |
| 44 | . = NEXT(PAGE_SIZE); |
| 45 | __SHIM_DATA_END__ = .; |
| 46 | } |
| 47 | |
| 48 | .shim_bss (NOLOAD) : { |
| 49 | . = ALIGN(PAGE_SIZE); |
| 50 | __SHIM_BSS_START__ = .; |
| 51 | |
| 52 | *(.bss.shim_stacks) |
| 53 | *(.bss.tf_base_xlat_table) |
| 54 | *(.bss.tf_mmap) |
| 55 | *xlat_tables_context.o(COMMON) |
| 56 | *xlat_tables_context.o(xlat_table) |
| 57 | |
| 58 | . = NEXT(PAGE_SIZE); |
| 59 | __SHIM_BSS_END__ = .; |
| 60 | } |
| 61 | |
| 62 | /*----------------- END S-EL1 SHIM ----------------*/ |
| 63 | |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 64 | .text : { |
| 65 | __TEXT_START__ = .; |
| 66 | *ivy_entrypoint.o(.text*) |
| 67 | *(.text*) |
| 68 | *(.vectors) |
| 69 | . = NEXT(PAGE_SIZE); |
| 70 | __TEXT_END__ = .; |
| 71 | } |
| 72 | |
| 73 | .rodata : { |
| 74 | . = ALIGN(PAGE_SIZE); |
| 75 | __RODATA_START__ = .; |
| 76 | *(.rodata*) |
Ruari Phipps | 1925b2a | 2020-09-10 14:05:55 +0100 | [diff] [blame] | 77 | |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 78 | /* |
| 79 | * Keep the .got section in the RO section as it is patched |
| 80 | * prior to enabling the MMU, so having it in RO is better for |
| 81 | * security. GOT is a table of addresses so ensure 8-byte alignment. |
| 82 | */ |
| 83 | . = ALIGN(8); |
| 84 | __GOT_START__ = .; |
| 85 | *(.got) |
| 86 | __GOT_END__ = .; |
| 87 | |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 88 | . = NEXT(PAGE_SIZE); |
| 89 | __RODATA_END__ = .; |
| 90 | } |
| 91 | |
| 92 | .data : { |
| 93 | . = ALIGN(PAGE_SIZE); |
| 94 | __DATA_START__ = .; |
| 95 | *(.data*) |
| 96 | . = NEXT(PAGE_SIZE); |
| 97 | __DATA_END__ = .; |
| 98 | } |
| 99 | |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 100 | /* |
| 101 | * .rela.dyn needs to come after .data for the read-elf utility |
| 102 | * to parse this section correctly. Ensure 8-byte alignment so |
| 103 | * that the fields of RELA data structure are aligned. |
| 104 | */ |
| 105 | . = ALIGN(8); |
| 106 | __RELA_START__ = .; |
| 107 | .rela.dyn . : { |
| 108 | } |
| 109 | __RELA_END__ = .; |
| 110 | |
| 111 | |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 112 | .bss (NOLOAD) : { |
| 113 | . = ALIGN(PAGE_SIZE); |
| 114 | __BSS_START__ = .; |
| 115 | *(SORT_BY_ALIGNMENT(.bss*)) |
| 116 | *(COMMON) |
| 117 | . = NEXT(PAGE_SIZE); |
| 118 | __BSS_END__ = .; |
| 119 | } |
| 120 | } |