vmlinux.lds.S 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* ld script to make s390 Linux kernel
  3. * Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
  4. */
  5. #include <asm/thread_info.h>
  6. #include <asm/page.h>
  7. /*
  8. * Put .bss..swapper_pg_dir as the first thing in .bss. This will
  9. * make sure it has 16k alignment.
  10. */
  11. #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir)
  12. /* Handle ro_after_init data on our own. */
  13. #define RO_AFTER_INIT_DATA
  14. #include <asm-generic/vmlinux.lds.h>
  15. OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
  16. OUTPUT_ARCH(s390:64-bit)
  17. ENTRY(startup)
  18. jiffies = jiffies_64;
  19. PHDRS {
  20. text PT_LOAD FLAGS(5); /* R_E */
  21. data PT_LOAD FLAGS(7); /* RWE */
  22. note PT_NOTE FLAGS(0); /* ___ */
  23. }
  24. SECTIONS
  25. {
  26. . = 0x00000000;
  27. .text : {
  28. /* Text and read-only data */
  29. HEAD_TEXT
  30. /*
  31. * E.g. perf doesn't like symbols starting at address zero,
  32. * therefore skip the initial PSW and channel program located
  33. * at address zero and let _text start at 0x200.
  34. */
  35. _text = 0x200;
  36. TEXT_TEXT
  37. SCHED_TEXT
  38. CPUIDLE_TEXT
  39. LOCK_TEXT
  40. KPROBES_TEXT
  41. IRQENTRY_TEXT
  42. SOFTIRQENTRY_TEXT
  43. *(.fixup)
  44. *(.gnu.warning)
  45. } :text = 0x0700
  46. . = ALIGN(PAGE_SIZE);
  47. _etext = .; /* End of text section */
  48. NOTES :text :note
  49. .dummy : { *(.dummy) } :data
  50. RO_DATA_SECTION(PAGE_SIZE)
  51. . = ALIGN(PAGE_SIZE);
  52. _sdata = .; /* Start of data section */
  53. . = ALIGN(PAGE_SIZE);
  54. __start_ro_after_init = .;
  55. .data..ro_after_init : {
  56. *(.data..ro_after_init)
  57. }
  58. EXCEPTION_TABLE(16)
  59. . = ALIGN(PAGE_SIZE);
  60. __end_ro_after_init = .;
  61. RW_DATA_SECTION(0x100, PAGE_SIZE, THREAD_SIZE)
  62. _edata = .; /* End of data section */
  63. /* will be freed after init */
  64. . = ALIGN(PAGE_SIZE); /* Init code and data */
  65. __init_begin = .;
  66. . = ALIGN(PAGE_SIZE);
  67. .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
  68. VMLINUX_SYMBOL(_sinittext) = . ;
  69. INIT_TEXT
  70. . = ALIGN(PAGE_SIZE);
  71. VMLINUX_SYMBOL(_einittext) = . ;
  72. }
  73. /*
  74. * .exit.text is discarded at runtime, not link time,
  75. * to deal with references from __bug_table
  76. */
  77. .exit.text : {
  78. EXIT_TEXT
  79. }
  80. .exit.data : {
  81. EXIT_DATA
  82. }
  83. /*
  84. * struct alt_inst entries. From the header (alternative.h):
  85. * "Alternative instructions for different CPU types or capabilities"
  86. * Think locking instructions on spinlocks.
  87. * Note, that it is a part of __init region.
  88. */
  89. . = ALIGN(8);
  90. .altinstructions : {
  91. __alt_instructions = .;
  92. *(.altinstructions)
  93. __alt_instructions_end = .;
  94. }
  95. /*
  96. * And here are the replacement instructions. The linker sticks
  97. * them as binary blobs. The .altinstructions has enough data to
  98. * get the address and the length of them to patch the kernel safely.
  99. * Note, that it is a part of __init region.
  100. */
  101. .altinstr_replacement : {
  102. *(.altinstr_replacement)
  103. }
  104. /*
  105. * Table with the patch locations to undo expolines
  106. */
  107. .nospec_call_table : {
  108. __nospec_call_start = . ;
  109. *(.s390_indirect*)
  110. __nospec_call_end = . ;
  111. }
  112. .nospec_return_table : {
  113. __nospec_return_start = . ;
  114. *(.s390_return*)
  115. __nospec_return_end = . ;
  116. }
  117. /* early.c uses stsi, which requires page aligned data. */
  118. . = ALIGN(PAGE_SIZE);
  119. INIT_DATA_SECTION(0x100)
  120. PERCPU_SECTION(0x100)
  121. . = ALIGN(PAGE_SIZE);
  122. __init_end = .; /* freed after init ends here */
  123. BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE)
  124. _end = . ;
  125. /* Debugging sections. */
  126. STABS_DEBUG
  127. DWARF_DEBUG
  128. /* Sections to be discarded */
  129. DISCARDS
  130. /DISCARD/ : {
  131. *(.eh_frame)
  132. }
  133. }