| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #include <asm-generic/vmlinux.lds.h> |
| 3 | #include <asm/vmlinux.lds.h> |
| 4 | #include <asm/thread_info.h> |
| 5 | #include <asm/page.h> |
| 6 | #include <asm/sclp.h> |
| 7 | #include "boot.h" |
| 8 | |
| 9 | OUTPUT_FORMAT("elf64-s390" , "elf64-s390" , "elf64-s390" ) |
| 10 | OUTPUT_ARCH(s390:64-bit) |
| 11 | |
| 12 | ENTRY(startup) |
| 13 | |
| 14 | SECTIONS |
| 15 | { |
| 16 | . = 0; |
| 17 | .ipldata : { |
| 18 | *(.ipldata) |
| 19 | } |
| 20 | . = IPL_START; |
| 21 | .head.text : { |
| 22 | _head = . ; |
| 23 | HEAD_TEXT |
| 24 | _ehead = . ; |
| 25 | } |
| 26 | . = PARMAREA; |
| 27 | .parmarea : { |
| 28 | *(.parmarea) |
| 29 | } |
| 30 | .text : { |
| 31 | _text = .; /* Text */ |
| 32 | *(.text) |
| 33 | *(.text.*) |
| 34 | INIT_TEXT |
| 35 | _etext = . ; |
| 36 | } |
| 37 | .rodata : { |
| 38 | _rodata = . ; |
| 39 | *(.rodata) /* read-only data */ |
| 40 | *(.rodata.*) |
| 41 | _erodata = . ; |
| 42 | } |
| 43 | EXCEPTION_TABLE(16) |
| 44 | .got : { |
| 45 | *(.got) |
| 46 | } |
| 47 | NOTES |
| 48 | .data : { |
| 49 | _data = . ; |
| 50 | *(.data) |
| 51 | *(.data.*) |
| 52 | _edata = . ; |
| 53 | } |
| 54 | |
| 55 | BOOT_DATA |
| 56 | BOOT_DATA_PRESERVED |
| 57 | |
| 58 | /* |
| 59 | * This is the BSS section of the decompressor and not of the decompressed Linux kernel. |
| 60 | * It will consume place in the decompressor's image. |
| 61 | */ |
| 62 | . = ALIGN(8); |
| 63 | .bss : { |
| 64 | _bss = . ; |
| 65 | *(.bss) |
| 66 | *(.bss.*) |
| 67 | *(COMMON) |
| 68 | /* |
| 69 | * Stacks for the decompressor |
| 70 | */ |
| 71 | . = ALIGN(PAGE_SIZE); |
| 72 | _dump_info_stack_start = .; |
| 73 | . += PAGE_SIZE; |
| 74 | _dump_info_stack_end = .; |
| 75 | . = ALIGN(PAGE_SIZE); |
| 76 | _stack_start = .; |
| 77 | . += BOOT_STACK_SIZE; |
| 78 | _stack_end = .; |
| 79 | _ebss = .; |
| 80 | } |
| 81 | |
| 82 | /* |
| 83 | * uncompressed image info used by the decompressor it should match |
| 84 | * struct vmlinux_info. It comes from .vmlinux.info section of |
| 85 | * uncompressed vmlinux in a form of info.o |
| 86 | */ |
| 87 | . = ALIGN(8); |
| 88 | .vmlinux.info : { |
| 89 | _vmlinux_info = .; |
| 90 | *(.vmlinux.info) |
| 91 | } |
| 92 | |
| 93 | .decompressor.syms : { |
| 94 | . += 1; /* make sure we have \0 before the first entry */ |
| 95 | . = ALIGN(2); |
| 96 | _decompressor_syms_start = .; |
| 97 | *(.decompressor.syms) |
| 98 | _decompressor_syms_end = .; |
| 99 | } |
| 100 | |
| 101 | _decompressor_end = .; |
| 102 | |
| 103 | . = ALIGN(4); |
| 104 | .vmlinux.relocs : { |
| 105 | __vmlinux_relocs_64_start = .; |
| 106 | *(.vmlinux.relocs_64) |
| 107 | __vmlinux_relocs_64_end = .; |
| 108 | } |
| 109 | |
| 110 | #ifdef CONFIG_KERNEL_UNCOMPRESSED |
| 111 | . = ALIGN(PAGE_SIZE); |
| 112 | . += AMODE31_SIZE; /* .amode31 section */ |
| 113 | |
| 114 | /* |
| 115 | * Make sure the location counter is not less than TEXT_OFFSET. |
| 116 | * _SEGMENT_SIZE is not available, use ALIGN(1 << 20) instead. |
| 117 | */ |
| 118 | . = MAX(TEXT_OFFSET, ALIGN(1 << 20)); |
| 119 | #else |
| 120 | . = ALIGN(8); |
| 121 | #endif |
| 122 | .rodata.compressed : { |
| 123 | _compressed_start = .; |
| 124 | *(.vmlinux.bin.compressed) |
| 125 | _compressed_end = .; |
| 126 | } |
| 127 | |
| 128 | #define SB_TRAILER_SIZE 32 |
| 129 | /* Trailer needed for Secure Boot */ |
| 130 | . += SB_TRAILER_SIZE; /* make sure .sb.trailer does not overwrite the previous section */ |
| 131 | . = ALIGN(4096) - SB_TRAILER_SIZE; |
| 132 | .sb.trailer : { |
| 133 | QUAD(0) |
| 134 | QUAD(0) |
| 135 | QUAD(0) |
| 136 | QUAD(0x000000207a49504c) |
| 137 | } |
| 138 | _end = .; |
| 139 | |
| 140 | /* Sections to be discarded */ |
| 141 | /DISCARD/ : { |
| 142 | COMMON_DISCARDS |
| 143 | *(.eh_frame) |
| 144 | *(*__ksymtab*) |
| 145 | *(___kcrctab*) |
| 146 | *(.modinfo) |
| 147 | } |
| 148 | |
| 149 | DWARF_DEBUG |
| 150 | ELF_DETAILS |
| 151 | |
| 152 | /* |
| 153 | * Make sure that the .got.plt is either completely empty or it |
| 154 | * contains only the three reserved double words. |
| 155 | */ |
| 156 | .got.plt : { |
| 157 | *(.got.plt) |
| 158 | } |
| 159 | ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, "Unexpected GOT/PLT entries detected!" ) |
| 160 | |
| 161 | /* |
| 162 | * Sections that should stay zero sized, which is safer to |
| 163 | * explicitly check instead of blindly discarding. |
| 164 | */ |
| 165 | .plt : { |
| 166 | *(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt) |
| 167 | } |
| 168 | ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!" ) |
| 169 | .rela.dyn : { |
| 170 | *(.rela.*) *(.rela_*) |
| 171 | } |
| 172 | ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!" ) |
| 173 | } |
| 174 | |