elf_riscv64_efi.lds 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */
  2. OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv")
  3. OUTPUT_ARCH(riscv)
  4. ENTRY(_start)
  5. SECTIONS
  6. {
  7. .text 0 : {
  8. *(.text.head)
  9. . = ALIGN(4096);
  10. _text = .;
  11. *(.text)
  12. *(.text.*)
  13. *(.gnu.linkonce.t.*)
  14. *(.plt)
  15. . = ALIGN(16);
  16. _evtext = .;
  17. . = ALIGN(4096);
  18. _etext = .;
  19. } =0
  20. _text_vsize = _evtext - _text;
  21. _text_size = _etext - _text;
  22. . = ALIGN(4096);
  23. _reloc = .;
  24. .reloc : {
  25. *(.reloc)
  26. _evreloc = .;
  27. . = ALIGN(4096);
  28. _ereloc = .;
  29. } =0
  30. _reloc_vsize = _evreloc - _reloc;
  31. _reloc_size = _ereloc - _reloc;
  32. . = ALIGN(4096);
  33. _data = .;
  34. .dynamic : { *(.dynamic) }
  35. . = ALIGN(4096);
  36. .data :
  37. {
  38. *(.sdata)
  39. *(.data)
  40. *(.data1)
  41. *(.data.*)
  42. *(.got.plt)
  43. *(.got)
  44. /*
  45. * Note that these aren't the using the GNU "CONSTRUCTOR" output section
  46. * command, so they don't start with a size. Because of p2align and the
  47. * end/END definitions, and the fact that they're mergeable, they can also
  48. * have NULLs which aren't guaranteed to be at the end.
  49. */
  50. . = ALIGN(16);
  51. __init_array_start = .;
  52. *(SORT(.init_array.*))
  53. *(.init_array)
  54. __init_array_end = .;
  55. . = ALIGN(16);
  56. __CTOR_LIST__ = .;
  57. *(SORT(.ctors.*))
  58. *(.ctors)
  59. __CTOR_END__ = .;
  60. . = ALIGN(16);
  61. __DTOR_LIST__ = .;
  62. *(SORT(.dtors.*))
  63. *(.dtors)
  64. __DTOR_END__ = .;
  65. . = ALIGN(16);
  66. __fini_array_start = .;
  67. *(SORT(.fini_array.*))
  68. *(.fini_array)
  69. __fini_array_end = .;
  70. /* the EFI loader doesn't seem to like a .bss section, so we stick
  71. it all into .data: */
  72. . = ALIGN(16);
  73. _bss = .;
  74. *(.sbss)
  75. *(.scommon)
  76. *(.dynbss)
  77. *(.bss)
  78. *(.bss.*)
  79. *(COMMON)
  80. . = ALIGN(16);
  81. _bss_end = .;
  82. _evdata = .;
  83. . = ALIGN(4096);
  84. _edata = .;
  85. } =0
  86. _data_vsize = _evdata - _data;
  87. _data_size = _edata - _data;
  88. . = ALIGN(4096);
  89. _rodata = .;
  90. .rela :
  91. {
  92. *(.rela.text*)
  93. *(.rela.data*)
  94. *(.rela.got)
  95. *(.rela.dyn)
  96. *(.rela.stab)
  97. *(.rela.init_array*)
  98. *(.rela.fini_array*)
  99. *(.rela.ctors*)
  100. *(.rela.dtors*)
  101. }
  102. . = ALIGN(4096);
  103. .rela.plt : { *(.rela.plt) }
  104. . = ALIGN(4096);
  105. .rodata : {
  106. *(.rodata*)
  107. _evrodata = .;
  108. . = ALIGN(4096);
  109. _erodata = .;
  110. } =0
  111. _rodata_vsize = _evrodata - _rodata;
  112. _rodata_size = _erodata - _rodata;
  113. _image_end = .;
  114. _alldata_size = _image_end - _reloc;
  115. . = ALIGN(4096);
  116. .dynsym : { *(.dynsym) }
  117. . = ALIGN(4096);
  118. .dynstr : { *(.dynstr) }
  119. . = ALIGN(4096);
  120. .note.gnu.build-id : { *(.note.gnu.build-id) }
  121. . = ALIGN(4096);
  122. .hash : { *(.hash) }
  123. . = ALIGN(4096);
  124. .gnu.hash : { *(.gnu.hash) }
  125. . = ALIGN(4096);
  126. .eh_frame : { *(.eh_frame) }
  127. . = ALIGN(4096);
  128. .gcc_except_table : { *(.gcc_except_table*) }
  129. /DISCARD/ :
  130. {
  131. *(.rela.reloc)
  132. *(.note.GNU-stack)
  133. }
  134. .comment 0 : { *(.comment) }
  135. }