vmlinux.lds.S 4.7 KB

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