vmlinux_64.lds.S 6.1 KB

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