ldscript.ld 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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_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. asm_kernel_size = .;
  34. LONG(__real_kernel_end - ADDR(.text));
  35. start_ctors = .;
  36. KEEP(*(.init_array));
  37. KEEP(*(SORT_BY_INIT_PRIORITY(.init_array*)));
  38. end_ctors = .;
  39. *(.data)
  40. *(.data*)
  41. } > WHOLE
  42. .bss :
  43. {
  44. *(.bss)
  45. *(.bss*)
  46. } > WHOLE
  47. .kernel_end :
  48. {
  49. __real_kernel_end = .;
  50. } > WHOLE
  51. /* Stabs debugging sections. */
  52. .stab 0 : { *(.stab) }
  53. .stabstr 0 : { *(.stabstr) }
  54. .stab.excl 0 : { *(.stab.excl) }
  55. .stab.exclstr 0 : { *(.stab.exclstr) }
  56. .stab.index 0 : { *(.stab.index) }
  57. .stab.indexstr 0 : { *(.stab.indexstr) }
  58. .comment 0 : { *(.comment) }
  59. /* DWARF debug sections.
  60. Symbols in the DWARF debugging sections are relative to the beginning
  61. of the section so we begin them at 0. */
  62. /* DWARF 1 */
  63. .debug 0 : { *(.debug) }
  64. .line 0 : { *(.line) }
  65. /* GNU DWARF 1 extensions */
  66. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  67. .debug_sfnames 0 : { *(.debug_sfnames) }
  68. /* DWARF 1.1 and DWARF 2 */
  69. .debug_aranges 0 : { *(.debug_aranges) }
  70. .debug_pubnames 0 : { *(.debug_pubnames) }
  71. /* DWARF 2 */
  72. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  73. .debug_abbrev 0 : { *(.debug_abbrev) }
  74. .debug_line 0 : { *(.debug_line) }
  75. .debug_frame 0 : { *(.debug_frame) }
  76. .debug_str 0 : { *(.debug_str) }
  77. .debug_loc 0 : { *(.debug_loc) }
  78. .debug_macinfo 0 : { *(.debug_macinfo) }
  79. /* SGI/MIPS DWARF 2 extensions */
  80. .debug_weaknames 0 : { *(.debug_weaknames) }
  81. .debug_funcnames 0 : { *(.debug_funcnames) }
  82. .debug_typenames 0 : { *(.debug_typenames) }
  83. .debug_varnames 0 : { *(.debug_varnames) }
  84. .end : AT(0x0ffffff)
  85. {
  86. BYTE(0x00);
  87. } > WHOLE
  88. /DISCARD/ :
  89. {
  90. *(.fini_array*)
  91. *(.eh_frame*)
  92. }
  93. }