vmlinux.lds.S 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /* ld script to make x86-64 Linux kernel
  2. * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
  3. */
  4. #define LOAD_OFFSET __START_KERNEL_map
  5. #include <asm-generic/vmlinux.lds.h>
  6. #include <asm/page.h>
  7. #include <linux/config.h>
  8. #undef i386 /* in case the preprocessor is a 32bit one */
  9. OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
  10. OUTPUT_ARCH(i386:x86-64)
  11. ENTRY(phys_startup_64)
  12. jiffies_64 = jiffies;
  13. SECTIONS
  14. {
  15. . = __START_KERNEL;
  16. phys_startup_64 = startup_64 - LOAD_OFFSET;
  17. _text = .; /* Text and read-only data */
  18. .text : AT(ADDR(.text) - LOAD_OFFSET) {
  19. /* First the code that has to be first for bootstrapping */
  20. *(.bootstrap.text)
  21. /* Then all the functions that are "hot" in profiles, to group them
  22. onto the same hugetlb entry */
  23. #include "functionlist"
  24. /* Then the rest */
  25. *(.text)
  26. SCHED_TEXT
  27. LOCK_TEXT
  28. KPROBES_TEXT
  29. *(.fixup)
  30. *(.gnu.warning)
  31. } = 0x9090
  32. /* out-of-line lock text */
  33. .text.lock : AT(ADDR(.text.lock) - LOAD_OFFSET) { *(.text.lock) }
  34. _etext = .; /* End of text section */
  35. . = ALIGN(16); /* Exception table */
  36. __start___ex_table = .;
  37. __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
  38. __stop___ex_table = .;
  39. RODATA
  40. /* Data */
  41. .data : AT(ADDR(.data) - LOAD_OFFSET) {
  42. *(.data)
  43. CONSTRUCTORS
  44. }
  45. _edata = .; /* End of data section */
  46. __bss_start = .; /* BSS */
  47. .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
  48. *(.bss.page_aligned)
  49. *(.bss)
  50. }
  51. __bss_stop = .;
  52. . = ALIGN(PAGE_SIZE);
  53. . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
  54. .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
  55. *(.data.cacheline_aligned)
  56. }
  57. . = ALIGN(CONFIG_X86_INTERNODE_CACHE_BYTES);
  58. .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
  59. *(.data.read_mostly)
  60. }
  61. #define VSYSCALL_ADDR (-10*1024*1024)
  62. #define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
  63. #define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
  64. #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
  65. #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
  66. #define VVIRT_OFFSET (VSYSCALL_ADDR - VSYSCALL_VIRT_ADDR)
  67. #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
  68. . = VSYSCALL_ADDR;
  69. .vsyscall_0 : AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) }
  70. __vsyscall_0 = VSYSCALL_VIRT_ADDR;
  71. . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
  72. .xtime_lock : AT(VLOAD(.xtime_lock)) { *(.xtime_lock) }
  73. xtime_lock = VVIRT(.xtime_lock);
  74. .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) }
  75. vxtime = VVIRT(.vxtime);
  76. .wall_jiffies : AT(VLOAD(.wall_jiffies)) { *(.wall_jiffies) }
  77. wall_jiffies = VVIRT(.wall_jiffies);
  78. .sys_tz : AT(VLOAD(.sys_tz)) { *(.sys_tz) }
  79. sys_tz = VVIRT(.sys_tz);
  80. .sysctl_vsyscall : AT(VLOAD(.sysctl_vsyscall)) { *(.sysctl_vsyscall) }
  81. sysctl_vsyscall = VVIRT(.sysctl_vsyscall);
  82. .xtime : AT(VLOAD(.xtime)) { *(.xtime) }
  83. xtime = VVIRT(.xtime);
  84. . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
  85. .jiffies : AT(VLOAD(.jiffies)) { *(.jiffies) }
  86. jiffies = VVIRT(.jiffies);
  87. .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) { *(.vsyscall_1) }
  88. .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) { *(.vsyscall_2) }
  89. .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) { *(.vsyscall_3) }
  90. . = VSYSCALL_VIRT_ADDR + 4096;
  91. #undef VSYSCALL_ADDR
  92. #undef VSYSCALL_PHYS_ADDR
  93. #undef VSYSCALL_VIRT_ADDR
  94. #undef VLOAD_OFFSET
  95. #undef VLOAD
  96. #undef VVIRT_OFFSET
  97. #undef VVIRT
  98. . = ALIGN(8192); /* init_task */
  99. .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
  100. *(.data.init_task)
  101. }
  102. . = ALIGN(4096);
  103. .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
  104. *(.data.page_aligned)
  105. }
  106. /* might get freed after init */
  107. . = ALIGN(4096);
  108. __smp_alt_begin = .;
  109. __smp_alt_instructions = .;
  110. .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
  111. *(.smp_altinstructions)
  112. }
  113. __smp_alt_instructions_end = .;
  114. . = ALIGN(8);
  115. __smp_locks = .;
  116. .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
  117. *(.smp_locks)
  118. }
  119. __smp_locks_end = .;
  120. .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) {
  121. *(.smp_altinstr_replacement)
  122. }
  123. . = ALIGN(4096);
  124. __smp_alt_end = .;
  125. . = ALIGN(4096); /* Init code and data */
  126. __init_begin = .;
  127. .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
  128. _sinittext = .;
  129. *(.init.text)
  130. _einittext = .;
  131. }
  132. __initdata_begin = .;
  133. .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
  134. __initdata_end = .;
  135. . = ALIGN(16);
  136. __setup_start = .;
  137. .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
  138. __setup_end = .;
  139. __initcall_start = .;
  140. .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
  141. *(.initcall1.init)
  142. *(.initcall2.init)
  143. *(.initcall3.init)
  144. *(.initcall4.init)
  145. *(.initcall5.init)
  146. *(.initcall6.init)
  147. *(.initcall7.init)
  148. }
  149. __initcall_end = .;
  150. __con_initcall_start = .;
  151. .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
  152. *(.con_initcall.init)
  153. }
  154. __con_initcall_end = .;
  155. SECURITY_INIT
  156. . = ALIGN(8);
  157. __alt_instructions = .;
  158. .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
  159. *(.altinstructions)
  160. }
  161. __alt_instructions_end = .;
  162. .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
  163. *(.altinstr_replacement)
  164. }
  165. /* .exit.text is discard at runtime, not link time, to deal with references
  166. from .altinstructions and .eh_frame */
  167. .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
  168. .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
  169. . = ALIGN(4096);
  170. __initramfs_start = .;
  171. .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
  172. __initramfs_end = .;
  173. /* temporary here to work around NR_CPUS. If you see this comment in 2.6.17+
  174. complain */
  175. . = ALIGN(4096);
  176. __init_end = .;
  177. . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
  178. __per_cpu_start = .;
  179. .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) }
  180. __per_cpu_end = .;
  181. . = ALIGN(4096);
  182. __nosave_begin = .;
  183. .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
  184. . = ALIGN(4096);
  185. __nosave_end = .;
  186. _end = . ;
  187. /* Sections to be discarded */
  188. /DISCARD/ : {
  189. *(.exitcall.exit)
  190. #ifndef CONFIG_UNWIND_INFO
  191. *(.eh_frame)
  192. #endif
  193. }
  194. STABS_DEBUG
  195. DWARF_DEBUG
  196. }