vmlinux.lds.S 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. /* read-only */
  37. .text : AT(ADDR(.text) - LOAD_OFFSET) {
  38. _text = .; /* Text and read-only data */
  39. *(.text)
  40. SCHED_TEXT
  41. LOCK_TEXT
  42. KPROBES_TEXT
  43. *(.fixup)
  44. *(.gnu.warning)
  45. _etext = .; /* End of text section */
  46. } :text = 0x9090
  47. . = ALIGN(16); /* Exception table */
  48. __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
  49. __start___ex_table = .;
  50. *(__ex_table)
  51. __stop___ex_table = .;
  52. }
  53. RODATA
  54. BUG_TABLE
  55. . = ALIGN(4);
  56. .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
  57. __tracedata_start = .;
  58. *(.tracedata)
  59. __tracedata_end = .;
  60. }
  61. /* writeable */
  62. . = ALIGN(4096);
  63. .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
  64. *(.data)
  65. CONSTRUCTORS
  66. } :data
  67. .paravirtprobe : AT(ADDR(.paravirtprobe) - LOAD_OFFSET) {
  68. __start_paravirtprobe = .;
  69. *(.paravirtprobe)
  70. __stop_paravirtprobe = .;
  71. }
  72. . = ALIGN(4096);
  73. .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
  74. __nosave_begin = .;
  75. *(.data.nosave)
  76. . = ALIGN(4096);
  77. __nosave_end = .;
  78. }
  79. . = ALIGN(4096);
  80. .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
  81. *(.data.idt)
  82. }
  83. . = ALIGN(32);
  84. .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
  85. *(.data.cacheline_aligned)
  86. }
  87. /* rarely changed data like cpu maps */
  88. . = ALIGN(32);
  89. .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
  90. *(.data.read_mostly)
  91. _edata = .; /* End of data section */
  92. }
  93. . = ALIGN(THREAD_SIZE); /* init_task */
  94. .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
  95. *(.data.init_task)
  96. }
  97. /* might get freed after init */
  98. . = ALIGN(4096);
  99. .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
  100. __smp_alt_begin = .;
  101. __smp_alt_instructions = .;
  102. *(.smp_altinstructions)
  103. __smp_alt_instructions_end = .;
  104. }
  105. . = ALIGN(4);
  106. .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
  107. __smp_locks = .;
  108. *(.smp_locks)
  109. __smp_locks_end = .;
  110. }
  111. .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) {
  112. *(.smp_altinstr_replacement)
  113. __smp_alt_end = .;
  114. }
  115. /* will be freed after init
  116. * Following ALIGN() is required to make sure no other data falls on the
  117. * same page where __smp_alt_end is pointing as that page might be freed
  118. * after boot. Always make sure that ALIGN() directive is present after
  119. * the section which contains __smp_alt_end.
  120. */
  121. . = ALIGN(4096);
  122. /* will be freed after init */
  123. . = ALIGN(4096); /* Init code and data */
  124. .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
  125. __init_begin = .;
  126. _sinittext = .;
  127. *(.init.text)
  128. _einittext = .;
  129. }
  130. .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
  131. . = ALIGN(16);
  132. .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
  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. SECURITY_INIT
  148. . = ALIGN(4);
  149. .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
  150. __alt_instructions = .;
  151. *(.altinstructions)
  152. __alt_instructions_end = .;
  153. }
  154. .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
  155. *(.altinstr_replacement)
  156. }
  157. . = ALIGN(4);
  158. .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
  159. __start_parainstructions = .;
  160. *(.parainstructions)
  161. __stop_parainstructions = .;
  162. }
  163. /* .exit.text is discard at runtime, not link time, to deal with references
  164. from .altinstructions and .eh_frame */
  165. .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
  166. .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
  167. #if defined(CONFIG_BLK_DEV_INITRD)
  168. . = ALIGN(4096);
  169. .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
  170. __initramfs_start = .;
  171. *(.init.ramfs)
  172. __initramfs_end = .;
  173. }
  174. #endif
  175. . = ALIGN(L1_CACHE_BYTES);
  176. .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
  177. __per_cpu_start = .;
  178. *(.data.percpu)
  179. __per_cpu_end = .;
  180. }
  181. . = ALIGN(4096);
  182. /* freed after init ends here */
  183. .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
  184. __init_end = .;
  185. __bss_start = .; /* BSS */
  186. *(.bss.page_aligned)
  187. *(.bss)
  188. . = ALIGN(4);
  189. __bss_stop = .;
  190. _end = . ;
  191. /* This is where the kernel creates the early boot page tables */
  192. . = ALIGN(4096);
  193. pg0 = . ;
  194. }
  195. /* Sections to be discarded */
  196. /DISCARD/ : {
  197. *(.exitcall.exit)
  198. }
  199. STABS_DEBUG
  200. DWARF_DEBUG
  201. NOTES
  202. }