vmlinux.lds.S 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #include <asm/asm-offsets.h>
  3. #include <asm/thread_info.h>
  4. #define PAGE_SIZE _PAGE_SIZE
  5. /*
  6. * Put .bss..swapper_pg_dir as the first thing in .bss. This will
  7. * ensure that it has .bss alignment (64K).
  8. */
  9. #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir)
  10. #include <asm-generic/vmlinux.lds.h>
  11. #undef mips
  12. #define mips mips
  13. OUTPUT_ARCH(mips)
  14. ENTRY(kernel_entry)
  15. PHDRS {
  16. text PT_LOAD FLAGS(7); /* RWX */
  17. #ifndef CONFIG_CAVIUM_OCTEON_SOC
  18. note PT_NOTE FLAGS(4); /* R__ */
  19. #endif /* CAVIUM_OCTEON_SOC */
  20. }
  21. #ifdef CONFIG_32BIT
  22. #ifdef CONFIG_CPU_LITTLE_ENDIAN
  23. jiffies = jiffies_64;
  24. #else
  25. jiffies = jiffies_64 + 4;
  26. #endif
  27. #else
  28. jiffies = jiffies_64;
  29. #endif
  30. SECTIONS
  31. {
  32. #ifdef CONFIG_BOOT_ELF64
  33. /* Read-only sections, merged into text segment: */
  34. /* . = 0xc000000000000000; */
  35. /* This is the value for an Origin kernel, taken from an IRIX kernel. */
  36. /* . = 0xc00000000001c000; */
  37. /* Set the vaddr for the text segment to a value
  38. * >= 0xa800 0000 0001 9000 if no symmon is going to configured
  39. * >= 0xa800 0000 0030 0000 otherwise
  40. */
  41. /* . = 0xa800000000300000; */
  42. . = 0xffffffff80300000;
  43. #endif
  44. . = LINKER_LOAD_ADDRESS;
  45. /* read-only */
  46. _text = .; /* Text and read-only data */
  47. .text : {
  48. TEXT_TEXT
  49. SCHED_TEXT
  50. CPUIDLE_TEXT
  51. LOCK_TEXT
  52. KPROBES_TEXT
  53. IRQENTRY_TEXT
  54. SOFTIRQENTRY_TEXT
  55. *(.text.*)
  56. *(.fixup)
  57. *(.gnu.warning)
  58. } :text = 0
  59. _etext = .; /* End of text section */
  60. EXCEPTION_TABLE(16)
  61. /* Exception table for data bus errors */
  62. __dbe_table : {
  63. __start___dbe_table = .;
  64. *(__dbe_table)
  65. __stop___dbe_table = .;
  66. }
  67. #ifdef CONFIG_CAVIUM_OCTEON_SOC
  68. #define NOTES_HEADER
  69. #else /* CONFIG_CAVIUM_OCTEON_SOC */
  70. #define NOTES_HEADER :note
  71. #endif /* CONFIG_CAVIUM_OCTEON_SOC */
  72. NOTES :text NOTES_HEADER
  73. .dummy : { *(.dummy) } :text
  74. _sdata = .; /* Start of data section */
  75. RODATA
  76. /* writeable */
  77. .data : { /* Data */
  78. . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */
  79. INIT_TASK_DATA(THREAD_SIZE)
  80. NOSAVE_DATA
  81. PAGE_ALIGNED_DATA(PAGE_SIZE)
  82. CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
  83. READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
  84. DATA_DATA
  85. CONSTRUCTORS
  86. }
  87. BUG_TABLE
  88. _gp = . + 0x8000;
  89. .lit8 : {
  90. *(.lit8)
  91. }
  92. .lit4 : {
  93. *(.lit4)
  94. }
  95. /* We want the small data sections together, so single-instruction offsets
  96. can access them all, and initialized data all before uninitialized, so
  97. we can shorten the on-disk segment size. */
  98. .sdata : {
  99. *(.sdata)
  100. }
  101. _edata = .; /* End of data section */
  102. /* will be freed after init */
  103. . = ALIGN(PAGE_SIZE); /* Init code and data */
  104. __init_begin = .;
  105. INIT_TEXT_SECTION(PAGE_SIZE)
  106. INIT_DATA_SECTION(16)
  107. . = ALIGN(4);
  108. .mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) {
  109. __mips_machines_start = .;
  110. *(.mips.machines.init)
  111. __mips_machines_end = .;
  112. }
  113. /* .exit.text is discarded at runtime, not link time, to deal with
  114. * references from .rodata
  115. */
  116. .exit.text : {
  117. EXIT_TEXT
  118. }
  119. .exit.data : {
  120. EXIT_DATA
  121. }
  122. #ifdef CONFIG_SMP
  123. PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
  124. #endif
  125. #ifdef CONFIG_MIPS_ELF_APPENDED_DTB
  126. .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
  127. *(.appended_dtb)
  128. KEEP(*(.appended_dtb))
  129. }
  130. #endif
  131. #ifdef CONFIG_RELOCATABLE
  132. . = ALIGN(4);
  133. .data.reloc : {
  134. _relocation_start = .;
  135. /*
  136. * Space for relocation table
  137. * This needs to be filled so that the
  138. * relocs tool can overwrite the content.
  139. * An invalid value is left at the start of the
  140. * section to abort relocation if the table
  141. * has not been filled in.
  142. */
  143. LONG(0xFFFFFFFF);
  144. FILL(0);
  145. . += CONFIG_RELOCATION_TABLE_SIZE - 4;
  146. _relocation_end = .;
  147. }
  148. #endif
  149. #ifdef CONFIG_MIPS_RAW_APPENDED_DTB
  150. __appended_dtb = .;
  151. /* leave space for appended DTB */
  152. . += 0x100000;
  153. #endif
  154. /*
  155. * Align to 64K in attempt to eliminate holes before the
  156. * .bss..swapper_pg_dir section at the start of .bss. This
  157. * also satisfies PAGE_SIZE alignment as the largest page size
  158. * allowed is 64K.
  159. */
  160. . = ALIGN(0x10000);
  161. __init_end = .;
  162. /* freed after init ends here */
  163. /*
  164. * Force .bss to 64K alignment so that .bss..swapper_pg_dir
  165. * gets that alignment. .sbss should be empty, so there will be
  166. * no holes after __init_end. */
  167. BSS_SECTION(0, 0x10000, 8)
  168. _end = . ;
  169. /* These mark the ABI of the kernel for debuggers. */
  170. .mdebug.abi32 : {
  171. KEEP(*(.mdebug.abi32))
  172. }
  173. .mdebug.abi64 : {
  174. KEEP(*(.mdebug.abi64))
  175. }
  176. /* This is the MIPS specific mdebug section. */
  177. .mdebug : {
  178. *(.mdebug)
  179. }
  180. STABS_DEBUG
  181. DWARF_DEBUG
  182. /* These must appear regardless of . */
  183. .gptab.sdata : {
  184. *(.gptab.data)
  185. *(.gptab.sdata)
  186. }
  187. .gptab.sbss : {
  188. *(.gptab.bss)
  189. *(.gptab.sbss)
  190. }
  191. /* Sections to be discarded */
  192. DISCARDS
  193. /DISCARD/ : {
  194. /* ABI crap starts here */
  195. *(.MIPS.abiflags)
  196. *(.MIPS.options)
  197. *(.options)
  198. *(.pdr)
  199. *(.reginfo)
  200. *(.eh_frame)
  201. }
  202. }