vmlinux_32.lds.S 5.0 KB

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