vmlinux.lds.S 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. . = VMLINUX_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. CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
  82. READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
  83. DATA_DATA
  84. CONSTRUCTORS
  85. }
  86. BUG_TABLE
  87. _gp = . + 0x8000;
  88. .lit8 : {
  89. *(.lit8)
  90. }
  91. .lit4 : {
  92. *(.lit4)
  93. }
  94. /* We want the small data sections together, so single-instruction offsets
  95. can access them all, and initialized data all before uninitialized, so
  96. we can shorten the on-disk segment size. */
  97. .sdata : {
  98. *(.sdata)
  99. }
  100. _edata = .; /* End of data section */
  101. /* will be freed after init */
  102. . = ALIGN(PAGE_SIZE); /* Init code and data */
  103. __init_begin = .;
  104. INIT_TEXT_SECTION(PAGE_SIZE)
  105. INIT_DATA_SECTION(16)
  106. . = ALIGN(4);
  107. .mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) {
  108. __mips_machines_start = .;
  109. *(.mips.machines.init)
  110. __mips_machines_end = .;
  111. }
  112. /* .exit.text is discarded at runtime, not link time, to deal with
  113. * references from .rodata
  114. */
  115. .exit.text : {
  116. EXIT_TEXT
  117. }
  118. .exit.data : {
  119. EXIT_DATA
  120. }
  121. #ifdef CONFIG_SMP
  122. PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
  123. #endif
  124. #ifdef CONFIG_MIPS_ELF_APPENDED_DTB
  125. .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
  126. *(.appended_dtb)
  127. KEEP(*(.appended_dtb))
  128. }
  129. #endif
  130. #ifdef CONFIG_RELOCATABLE
  131. . = ALIGN(4);
  132. .data.reloc : {
  133. _relocation_start = .;
  134. /*
  135. * Space for relocation table
  136. * This needs to be filled so that the
  137. * relocs tool can overwrite the content.
  138. * An invalid value is left at the start of the
  139. * section to abort relocation if the table
  140. * has not been filled in.
  141. */
  142. LONG(0xFFFFFFFF);
  143. FILL(0);
  144. . += CONFIG_RELOCATION_TABLE_SIZE - 4;
  145. _relocation_end = .;
  146. }
  147. #endif
  148. #ifdef CONFIG_MIPS_RAW_APPENDED_DTB
  149. __appended_dtb = .;
  150. /* leave space for appended DTB */
  151. . += 0x100000;
  152. #endif
  153. /*
  154. * Align to 64K in attempt to eliminate holes before the
  155. * .bss..swapper_pg_dir section at the start of .bss. This
  156. * also satisfies PAGE_SIZE alignment as the largest page size
  157. * allowed is 64K.
  158. */
  159. . = ALIGN(0x10000);
  160. __init_end = .;
  161. /* freed after init ends here */
  162. /*
  163. * Force .bss to 64K alignment so that .bss..swapper_pg_dir
  164. * gets that alignment. .sbss should be empty, so there will be
  165. * no holes after __init_end. */
  166. BSS_SECTION(0, 0x10000, 8)
  167. _end = . ;
  168. /* These mark the ABI of the kernel for debuggers. */
  169. .mdebug.abi32 : {
  170. KEEP(*(.mdebug.abi32))
  171. }
  172. .mdebug.abi64 : {
  173. KEEP(*(.mdebug.abi64))
  174. }
  175. /* This is the MIPS specific mdebug section. */
  176. .mdebug : {
  177. *(.mdebug)
  178. }
  179. STABS_DEBUG
  180. DWARF_DEBUG
  181. /* These must appear regardless of . */
  182. .gptab.sdata : {
  183. *(.gptab.data)
  184. *(.gptab.sdata)
  185. }
  186. .gptab.sbss : {
  187. *(.gptab.bss)
  188. *(.gptab.sbss)
  189. }
  190. /* Sections to be discarded */
  191. DISCARDS
  192. /DISCARD/ : {
  193. /* ABI crap starts here */
  194. *(.MIPS.abiflags)
  195. *(.MIPS.options)
  196. *(.options)
  197. *(.pdr)
  198. *(.reginfo)
  199. *(.eh_frame)
  200. }
  201. }