vmlinux.lds.S 5.3 KB

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