vmlinux_64.lds.S 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. SECTIONS
  2. {
  3. . = __START_KERNEL;
  4. phys_startup_64 = startup_64 - LOAD_OFFSET;
  5. /* Text and read-only data */
  6. .text : AT(ADDR(.text) - LOAD_OFFSET) {
  7. _text = .;
  8. /* First the code that has to be first for bootstrapping */
  9. *(.text.head)
  10. _stext = .;
  11. /* Then the rest */
  12. TEXT_TEXT
  13. SCHED_TEXT
  14. LOCK_TEXT
  15. KPROBES_TEXT
  16. IRQENTRY_TEXT
  17. *(.fixup)
  18. *(.gnu.warning)
  19. /* End of text section */
  20. _etext = .;
  21. } :text = 0x9090
  22. NOTES :text :note
  23. /* Exception table */
  24. . = ALIGN(16);
  25. __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
  26. __start___ex_table = .;
  27. *(__ex_table)
  28. __stop___ex_table = .;
  29. } :text = 0x9090
  30. RODATA
  31. /* Align data segment to page size boundary */
  32. . = ALIGN(PAGE_SIZE);
  33. /* Data */
  34. .data : AT(ADDR(.data) - LOAD_OFFSET) {
  35. DATA_DATA
  36. CONSTRUCTORS
  37. /* End of data section */
  38. _edata = .;
  39. } :data
  40. .data.cacheline_aligned :
  41. AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
  42. . = ALIGN(PAGE_SIZE);
  43. . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
  44. *(.data.cacheline_aligned)
  45. }
  46. . = ALIGN(CONFIG_X86_INTERNODE_CACHE_BYTES);
  47. .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
  48. *(.data.read_mostly)
  49. }
  50. #define VSYSCALL_ADDR (-10*1024*1024)
  51. #define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + \
  52. SIZEOF(.data.read_mostly) + 4095) & ~(4095))
  53. #define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + \
  54. SIZEOF(.data.read_mostly) + 4095) & ~(4095))
  55. #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
  56. #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
  57. #define VVIRT_OFFSET (VSYSCALL_ADDR - VSYSCALL_VIRT_ADDR)
  58. #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
  59. . = VSYSCALL_ADDR;
  60. .vsyscall_0 : AT(VSYSCALL_PHYS_ADDR) {
  61. *(.vsyscall_0)
  62. } :user
  63. __vsyscall_0 = VSYSCALL_VIRT_ADDR;
  64. . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
  65. .vsyscall_fn : AT(VLOAD(.vsyscall_fn)) {
  66. *(.vsyscall_fn)
  67. }
  68. . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
  69. .vsyscall_gtod_data : AT(VLOAD(.vsyscall_gtod_data)) {
  70. *(.vsyscall_gtod_data)
  71. }
  72. vsyscall_gtod_data = VVIRT(.vsyscall_gtod_data);
  73. .vsyscall_clock : AT(VLOAD(.vsyscall_clock)) {
  74. *(.vsyscall_clock)
  75. }
  76. vsyscall_clock = VVIRT(.vsyscall_clock);
  77. .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) {
  78. *(.vsyscall_1)
  79. }
  80. .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) {
  81. *(.vsyscall_2)
  82. }
  83. .vgetcpu_mode : AT(VLOAD(.vgetcpu_mode)) {
  84. *(.vgetcpu_mode)
  85. }
  86. vgetcpu_mode = VVIRT(.vgetcpu_mode);
  87. . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
  88. .jiffies : AT(VLOAD(.jiffies)) {
  89. *(.jiffies)
  90. }
  91. jiffies = VVIRT(.jiffies);
  92. .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) {
  93. *(.vsyscall_3)
  94. }
  95. . = VSYSCALL_VIRT_ADDR + PAGE_SIZE;
  96. #undef VSYSCALL_ADDR
  97. #undef VSYSCALL_PHYS_ADDR
  98. #undef VSYSCALL_VIRT_ADDR
  99. #undef VLOAD_OFFSET
  100. #undef VLOAD
  101. #undef VVIRT_OFFSET
  102. #undef VVIRT
  103. /* init_task */
  104. .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
  105. . = ALIGN(THREAD_SIZE);
  106. *(.data.init_task)
  107. } :data.init
  108. .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
  109. . = ALIGN(PAGE_SIZE);
  110. *(.data.page_aligned)
  111. }
  112. .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
  113. /* might get freed after init */
  114. . = ALIGN(PAGE_SIZE);
  115. __smp_alt_begin = .;
  116. __smp_locks = .;
  117. *(.smp_locks)
  118. __smp_locks_end = .;
  119. . = ALIGN(PAGE_SIZE);
  120. __smp_alt_end = .;
  121. }
  122. /* Init code and data */
  123. . = ALIGN(PAGE_SIZE);
  124. __init_begin = .; /* paired with __init_end */
  125. .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
  126. _sinittext = .;
  127. INIT_TEXT
  128. _einittext = .;
  129. }
  130. .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
  131. __initdata_begin = .;
  132. INIT_DATA
  133. __initdata_end = .;
  134. }
  135. .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
  136. . = ALIGN(16);
  137. __setup_start = .;
  138. *(.init.setup)
  139. __setup_end = .;
  140. }
  141. .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
  142. __initcall_start = .;
  143. INITCALLS
  144. __initcall_end = .;
  145. }
  146. .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
  147. __con_initcall_start = .;
  148. *(.con_initcall.init)
  149. __con_initcall_end = .;
  150. }
  151. .x86_cpu_dev.init : AT(ADDR(.x86_cpu_dev.init) - LOAD_OFFSET) {
  152. __x86_cpu_dev_start = .;
  153. *(.x86_cpu_dev.init)
  154. __x86_cpu_dev_end = .;
  155. }
  156. SECURITY_INIT
  157. . = ALIGN(8);
  158. .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
  159. __parainstructions = .;
  160. *(.parainstructions)
  161. __parainstructions_end = .;
  162. }
  163. .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
  164. . = ALIGN(8);
  165. __alt_instructions = .;
  166. *(.altinstructions)
  167. __alt_instructions_end = .;
  168. }
  169. .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
  170. *(.altinstr_replacement)
  171. }
  172. /*
  173. * .exit.text is discard at runtime, not link time, to deal with
  174. * references from .altinstructions and .eh_frame
  175. */
  176. .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
  177. EXIT_TEXT
  178. }
  179. .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
  180. EXIT_DATA
  181. }
  182. #ifdef CONFIG_BLK_DEV_INITRD
  183. . = ALIGN(PAGE_SIZE);
  184. .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
  185. __initramfs_start = .;
  186. *(.init.ramfs)
  187. __initramfs_end = .;
  188. }
  189. #endif
  190. #ifdef CONFIG_SMP
  191. /*
  192. * percpu offsets are zero-based on SMP. PERCPU_VADDR() changes the
  193. * output PHDR, so the next output section - __data_nosave - should
  194. * start another section data.init2. Also, pda should be at the head of
  195. * percpu area. Preallocate it and define the percpu offset symbol
  196. * so that it can be accessed as a percpu variable.
  197. */
  198. . = ALIGN(PAGE_SIZE);
  199. PERCPU_VADDR(0, :percpu)
  200. #else
  201. PERCPU(PAGE_SIZE)
  202. #endif
  203. . = ALIGN(PAGE_SIZE);
  204. __init_end = .;
  205. .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
  206. . = ALIGN(PAGE_SIZE);
  207. __nosave_begin = .;
  208. *(.data.nosave)
  209. . = ALIGN(PAGE_SIZE);
  210. __nosave_end = .;
  211. } :data.init2
  212. /* use another section data.init2, see PERCPU_VADDR() above */
  213. .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
  214. . = ALIGN(PAGE_SIZE);
  215. __bss_start = .; /* BSS */
  216. *(.bss.page_aligned)
  217. *(.bss)
  218. __bss_stop = .;
  219. }
  220. .brk : AT(ADDR(.brk) - LOAD_OFFSET) {
  221. . = ALIGN(PAGE_SIZE);
  222. __brk_base = .;
  223. . += 64 * 1024; /* 64k alignment slop space */
  224. *(.brk_reservation) /* areas brk users have reserved */
  225. __brk_limit = .;
  226. }
  227. _end = . ;
  228. /* Sections to be discarded */
  229. /DISCARD/ : {
  230. *(.exitcall.exit)
  231. *(.eh_frame)
  232. *(.discard)
  233. }
  234. STABS_DEBUG
  235. DWARF_DEBUG
  236. }