vmlinux.lds.S 4.7 KB

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