| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #include <asm-generic/vmlinux.lds.h> |
| 3 | |
| 4 | OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT) |
| 5 | |
| 6 | #undef i386 |
| 7 | |
| 8 | #include <asm/cache.h> |
| 9 | #include <asm/page_types.h> |
| 10 | |
| 11 | #ifdef CONFIG_X86_64 |
| 12 | OUTPUT_ARCH(i386:x86-64) |
| 13 | ENTRY(startup_64) |
| 14 | #else |
| 15 | OUTPUT_ARCH(i386) |
| 16 | ENTRY(startup_32) |
| 17 | #endif |
| 18 | |
| 19 | SECTIONS |
| 20 | { |
| 21 | /* Be careful parts of head_64.S assume startup_32 is at |
| 22 | * address 0. |
| 23 | */ |
| 24 | . = 0; |
| 25 | .head.text : { |
| 26 | _head = . ; |
| 27 | HEAD_TEXT |
| 28 | _ehead = . ; |
| 29 | } |
| 30 | .rodata..compressed : { |
| 31 | *(.rodata..compressed) |
| 32 | } |
| 33 | .text : { |
| 34 | _text = .; /* Text */ |
| 35 | *(.text) |
| 36 | *(.text.*) |
| 37 | *(.noinstr.text) |
| 38 | _etext = . ; |
| 39 | } |
| 40 | .rodata : { |
| 41 | _rodata = . ; |
| 42 | *(.rodata) /* read-only data */ |
| 43 | *(.rodata.*) |
| 44 | _erodata = . ; |
| 45 | } |
| 46 | #ifdef CONFIG_EFI_SBAT |
| 47 | .sbat : ALIGN(0x1000) { |
| 48 | _sbat = . ; |
| 49 | *(.sbat) |
| 50 | _esbat = ALIGN(0x1000); |
| 51 | . = _esbat; |
| 52 | } |
| 53 | #endif |
| 54 | .data : ALIGN(0x1000) { |
| 55 | _data = . ; |
| 56 | *(.data) |
| 57 | *(.data.*) |
| 58 | |
| 59 | /* Add 4 bytes of extra space for the obsolete CRC-32 checksum */ |
| 60 | . = ALIGN(. + 4, 0x200); |
| 61 | _edata = . ; |
| 62 | } |
| 63 | . = ALIGN(L1_CACHE_BYTES); |
| 64 | .bss : { |
| 65 | _bss = . ; |
| 66 | *(.bss) |
| 67 | *(.bss.*) |
| 68 | *(COMMON) |
| 69 | . = ALIGN(8); /* For convenience during zeroing */ |
| 70 | _ebss = .; |
| 71 | } |
| 72 | #ifdef CONFIG_X86_64 |
| 73 | . = ALIGN(PAGE_SIZE); |
| 74 | .pgtable : { |
| 75 | _pgtable = . ; |
| 76 | *(.pgtable) |
| 77 | _epgtable = . ; |
| 78 | } |
| 79 | #endif |
| 80 | . = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */ |
| 81 | _end = .; |
| 82 | |
| 83 | STABS_DEBUG |
| 84 | DWARF_DEBUG |
| 85 | ELF_DETAILS |
| 86 | |
| 87 | DISCARDS |
| 88 | /DISCARD/ : { |
| 89 | *(.dynamic) *(.dynsym) *(.dynstr) *(.dynbss) |
| 90 | *(.hash) *(.gnu.hash) |
| 91 | *(.note.*) |
| 92 | } |
| 93 | |
| 94 | .got.plt (INFO) : { |
| 95 | *(.got.plt) |
| 96 | } |
| 97 | ASSERT(SIZEOF(.got.plt) == 0 || |
| 98 | #ifdef CONFIG_X86_64 |
| 99 | SIZEOF(.got.plt) == 0x18, |
| 100 | #else |
| 101 | SIZEOF(.got.plt) == 0xc, |
| 102 | #endif |
| 103 | "Unexpected GOT/PLT entries detected!" ) |
| 104 | |
| 105 | /* |
| 106 | * Sections that should stay zero sized, which is safer to |
| 107 | * explicitly check instead of blindly discarding. |
| 108 | */ |
| 109 | .got : { |
| 110 | *(.got) |
| 111 | } |
| 112 | ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!" ) |
| 113 | |
| 114 | .plt : { |
| 115 | *(.plt) *(.plt.*) |
| 116 | } |
| 117 | ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!" ) |
| 118 | |
| 119 | .rel.dyn : { |
| 120 | *(.rel.*) *(.rel_*) |
| 121 | } |
| 122 | ASSERT(SIZEOF(.rel.dyn) == 0, "Unexpected run-time relocations (.rel) detected!" ) |
| 123 | |
| 124 | .rela.dyn : { |
| 125 | *(.rela.*) *(.rela_*) |
| 126 | } |
| 127 | ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!" ) |
| 128 | } |
| 129 | |