vmlinux.lds.S 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /* ld script to make i386 Linux kernel
  2. * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
  3. *
  4. * Don't define absolute symbols until and unless you know that symbol
  5. * value is should remain constant even if kernel image is relocated
  6. * at run time. Absolute symbols are not relocated. If symbol value should
  7. * change if kernel is relocated, make the symbol section relative and
  8. * put it inside the section definition.
  9. */
  10. /* Don't define absolute symbols until and unless you know that symbol
  11. * value is should remain constant even if kernel image is relocated
  12. * at run time. Absolute symbols are not relocated. If symbol value should
  13. * change if kernel is relocated, make the symbol section relative and
  14. * put it inside the section definition.
  15. */
  16. #define LOAD_OFFSET __PAGE_OFFSET
  17. #include <asm-generic/vmlinux.lds.h>
  18. #include <asm/thread_info.h>
  19. #include <asm/page.h>
  20. #include <asm/cache.h>
  21. #include <asm/boot.h>
  22. OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
  23. OUTPUT_ARCH(i386)
  24. ENTRY(phys_startup_32)
  25. jiffies = jiffies_64;
  26. _proxy_pda = 0;
  27. PHDRS {
  28. text PT_LOAD FLAGS(5); /* R_E */
  29. data PT_LOAD FLAGS(7); /* RWE */
  30. note PT_NOTE FLAGS(4); /* R__ */
  31. }
  32. SECTIONS
  33. {
  34. . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
  35. phys_startup_32 = startup_32 - LOAD_OFFSET;
  36. .text.head : AT(ADDR(.text.head) - LOAD_OFFSET) {
  37. _text = .; /* Text and read-only data */
  38. *(.text.head)
  39. } :text = 0x9090
  40. /* read-only */
  41. .text : AT(ADDR(.text) - LOAD_OFFSET) {
  42. *(.text)
  43. SCHED_TEXT
  44. LOCK_TEXT
  45. KPROBES_TEXT
  46. *(.fixup)
  47. *(.gnu.warning)
  48. _etext = .; /* End of text section */
  49. } :text = 0x9090
  50. . = ALIGN(16); /* Exception table */
  51. __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
  52. __start___ex_table = .;
  53. *(__ex_table)
  54. __stop___ex_table = .;
  55. }
  56. RODATA
  57. BUG_TABLE
  58. . = ALIGN(4);
  59. .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
  60. __tracedata_start = .;
  61. *(.tracedata)
  62. __tracedata_end = .;
  63. }
  64. /* writeable */
  65. . = ALIGN(4096);
  66. .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
  67. *(.data)
  68. CONSTRUCTORS
  69. } :data
  70. .paravirtprobe : AT(ADDR(.paravirtprobe) - LOAD_OFFSET) {
  71. __start_paravirtprobe = .;
  72. *(.paravirtprobe)
  73. __stop_paravirtprobe = .;
  74. }
  75. . = ALIGN(4096);
  76. .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
  77. __nosave_begin = .;
  78. *(.data.nosave)
  79. . = ALIGN(4096);
  80. __nosave_end = .;
  81. }
  82. . = ALIGN(4096);
  83. .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
  84. *(.data.idt)
  85. }
  86. . = ALIGN(32);
  87. .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
  88. *(.data.cacheline_aligned)
  89. }
  90. /* rarely changed data like cpu maps */
  91. . = ALIGN(32);
  92. .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
  93. *(.data.read_mostly)
  94. _edata = .; /* End of data section */
  95. }
  96. . = ALIGN(THREAD_SIZE); /* init_task */
  97. .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
  98. *(.data.init_task)
  99. }
  100. /* might get freed after init */
  101. . = ALIGN(4096);
  102. .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
  103. __smp_alt_begin = .;
  104. __smp_alt_instructions = .;
  105. *(.smp_altinstructions)
  106. __smp_alt_instructions_end = .;
  107. }
  108. . = ALIGN(4);
  109. .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
  110. __smp_locks = .;
  111. *(.smp_locks)
  112. __smp_locks_end = .;
  113. }
  114. .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) {
  115. *(.smp_altinstr_replacement)
  116. __smp_alt_end = .;
  117. }
  118. /* will be freed after init
  119. * Following ALIGN() is required to make sure no other data falls on the
  120. * same page where __smp_alt_end is pointing as that page might be freed
  121. * after boot. Always make sure that ALIGN() directive is present after
  122. * the section which contains __smp_alt_end.
  123. */
  124. . = ALIGN(4096);
  125. /* will be freed after init */
  126. . = ALIGN(4096); /* Init code and data */
  127. .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
  128. __init_begin = .;
  129. _sinittext = .;
  130. *(.init.text)
  131. _einittext = .;
  132. }
  133. .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
  134. . = ALIGN(16);
  135. .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
  136. __setup_start = .;
  137. *(.init.setup)
  138. __setup_end = .;
  139. }
  140. .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
  141. __initcall_start = .;
  142. INITCALLS
  143. __initcall_end = .;
  144. }
  145. .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
  146. __con_initcall_start = .;
  147. *(.con_initcall.init)
  148. __con_initcall_end = .;
  149. }
  150. SECURITY_INIT
  151. . = ALIGN(4);
  152. .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
  153. __alt_instructions = .;
  154. *(.altinstructions)
  155. __alt_instructions_end = .;
  156. }
  157. .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
  158. *(.altinstr_replacement)
  159. }
  160. . = ALIGN(4);
  161. .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
  162. __start_parainstructions = .;
  163. *(.parainstructions)
  164. __stop_parainstructions = .;
  165. }
  166. /* .exit.text is discard at runtime, not link time, to deal with references
  167. from .altinstructions and .eh_frame */
  168. .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
  169. .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
  170. #if defined(CONFIG_BLK_DEV_INITRD)
  171. . = ALIGN(4096);
  172. .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
  173. __initramfs_start = .;
  174. *(.init.ramfs)
  175. __initramfs_end = .;
  176. }
  177. #endif
  178. . = ALIGN(L1_CACHE_BYTES);
  179. .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
  180. __per_cpu_start = .;
  181. *(.data.percpu)
  182. __per_cpu_end = .;
  183. }
  184. . = ALIGN(4096);
  185. /* freed after init ends here */
  186. .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
  187. __init_end = .;
  188. __bss_start = .; /* BSS */
  189. *(.bss.page_aligned)
  190. *(.bss)
  191. . = ALIGN(4);
  192. __bss_stop = .;
  193. _end = . ;
  194. /* This is where the kernel creates the early boot page tables */
  195. . = ALIGN(4096);
  196. pg0 = . ;
  197. }
  198. /* Sections to be discarded */
  199. /DISCARD/ : {
  200. *(.exitcall.exit)
  201. }
  202. STABS_DEBUG
  203. DWARF_DEBUG
  204. NOTES
  205. }