vmlinux.lds.S 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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_RELOCATABLE
  125. . = ALIGN(4);
  126. .data.reloc : {
  127. _relocation_start = .;
  128. /*
  129. * Space for relocation table
  130. * This needs to be filled so that the
  131. * relocs tool can overwrite the content.
  132. * An invalid value is left at the start of the
  133. * section to abort relocation if the table
  134. * has not been filled in.
  135. */
  136. LONG(0xFFFFFFFF);
  137. FILL(0);
  138. . += CONFIG_RELOCATION_TABLE_SIZE - 4;
  139. _relocation_end = .;
  140. }
  141. #endif
  142. #ifdef CONFIG_MIPS_RAW_APPENDED_DTB
  143. __appended_dtb = .;
  144. /* leave space for appended DTB */
  145. . += 0x100000;
  146. #elif defined(CONFIG_MIPS_ELF_APPENDED_DTB)
  147. .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
  148. *(.appended_dtb)
  149. KEEP(*(.appended_dtb))
  150. }
  151. #endif
  152. /*
  153. * Align to 64K in attempt to eliminate holes before the
  154. * .bss..swapper_pg_dir section at the start of .bss. This
  155. * also satisfies PAGE_SIZE alignment as the largest page size
  156. * allowed is 64K.
  157. */
  158. . = ALIGN(0x10000);
  159. __init_end = .;
  160. /* freed after init ends here */
  161. /*
  162. * Force .bss to 64K alignment so that .bss..swapper_pg_dir
  163. * gets that alignment. .sbss should be empty, so there will be
  164. * no holes after __init_end. */
  165. BSS_SECTION(0, 0x10000, 8)
  166. _end = . ;
  167. /* These mark the ABI of the kernel for debuggers. */
  168. .mdebug.abi32 : {
  169. KEEP(*(.mdebug.abi32))
  170. }
  171. .mdebug.abi64 : {
  172. KEEP(*(.mdebug.abi64))
  173. }
  174. /* This is the MIPS specific mdebug section. */
  175. .mdebug : {
  176. *(.mdebug)
  177. }
  178. STABS_DEBUG
  179. DWARF_DEBUG
  180. /* These must appear regardless of . */
  181. .gptab.sdata : {
  182. *(.gptab.data)
  183. *(.gptab.sdata)
  184. }
  185. .gptab.sbss : {
  186. *(.gptab.bss)
  187. *(.gptab.sbss)
  188. }
  189. /* Sections to be discarded */
  190. DISCARDS
  191. /DISCARD/ : {
  192. /* ABI crap starts here */
  193. *(.MIPS.abiflags)
  194. *(.MIPS.options)
  195. *(.options)
  196. *(.pdr)
  197. *(.reginfo)
  198. *(.eh_frame)
  199. }
  200. }