ldscript.ld 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 0x7e00 : AT(0x200)
  19. {
  20. *(.text.loader)
  21. *(.text*)
  22. *(.rodata*)
  23. } > WHOLE
  24. .data :
  25. {
  26. kernel_size = .;
  27. LONG(ADDR(.kernel_end) - ADDR(.text));
  28. start_ctors = .;
  29. KEEP(*(.init_array));
  30. KEEP(*(SORT_BY_INIT_PRIORITY(.init_array*)));
  31. end_ctors = .;
  32. *(.data)
  33. *(.data*)
  34. } > WHOLE
  35. .bss :
  36. {
  37. *(.bss)
  38. *(.bss*)
  39. } > WHOLE
  40. .kernel_end :
  41. {
  42. } > WHOLE
  43. /* Stabs debugging sections. */
  44. .stab 0 : { *(.stab) }
  45. .stabstr 0 : { *(.stabstr) }
  46. .stab.excl 0 : { *(.stab.excl) }
  47. .stab.exclstr 0 : { *(.stab.exclstr) }
  48. .stab.index 0 : { *(.stab.index) }
  49. .stab.indexstr 0 : { *(.stab.indexstr) }
  50. .comment 0 : { *(.comment) }
  51. /* DWARF debug sections.
  52. Symbols in the DWARF debugging sections are relative to the beginning
  53. of the section so we begin them at 0. */
  54. /* DWARF 1 */
  55. .debug 0 : { *(.debug) }
  56. .line 0 : { *(.line) }
  57. /* GNU DWARF 1 extensions */
  58. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  59. .debug_sfnames 0 : { *(.debug_sfnames) }
  60. /* DWARF 1.1 and DWARF 2 */
  61. .debug_aranges 0 : { *(.debug_aranges) }
  62. .debug_pubnames 0 : { *(.debug_pubnames) }
  63. /* DWARF 2 */
  64. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  65. .debug_abbrev 0 : { *(.debug_abbrev) }
  66. .debug_line 0 : { *(.debug_line) }
  67. .debug_frame 0 : { *(.debug_frame) }
  68. .debug_str 0 : { *(.debug_str) }
  69. .debug_loc 0 : { *(.debug_loc) }
  70. .debug_macinfo 0 : { *(.debug_macinfo) }
  71. /* SGI/MIPS DWARF 2 extensions */
  72. .debug_weaknames 0 : { *(.debug_weaknames) }
  73. .debug_funcnames 0 : { *(.debug_funcnames) }
  74. .debug_typenames 0 : { *(.debug_typenames) }
  75. .debug_varnames 0 : { *(.debug_varnames) }
  76. .end : AT(0x0ffffff)
  77. {
  78. BYTE(0x00);
  79. } > WHOLE
  80. /DISCARD/ :
  81. {
  82. *(.comment)
  83. }
  84. }