vmlinux.lds.S 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* ld script to make s390 Linux kernel
  3. * Written by Martin Schwidefsky ([email protected])
  4. */
  5. #include <asm/thread_info.h>
  6. #include <asm/page.h>
  7. #include <asm/ftrace.lds.h>
  8. /*
  9. * Put .bss..swapper_pg_dir as the first thing in .bss. This will
  10. * make sure it has 16k alignment.
  11. */
  12. #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir) \
  13. *(.bss..invalid_pg_dir)
  14. /* Handle ro_after_init data on our own. */
  15. #define RO_AFTER_INIT_DATA
  16. #define RUNTIME_DISCARD_EXIT
  17. #define EMITS_PT_NOTE
  18. #include <asm-generic/vmlinux.lds.h>
  19. #include <asm/vmlinux.lds.h>
  20. OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
  21. OUTPUT_ARCH(s390:64-bit)
  22. ENTRY(startup_continue)
  23. jiffies = jiffies_64;
  24. PHDRS {
  25. text PT_LOAD FLAGS(5); /* R_E */
  26. data PT_LOAD FLAGS(7); /* RWE */
  27. note PT_NOTE FLAGS(0); /* ___ */
  28. }
  29. SECTIONS
  30. {
  31. . = 0x100000;
  32. .text : {
  33. _stext = .; /* Start of text section */
  34. _text = .; /* Text and read-only data */
  35. HEAD_TEXT
  36. TEXT_TEXT
  37. SCHED_TEXT
  38. CPUIDLE_TEXT
  39. LOCK_TEXT
  40. KPROBES_TEXT
  41. IRQENTRY_TEXT
  42. SOFTIRQENTRY_TEXT
  43. FTRACE_HOTPATCH_TRAMPOLINES_TEXT
  44. *(.text.*_indirect_*)
  45. *(.gnu.warning)
  46. . = ALIGN(PAGE_SIZE);
  47. _etext = .; /* End of text section */
  48. } :text = 0x0700
  49. RO_DATA(PAGE_SIZE)
  50. . = ALIGN(PAGE_SIZE);
  51. _sdata = .; /* Start of data section */
  52. . = ALIGN(PAGE_SIZE);
  53. __start_ro_after_init = .;
  54. .data..ro_after_init : {
  55. *(.data..ro_after_init)
  56. JUMP_TABLE_DATA
  57. } :data
  58. EXCEPTION_TABLE(16)
  59. . = ALIGN(PAGE_SIZE);
  60. __end_ro_after_init = .;
  61. RW_DATA(0x100, PAGE_SIZE, THREAD_SIZE)
  62. BOOT_DATA_PRESERVED
  63. . = ALIGN(8);
  64. .amode31.refs : {
  65. _start_amode31_refs = .;
  66. *(.amode31.refs)
  67. _end_amode31_refs = .;
  68. }
  69. . = ALIGN(PAGE_SIZE);
  70. _edata = .; /* End of data section */
  71. /* will be freed after init */
  72. . = ALIGN(PAGE_SIZE); /* Init code and data */
  73. __init_begin = .;
  74. . = ALIGN(PAGE_SIZE);
  75. .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
  76. _sinittext = .;
  77. INIT_TEXT
  78. . = ALIGN(PAGE_SIZE);
  79. _einittext = .;
  80. }
  81. /*
  82. * .exit.text is discarded at runtime, not link time,
  83. * to deal with references from __bug_table
  84. */
  85. .exit.text : {
  86. EXIT_TEXT
  87. }
  88. .exit.data : {
  89. EXIT_DATA
  90. }
  91. /*
  92. * struct alt_inst entries. From the header (alternative.h):
  93. * "Alternative instructions for different CPU types or capabilities"
  94. * Think locking instructions on spinlocks.
  95. * Note, that it is a part of __init region.
  96. */
  97. . = ALIGN(8);
  98. .altinstructions : {
  99. __alt_instructions = .;
  100. *(.altinstructions)
  101. __alt_instructions_end = .;
  102. }
  103. /*
  104. * And here are the replacement instructions. The linker sticks
  105. * them as binary blobs. The .altinstructions has enough data to
  106. * get the address and the length of them to patch the kernel safely.
  107. * Note, that it is a part of __init region.
  108. */
  109. .altinstr_replacement : {
  110. *(.altinstr_replacement)
  111. }
  112. /*
  113. * Table with the patch locations to undo expolines
  114. */
  115. . = ALIGN(4);
  116. .nospec_call_table : {
  117. __nospec_call_start = . ;
  118. *(.s390_indirect*)
  119. __nospec_call_end = . ;
  120. }
  121. .nospec_return_table : {
  122. __nospec_return_start = . ;
  123. *(.s390_return*)
  124. __nospec_return_end = . ;
  125. }
  126. BOOT_DATA
  127. /*
  128. * .amode31 section for code, data, ex_table that need to stay
  129. * below 2 GB, even when the kernel is relocated above 2 GB.
  130. */
  131. . = ALIGN(PAGE_SIZE);
  132. _samode31 = .;
  133. .amode31.text : {
  134. _stext_amode31 = .;
  135. *(.amode31.text)
  136. *(.amode31.text.*_indirect_*)
  137. . = ALIGN(PAGE_SIZE);
  138. _etext_amode31 = .;
  139. }
  140. . = ALIGN(16);
  141. .amode31.ex_table : {
  142. _start_amode31_ex_table = .;
  143. KEEP(*(.amode31.ex_table))
  144. _stop_amode31_ex_table = .;
  145. }
  146. . = ALIGN(PAGE_SIZE);
  147. .amode31.data : {
  148. *(.amode31.data)
  149. }
  150. . = ALIGN(PAGE_SIZE);
  151. _eamode31 = .;
  152. /* early.c uses stsi, which requires page aligned data. */
  153. . = ALIGN(PAGE_SIZE);
  154. INIT_DATA_SECTION(0x100)
  155. PERCPU_SECTION(0x100)
  156. .dynsym ALIGN(8) : {
  157. __dynsym_start = .;
  158. *(.dynsym)
  159. __dynsym_end = .;
  160. }
  161. .rela.dyn ALIGN(8) : {
  162. __rela_dyn_start = .;
  163. *(.rela*)
  164. __rela_dyn_end = .;
  165. }
  166. . = ALIGN(PAGE_SIZE);
  167. __init_end = .; /* freed after init ends here */
  168. BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE)
  169. . = ALIGN(PAGE_SIZE);
  170. _end = . ;
  171. /*
  172. * uncompressed image info used by the decompressor
  173. * it should match struct vmlinux_info
  174. */
  175. .vmlinux.info 0 (INFO) : {
  176. QUAD(_stext) /* default_lma */
  177. QUAD(startup_continue) /* entry */
  178. QUAD(__bss_start - _stext) /* image_size */
  179. QUAD(__bss_stop - __bss_start) /* bss_size */
  180. QUAD(__boot_data_start) /* bootdata_off */
  181. QUAD(__boot_data_end - __boot_data_start) /* bootdata_size */
  182. QUAD(__boot_data_preserved_start) /* bootdata_preserved_off */
  183. QUAD(__boot_data_preserved_end -
  184. __boot_data_preserved_start) /* bootdata_preserved_size */
  185. QUAD(__dynsym_start) /* dynsym_start */
  186. QUAD(__rela_dyn_start) /* rela_dyn_start */
  187. QUAD(__rela_dyn_end) /* rela_dyn_end */
  188. QUAD(_eamode31 - _samode31) /* amode31_size */
  189. } :NONE
  190. /* Debugging sections. */
  191. STABS_DEBUG
  192. DWARF_DEBUG
  193. ELF_DETAILS
  194. /* Sections to be discarded */
  195. DISCARDS
  196. /DISCARD/ : {
  197. *(.eh_frame)
  198. *(.interp)
  199. }
  200. }