kernel.ld 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. OUTPUT_FORMAT(elf32-i386)
  2. OUTPUT_ARCH(i386:i386)
  3. MEMORY
  4. {
  5. MEM : org = 0x00000000, l = 4096M
  6. }
  7. SECTIONS
  8. {
  9. .stage1 0x8000 : AT(0x00000000)
  10. {
  11. __stage1_start = .;
  12. *(.stage1)
  13. . = ALIGN(0x1000);
  14. __stage1_end = .;
  15. } > MEM
  16. .kinit :
  17. AT(LOADADDR(.stage1) + SIZEOF(.stage1))
  18. {
  19. __kinit_start = .;
  20. *(.text.kinit)
  21. LONG(0x00000000)
  22. LONG(0x19191919)
  23. LONG(0x00000000)
  24. *(.rodata.kinit)
  25. . = ALIGN(16);
  26. start_ctors = .;
  27. KEEP(*(.init_array));
  28. KEEP(*(SORT_BY_INIT_PRIORITY(.init_array*)));
  29. KEEP(*(.ctors));
  30. KEEP(*(SORT_BY_INIT_PRIORITY(.ctors*)));
  31. end_ctors = .;
  32. LONG(0x00000000)
  33. LONG(0x19191919)
  34. LONG(0x00000000)
  35. *(.data.kinit)
  36. LONG(0x00000000)
  37. LONG(0x19191919)
  38. LONG(0x00000000)
  39. *(.bss.kinit)
  40. LONG(0x00000000)
  41. LONG(0x19191919)
  42. LONG(0x00000000)
  43. . = ALIGN(0x1000);
  44. __kinit_end = .;
  45. } > MEM
  46. .text 0xc0000000 :
  47. AT(LOADADDR(.kinit) + SIZEOF(.kinit))
  48. {
  49. __text_start = .;
  50. *(.text)
  51. *(.text*)
  52. . = ALIGN(0x1000);
  53. __text_end = .;
  54. } > MEM
  55. .rodata :
  56. AT(LOADADDR(.text) + SIZEOF(.text))
  57. {
  58. __rodata_start = .;
  59. *(.rodata)
  60. *(.rodata*)
  61. . = ALIGN(16);
  62. bss_addr = .;
  63. LONG(ABSOLUTE(__bss_start));
  64. bss_len = .;
  65. LONG(__bss_end - __bss_start);
  66. kernel_size = .;
  67. LONG(__data_end - __kinit_start);
  68. __stack_chk_guard = .;
  69. LONG(0x19198101);
  70. . = ALIGN(0x1000);
  71. __rodata_end = .;
  72. } > MEM
  73. .data :
  74. AT(LOADADDR(.rodata) + SIZEOF(.rodata))
  75. {
  76. __data_start = .;
  77. *(.data)
  78. *(.data*)
  79. . = ALIGN(0x1000);
  80. __data_end = .;
  81. } > MEM
  82. .bss :
  83. {
  84. __bss_start = .;
  85. *(.bss)
  86. *(.bss*)
  87. . = ALIGN(0x1000);
  88. __bss_end = .;
  89. } > MEM
  90. /* Stabs debugging sections. */
  91. .stab 0 : { *(.stab) }
  92. .stabstr 0 : { *(.stabstr) }
  93. .stab.excl 0 : { *(.stab.excl) }
  94. .stab.exclstr 0 : { *(.stab.exclstr) }
  95. .stab.index 0 : { *(.stab.index) }
  96. .stab.indexstr 0 : { *(.stab.indexstr) }
  97. .comment 0 : { *(.comment) }
  98. /* DWARF debug sections.
  99. Symbols in the DWARF debugging sections are relative to the beginning
  100. of the section so we begin them at 0. */
  101. /* DWARF 1 */
  102. .debug 0 : { *(.debug) }
  103. .line 0 : { *(.line) }
  104. /* GNU DWARF 1 extensions */
  105. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  106. .debug_sfnames 0 : { *(.debug_sfnames) }
  107. /* DWARF 1.1 and DWARF 2 */
  108. .debug_aranges 0 : { *(.debug_aranges) }
  109. .debug_pubnames 0 : { *(.debug_pubnames) }
  110. /* DWARF 2 */
  111. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  112. .debug_abbrev 0 : { *(.debug_abbrev) }
  113. .debug_line 0 : { *(.debug_line) }
  114. .debug_frame 0 : { *(.debug_frame) }
  115. .debug_str 0 : { *(.debug_str) }
  116. .debug_loc 0 : { *(.debug_loc) }
  117. .debug_macinfo 0 : { *(.debug_macinfo) }
  118. /* SGI/MIPS DWARF 2 extensions */
  119. .debug_weaknames 0 : { *(.debug_weaknames) }
  120. .debug_funcnames 0 : { *(.debug_funcnames) }
  121. .debug_typenames 0 : { *(.debug_typenames) }
  122. .debug_varnames 0 : { *(.debug_varnames) }
  123. /DISCARD/ :
  124. {
  125. *(.fini_array*)
  126. *(.eh_frame*)
  127. *(.note*)
  128. }
  129. }