microsoft/mu_feature_ffa
Publicmirrored fromhttps://github.com/microsoft/mu_feature_ffaAvailable
FfaFeaturePkg/SecurePartitions/MsSecurePartitionRust/linker/image.ld
99lines · modecode
| 1 | /* |
| 2 | * Copyright 2023 Google LLC |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* |
| 18 | * Code will start running at this symbol which is placed at the start of the |
| 19 | * image. |
| 20 | */ |
| 21 | ENTRY(entry) |
| 22 | |
| 23 | SECTIONS |
| 24 | { |
| 25 | /* |
| 26 | * Collect together the code. |
| 27 | */ |
| 28 | .init : ALIGN(4096) { |
| 29 | text_begin = .; |
| 30 | *(.init.entry) |
| 31 | *(.init.*) |
| 32 | } >image |
| 33 | .text : { |
| 34 | *(.text.*) |
| 35 | } >image |
| 36 | text_end = .; |
| 37 | |
| 38 | /* |
| 39 | * Collect together read-only data. |
| 40 | */ |
| 41 | .rodata : ALIGN(4096) { |
| 42 | rodata_begin = .; |
| 43 | *(.rodata.*) |
| 44 | } >image |
| 45 | .got : { |
| 46 | *(.got) |
| 47 | } >image |
| 48 | rodata_end = .; |
| 49 | |
| 50 | /* |
| 51 | * Collect together the read-write data including .bss at the end which |
| 52 | * will be zero'd by the entry code. |
| 53 | */ |
| 54 | .data : ALIGN(4096) { |
| 55 | data_begin = .; |
| 56 | *(.data.*) |
| 57 | /* |
| 58 | * The entry point code assumes that .data is a multiple of 32 |
| 59 | * bytes long. |
| 60 | */ |
| 61 | . = ALIGN(32); |
| 62 | data_end = .; |
| 63 | } >image |
| 64 | |
| 65 | /* Everything beyond this point will not be included in the binary. */ |
| 66 | bin_end = .; |
| 67 | |
| 68 | /* The entry point code assumes that .bss is 16-byte aligned. */ |
| 69 | .bss : ALIGN(16) { |
| 70 | bss_begin = .; |
| 71 | *(.bss.*) |
| 72 | *(COMMON) |
| 73 | . = ALIGN(16); |
| 74 | bss_end = .; |
| 75 | } >image |
| 76 | |
| 77 | .stack (NOLOAD) : ALIGN(4096) { |
| 78 | boot_stack_begin = .; |
| 79 | . += 40 * 4096; |
| 80 | . = ALIGN(4096); |
| 81 | boot_stack_end = .; |
| 82 | } >image |
| 83 | |
| 84 | . = ALIGN(4K); |
| 85 | PROVIDE(dma_region = .); |
| 86 | |
| 87 | /* |
| 88 | * Remove unused sections from the image. |
| 89 | */ |
| 90 | /DISCARD/ : { |
| 91 | /* The image loads itself so doesn't need these sections. */ |
| 92 | *(.gnu.hash) |
| 93 | *(.hash) |
| 94 | *(.interp) |
| 95 | *(.eh_frame_hdr) |
| 96 | *(.eh_frame) |
| 97 | *(.note.gnu.build-id) |
| 98 | } |
| 99 | } |
| 100 | |