vmlinux.lds.S 5.6 KB

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