ld.script 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. OUTPUT_ARCH(mips)
  2. ENTRY(start)
  3. SECTIONS
  4. {
  5. /* Read-only sections, merged into text segment: */
  6. .init : { *(.init) } =0
  7. .text :
  8. {
  9. _ftext = . ;
  10. *(.text)
  11. *(.rodata)
  12. *(.rodata1)
  13. /* .gnu.warning sections are handled specially by elf32.em. */
  14. *(.gnu.warning)
  15. } =0
  16. .kstrtab : { *(.kstrtab) }
  17. . = ALIGN(16); /* Exception table */
  18. __start___ex_table = .;
  19. __ex_table : { *(__ex_table) }
  20. __stop___ex_table = .;
  21. __start___dbe_table = .; /* Exception table for data bus errors */
  22. __dbe_table : { *(__dbe_table) }
  23. __stop___dbe_table = .;
  24. __start___ksymtab = .; /* Kernel symbol table */
  25. __ksymtab : { *(__ksymtab) }
  26. __stop___ksymtab = .;
  27. _etext = .;
  28. . = ALIGN(8192);
  29. .data.init_task : { *(.data.init_task) }
  30. /* Startup code */
  31. . = ALIGN(4096);
  32. __init_begin = .;
  33. .text.init : { *(.text.init) }
  34. .data.init : { *(.data.init) }
  35. . = ALIGN(16);
  36. __setup_start = .;
  37. .setup.init : { *(.setup.init) }
  38. __setup_end = .;
  39. __initcall_start = .;
  40. .initcall.init : { *(.initcall.init) }
  41. __initcall_end = .;
  42. . = ALIGN(4096); /* Align double page for init_task_union */
  43. __init_end = .;
  44. . = ALIGN(4096);
  45. .data.page_aligned : { *(.data.idt) }
  46. . = ALIGN(32);
  47. .data.cacheline_aligned : { *(.data.cacheline_aligned) }
  48. .fini : { *(.fini) } =0
  49. .reginfo : { *(.reginfo) }
  50. /* Adjust the address for the data segment. We want to adjust up to
  51. the same address within the page on the next page up. It would
  52. be more correct to do this:
  53. . = .;
  54. The current expression does not correctly handle the case of a
  55. text segment ending precisely at the end of a page; it causes the
  56. data segment to skip a page. The above expression does not have
  57. this problem, but it will currently (2/95) cause BFD to allocate
  58. a single segment, combining both text and data, for this case.
  59. This will prevent the text segment from being shared among
  60. multiple executions of the program; I think that is more
  61. important than losing a page of the virtual address space (note
  62. that no actual memory is lost; the page which is skipped can not
  63. be referenced). */
  64. . = .;
  65. .data :
  66. {
  67. _fdata = . ;
  68. *(.data)
  69. /* Put the compressed image here, so bss is on the end. */
  70. __image_begin = .;
  71. *(.image)
  72. __image_end = .;
  73. /* Align the initial ramdisk image (INITRD) on page boundaries. */
  74. . = ALIGN(4096);
  75. __ramdisk_begin = .;
  76. *(.initrd)
  77. __ramdisk_end = .;
  78. . = ALIGN(4096);
  79. CONSTRUCTORS
  80. }
  81. .data1 : { *(.data1) }
  82. _gp = . + 0x8000;
  83. .lit8 : { *(.lit8) }
  84. .lit4 : { *(.lit4) }
  85. .ctors : { *(.ctors) }
  86. .dtors : { *(.dtors) }
  87. .got : { *(.got.plt) *(.got) }
  88. .dynamic : { *(.dynamic) }
  89. /* We want the small data sections together, so single-instruction offsets
  90. can access them all, and initialized data all before uninitialized, so
  91. we can shorten the on-disk segment size. */
  92. .sdata : { *(.sdata) }
  93. . = ALIGN(4);
  94. _edata = .;
  95. PROVIDE (edata = .);
  96. __bss_start = .;
  97. _fbss = .;
  98. .sbss : { *(.sbss) *(.scommon) }
  99. .bss :
  100. {
  101. *(.dynbss)
  102. *(.bss)
  103. *(COMMON)
  104. . = ALIGN(4);
  105. _end = . ;
  106. PROVIDE (end = .);
  107. }
  108. /* Sections to be discarded */
  109. /DISCARD/ :
  110. {
  111. *(.text.exit)
  112. *(.data.exit)
  113. *(.exitcall.exit)
  114. }
  115. /* This is the MIPS specific mdebug section. */
  116. .mdebug : { *(.mdebug) }
  117. /* These are needed for ELF backends which have not yet been
  118. converted to the new style linker. */
  119. .stab 0 : { *(.stab) }
  120. .stabstr 0 : { *(.stabstr) }
  121. /* DWARF debug sections.
  122. Symbols in the .debug DWARF section are relative to the beginning of the
  123. section so we begin .debug at 0. It's not clear yet what needs to happen
  124. for the others. */
  125. .debug 0 : { *(.debug) }
  126. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  127. .debug_aranges 0 : { *(.debug_aranges) }
  128. .debug_pubnames 0 : { *(.debug_pubnames) }
  129. .debug_sfnames 0 : { *(.debug_sfnames) }
  130. .line 0 : { *(.line) }
  131. /* These must appear regardless of . */
  132. .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
  133. .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
  134. .comment : { *(.comment) }
  135. .note : { *(.note) }
  136. }