ldscript.ld 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. OUTPUT_FORMAT(elf32-i386)
  2. OUTPUT_ARCH(i386:i386)
  3. MEMORY
  4. {
  5. WHOLE : org = 0x00000000, l = 4M
  6. }
  7. SECTIONS
  8. {
  9. .text.bootsect : AT(0x00)
  10. {
  11. *(.text.bootsect)
  12. } > WHOLE
  13. .magicnumber : AT(0x1fe)
  14. {
  15. BYTE(0x55);
  16. BYTE(0xaa);
  17. } > WHOLE
  18. .text.loader 0x7e00 : AT(0x200)
  19. {
  20. *(.text.loader)
  21. __kernel_text_and_data_size_offset = .;
  22. LONG(LOADADDR(.data) - LOADADDR(.text));
  23. __loader_end = .;
  24. } > WHOLE
  25. .text 0x100000 : AT(LOADADDR(.text.loader) + SIZEOF(.text.loader))
  26. {
  27. __real_kernel_start = .;
  28. *(.text*)
  29. *(.rodata*)
  30. } > WHOLE
  31. .data : AT(LOADADDR(.text) + ADDR(.data) - ADDR(.text))
  32. {
  33. kernel_text_and_data_size = .;
  34. LONG(__kernel_text_and_data_end - ADDR(.text));
  35. asm_kernel_size = .;
  36. LONG(__real_kernel_end - ADDR(.text));
  37. bss_section_start_addr = .;
  38. LONG(ABSOLUTE(__bss_start));
  39. bss_section_end_addr = .;
  40. LONG(ABSOLUTE(__bss_end));
  41. start_ctors = .;
  42. KEEP(*(.init_array));
  43. KEEP(*(SORT_BY_INIT_PRIORITY(.init_array*)));
  44. KEEP(*(.ctors));
  45. KEEP(*(SORT_BY_INIT_PRIORITY(.ctors*)));
  46. end_ctors = .;
  47. *(.data)
  48. *(.data*)
  49. __kernel_text_and_data_end = .;
  50. } > WHOLE
  51. .bss ALIGN(0x1000) :
  52. {
  53. __bss_start = .;
  54. *(.bss)
  55. *(.bss*)
  56. __bss_end = ALIGN(0x1000);
  57. } > WHOLE
  58. .kernel_end :
  59. {
  60. __real_kernel_end = .;
  61. } > WHOLE
  62. /* Stabs debugging sections. */
  63. .stab 0 : { *(.stab) }
  64. .stabstr 0 : { *(.stabstr) }
  65. .stab.excl 0 : { *(.stab.excl) }
  66. .stab.exclstr 0 : { *(.stab.exclstr) }
  67. .stab.index 0 : { *(.stab.index) }
  68. .stab.indexstr 0 : { *(.stab.indexstr) }
  69. .comment 0 : { *(.comment) }
  70. /* DWARF debug sections.
  71. Symbols in the DWARF debugging sections are relative to the beginning
  72. of the section so we begin them at 0. */
  73. /* DWARF 1 */
  74. .debug 0 : { *(.debug) }
  75. .line 0 : { *(.line) }
  76. /* GNU DWARF 1 extensions */
  77. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  78. .debug_sfnames 0 : { *(.debug_sfnames) }
  79. /* DWARF 1.1 and DWARF 2 */
  80. .debug_aranges 0 : { *(.debug_aranges) }
  81. .debug_pubnames 0 : { *(.debug_pubnames) }
  82. /* DWARF 2 */
  83. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  84. .debug_abbrev 0 : { *(.debug_abbrev) }
  85. .debug_line 0 : { *(.debug_line) }
  86. .debug_frame 0 : { *(.debug_frame) }
  87. .debug_str 0 : { *(.debug_str) }
  88. .debug_loc 0 : { *(.debug_loc) }
  89. .debug_macinfo 0 : { *(.debug_macinfo) }
  90. /* SGI/MIPS DWARF 2 extensions */
  91. .debug_weaknames 0 : { *(.debug_weaknames) }
  92. .debug_funcnames 0 : { *(.debug_funcnames) }
  93. .debug_typenames 0 : { *(.debug_typenames) }
  94. .debug_varnames 0 : { *(.debug_varnames) }
  95. .end : AT(0x0ffffff)
  96. {
  97. BYTE(0x00);
  98. } > WHOLE
  99. /DISCARD/ :
  100. {
  101. *(.fini_array*)
  102. *(.eh_frame*)
  103. }
  104. }