uw-prog-ldscript 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * This is a pile of crap that tells the linker how to link the kernel,
  3. * because it's too stupid to be able to work it out on its own.
  4. */
  5. /* UW - TBB - Jan, 2012
  6. * Adopted from kern/arch/mips/conf/ldscript that is used
  7. * for the kernel to be used with user programs.
  8. * Mainly done to have data segments start at 0x10000000 but
  9. * also may clean things up a bit relative to previous versions.
  10. */
  11. ENTRY(__start)
  12. _DYNAMIC_LINK = 0;
  13. SECTIONS
  14. {
  15. /*
  16. * Base address for the user programs.
  17. */
  18. . = 0x00400000;
  19. /*
  20. * Read-only loaded sections.
  21. */
  22. /* code */
  23. .text : { *(.text) }
  24. /* linker-provided symbol for end of code */
  25. _etext = .;
  26. /* read-only data */
  27. .rodata : { *(.rodata) *(.rodata.*) }
  28. /* MIPS register-usage blather */
  29. .reginfo : { *(.reginfo) }
  30. /*
  31. * Move to a fresh page. This method puts read-only and
  32. * read-write material on separate pages without having to
  33. * waste space on page-alignment in the on-disk file; the
  34. * on-disk page that contains both text and data is mapped
  35. * twice.
  36. *
  37. * For mips kernels we can't write-protect the text anyhow so
  38. * there's no point doing it.
  39. */
  40. /* . = . + 0x1000; */
  41. /*
  42. * Read-write loaded sections.
  43. */
  44. /* UW - TBB start data segment at 0x10000000 */
  45. . = 0x10000000;
  46. /* initialized data */
  47. .data : {
  48. *(.data)
  49. CONSTRUCTORS
  50. }
  51. /* Value for GP register */
  52. _gp = ALIGN(16) + 0x7ff0;
  53. /* Small data accessed via GP register */
  54. .lit8 : { *(.lit8) }
  55. .lit4 : { *(.lit4) }
  56. .sdata : { *(.sdata) }
  57. /* cleared-to-zero data */
  58. .sbss : { *(.sbss *.scommon) }
  59. .bss : { *(.bss) *(COMMON) }
  60. /* linker-provided symbol for end of program */
  61. _end = .;
  62. /*
  63. * Debug info
  64. */
  65. /* stabs debug sections */
  66. .stab 0: { *(.stab) }
  67. .stabstr 0: { *(.stabstr) }
  68. /* DWARF debug sections */
  69. .debug 0: { *(.debug) }
  70. .line 0: { *(.line) }
  71. .debug_srcinfo 0: { *(.debug_srcinfo) }
  72. .debug_sfnames 0: { *(.debug_sfnames) }
  73. .debug_aranges 0: { *(.debug_aranges) }
  74. .debug_pubnames 0: { *(.debug_pubnames) }
  75. .debug_info 0: { *(.debug_info .gnu.linkonce.wi.*) }
  76. .debug_abbrev 0: { *(.debug_abbrev) }
  77. .debug_line 0: { *(.debug_line) }
  78. .debug_frame 0: { *(.debug_frame) }
  79. .debug_str 0: { *(.debug_str) }
  80. .debug_loc 0: { *(.debug_loc) }
  81. .debug_macinfo 0: { *(.debug_macinfo) }
  82. .debug_weaknames 0: { *(.debug_weaknames) }
  83. .debug_funcnames 0: { *(.debug_funcnames) }
  84. .debug_typenames 0: { *(.debug_typenames) }
  85. .debug_varnames 0: { *(.debug_varnames) }
  86. /* These must appear regardless of . */
  87. .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
  88. .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
  89. }