vmlinux.lds.S 3.3 KB

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