mep.sc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. # Copyright (C) 2014-2015 Free Software Foundation, Inc.
  2. #
  3. # Copying and distribution of this file, with or without modification,
  4. # are permitted in any medium without royalty provided the copyright
  5. # notice and this notice are preserved.
  6. #
  7. # Unusual variables checked by this code:
  8. # NOP - four byte opcode for no-op (defaults to 0)
  9. # NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not
  10. # empty.
  11. # SMALL_DATA_CTOR - .ctors contains small data.
  12. # SMALL_DATA_DTOR - .dtors contains small data.
  13. # DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
  14. # INITIAL_READONLY_SECTIONS - at start of text segment
  15. # OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
  16. # (e.g., .PARISC.milli)
  17. # OTHER_TEXT_SECTIONS - these get put in .text when relocating
  18. # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
  19. # (e.g., .PARISC.global)
  20. # OTHER_RELRO_SECTIONS - other than .data.rel.ro ...
  21. # (e.g. PPC32 .fixup, .got[12])
  22. # OTHER_BSS_SECTIONS - other than .bss .sbss ...
  23. # OTHER_SECTIONS - at the end
  24. # EXECUTABLE_SYMBOLS - symbols that must be defined for an
  25. # executable (e.g., _DYNAMIC_LINK)
  26. # TEXT_START_ADDR - the first byte of the text segment, after any
  27. # headers.
  28. # TEXT_BASE_ADDRESS - the first byte of the text segment.
  29. # TEXT_START_SYMBOLS - symbols that appear at the start of the
  30. # .text section.
  31. # DATA_START_SYMBOLS - symbols that appear at the start of the
  32. # .data section.
  33. # OTHER_GOT_SYMBOLS - symbols defined just before .got.
  34. # OTHER_GOT_SECTIONS - sections just after .got.
  35. # OTHER_SDATA_SECTIONS - sections just after .sdata.
  36. # OTHER_BSS_SYMBOLS - symbols that appear at the start of the
  37. # .bss section besides __bss_start.
  38. # DATA_PLT - .plt should be in data segment, not text segment.
  39. # PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement.
  40. # BSS_PLT - .plt should be in bss segment
  41. # TEXT_DYNAMIC - .dynamic in text segment, not data segment.
  42. # EMBEDDED - whether this is for an embedded system.
  43. # SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
  44. # start address of shared library.
  45. # INPUT_FILES - INPUT command of files to always include
  46. # WRITABLE_RODATA - if set, the .rodata section should be writable
  47. # INIT_START, INIT_END - statements just before and just after
  48. # combination of .init sections.
  49. # FINI_START, FINI_END - statements just before and just after
  50. # combination of .fini sections.
  51. # STACK_ADDR - start of a .stack section.
  52. # OTHER_END_SYMBOLS - symbols to place right at the end of the script.
  53. # SEPARATE_GOTPLT - if set, .got.plt should be separate output section,
  54. # so that .got can be in the RELRO area. It should be set to
  55. # the number of bytes in the beginning of .got.plt which can be
  56. # in the RELRO area as well.
  57. #
  58. # When adding sections, do note that the names of some sections are used
  59. # when specifying the start address of the next.
  60. #
  61. # Many sections come in three flavours. There is the 'real' section,
  62. # like ".data". Then there are the per-procedure or per-variable
  63. # sections, generated by -ffunction-sections and -fdata-sections in GCC,
  64. # and useful for --gc-sections, which for a variable "foo" might be
  65. # ".data.foo". Then there are the linkonce sections, for which the linker
  66. # eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
  67. # The exact correspondences are:
  68. #
  69. # Section Linkonce section
  70. # .text .gnu.linkonce.t.foo
  71. # .rodata .gnu.linkonce.r.foo
  72. # .data .gnu.linkonce.d.foo
  73. # .bss .gnu.linkonce.b.foo
  74. # .sdata .gnu.linkonce.s.foo
  75. # .sbss .gnu.linkonce.sb.foo
  76. # .sdata2 .gnu.linkonce.s2.foo
  77. # .sbss2 .gnu.linkonce.sb2.foo
  78. # .debug_info .gnu.linkonce.wi.foo
  79. # .tdata .gnu.linkonce.td.foo
  80. # .tbss .gnu.linkonce.tb.foo
  81. #
  82. # Each of these can also have corresponding .rel.* and .rela.* sections.
  83. test -z "$ENTRY" && ENTRY=_start
  84. test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
  85. test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
  86. if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
  87. test -z "${ELFSIZE}" && ELFSIZE=32
  88. test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
  89. test "$LD_FLAG" = "N" && DATA_ADDR=.
  90. test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
  91. test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
  92. test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT
  93. DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
  94. DATA_SEGMENT_RELRO_END=""
  95. DATA_SEGMENT_RELRO_GOTPLT_END=""
  96. DATA_SEGMENT_END=""
  97. if test -n "${COMMONPAGESIZE}"; then
  98. DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
  99. DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
  100. if test -n "${SEPARATE_GOTPLT}"; then
  101. DATA_SEGMENT_RELRO_GOTPLT_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT}, .);"
  102. else
  103. DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (0, .);"
  104. fi
  105. fi
  106. INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
  107. PLT=".plt ${RELOCATING-0} : { *(.plt) }"
  108. if test -z "$GOT"; then
  109. if test -z "$SEPARATE_GOTPLT"; then
  110. GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }"
  111. else
  112. GOT=".got ${RELOCATING-0} : { *(.got) }"
  113. GOTPLT="${RELOCATING+${DATA_SEGMENT_RELRO_GOTPLT_END}}
  114. .got.plt ${RELOCATING-0} : { *(.got.plt) }"
  115. fi
  116. fi
  117. DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
  118. RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
  119. DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }"
  120. DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
  121. if test -z "${NO_SMALL_DATA}"; then
  122. SBSS=".sbss ${RELOCATING-0} :
  123. {
  124. ${RELOCATING+PROVIDE (__sbss_start = .);}
  125. ${RELOCATING+PROVIDE (___sbss_start = .);}
  126. ${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)}
  127. *(.dynsbss)
  128. *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
  129. *(.scommon)
  130. ${RELOCATING+PROVIDE (__sbss_end = .);}
  131. ${RELOCATING+PROVIDE (___sbss_end = .);}
  132. }"
  133. SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }"
  134. SDATA="/* We want the small data sections together, so single-instruction offsets
  135. can access them all, and initialized data all before uninitialized, so
  136. we can shorten the on-disk segment size. */
  137. .sdata ${RELOCATING-0} :
  138. {
  139. ${RELOCATING+${SDATA_START_SYMBOLS}}
  140. ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)}
  141. *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*})
  142. }"
  143. SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*}) }"
  144. REL_SDATA=".rel.sdata ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) }
  145. .rela.sdata ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }"
  146. REL_SBSS=".rel.sbss ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) }
  147. .rela.sbss ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }"
  148. REL_SDATA2=".rel.sdata2 ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) }
  149. .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }"
  150. REL_SBSS2=".rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) }
  151. .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }"
  152. else
  153. NO_SMALL_DATA=" "
  154. fi
  155. test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" "
  156. CTOR=".ctors ${CONSTRUCTING-0} :
  157. {
  158. ${CONSTRUCTING+${CTOR_START}}
  159. /* gcc uses crtbegin.o to find the start of
  160. the constructors, so we make sure it is
  161. first. Because this is a wildcard, it
  162. doesn't matter if the user does not
  163. actually link against crtbegin.o; the
  164. linker won't look for a file to match a
  165. wildcard. The wildcard also means that it
  166. doesn't matter which directory crtbegin.o
  167. is in. */
  168. KEEP (*crtbegin*.o(.ctors))
  169. /* We don't want to include the .ctor section from
  170. from the crtend.o file until after the sorted ctors.
  171. The .ctor section from the crtend file contains the
  172. end of ctors marker and it must be last */
  173. KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors))
  174. KEEP (*(SORT(.ctors.*)))
  175. KEEP (*(.ctors))
  176. ${CONSTRUCTING+${CTOR_END}}
  177. }"
  178. DTOR=".dtors ${CONSTRUCTING-0} :
  179. {
  180. ${CONSTRUCTING+${DTOR_START}}
  181. KEEP (*crtbegin*.o(.dtors))
  182. KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors))
  183. KEEP (*(SORT(.dtors.*)))
  184. KEEP (*(.dtors))
  185. ${CONSTRUCTING+${DTOR_END}}
  186. }"
  187. STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
  188. {
  189. ${RELOCATING+_stack = .;}
  190. *(.stack)
  191. }"
  192. # If this is for an embedded system, don't add SIZEOF_HEADERS.
  193. if [ -z "$EMBEDDED" ]; then
  194. test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
  195. else
  196. test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
  197. fi
  198. cat <<EOF
  199. /* Copyright (C) 2014-2015 Free Software Foundation, Inc.
  200. Copying and distribution of this script, with or without modification,
  201. are permitted in any medium without royalty provided the copyright
  202. notice and this notice are preserved. */
  203. OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
  204. "${LITTLE_OUTPUT_FORMAT}")
  205. OUTPUT_ARCH(${OUTPUT_ARCH})
  206. ${RELOCATING+ENTRY(${ENTRY})}
  207. ${RELOCATING+${LIB_SEARCH_DIRS}}
  208. ${RELOCATING+/* Do we need any of these for elf?
  209. __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
  210. ${RELOCATING+${EXECUTABLE_SYMBOLS}}
  211. ${RELOCATING+${INPUT_FILES}}
  212. ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
  213. if gld -r is used and the intermediate file has sections starting
  214. at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
  215. bug. But for now assigning the zero vmas works. */}
  216. SECTIONS
  217. {
  218. /* Read-only sections, merged into text segment: */
  219. ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
  220. ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
  221. ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
  222. ${CREATE_SHLIB-${INTERP}}
  223. ${INITIAL_READONLY_SECTIONS}
  224. ${TEXT_DYNAMIC+${DYNAMIC}}
  225. .hash ${RELOCATING-0} : { *(.hash) }
  226. .dynsym ${RELOCATING-0} : { *(.dynsym) }
  227. .dynstr ${RELOCATING-0} : { *(.dynstr) }
  228. .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
  229. .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) }
  230. .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) }
  231. EOF
  232. if [ "x$COMBRELOC" = x ]; then
  233. COMBRELOCCAT=cat
  234. else
  235. COMBRELOCCAT="cat > $COMBRELOC"
  236. fi
  237. eval $COMBRELOCCAT <<EOF
  238. .rel.init ${RELOCATING-0} : { *(.rel.init) }
  239. .rela.init ${RELOCATING-0} : { *(.rela.init) }
  240. .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
  241. .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
  242. .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
  243. .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
  244. .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) }
  245. .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) }
  246. ${OTHER_READONLY_RELOC_SECTIONS}
  247. .rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+ .rel.data.rel.ro.*}) }
  248. .rela.data.rel.ro ${RELOCATING-0} : { *(.rela.data.rel.ro${RELOCATING+ .rela.data.rel.ro.*}) }
  249. .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
  250. .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
  251. .rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) }
  252. .rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) }
  253. .rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) }
  254. .rela.tbss ${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) }
  255. .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
  256. .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
  257. .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
  258. .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
  259. .rel.got ${RELOCATING-0} : { *(.rel.got) }
  260. .rela.got ${RELOCATING-0} : { *(.rela.got) }
  261. ${OTHER_GOT_RELOC_SECTIONS}
  262. ${REL_SDATA}
  263. ${REL_SBSS}
  264. ${REL_SDATA2}
  265. ${REL_SBSS2}
  266. .rel.bss ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) }
  267. .rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) }
  268. EOF
  269. if [ -n "$COMBRELOC" ]; then
  270. cat <<EOF
  271. .rel.dyn ${RELOCATING-0} :
  272. {
  273. EOF
  274. sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC
  275. cat <<EOF
  276. }
  277. .rela.dyn ${RELOCATING-0} :
  278. {
  279. EOF
  280. sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC
  281. cat <<EOF
  282. }
  283. EOF
  284. fi
  285. cat <<EOF
  286. .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
  287. .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
  288. ${OTHER_PLT_RELOC_SECTIONS}
  289. .init ${RELOCATING-0} :
  290. {
  291. ${RELOCATING+${INIT_START}}
  292. KEEP (*(.init))
  293. ${RELOCATING+${INIT_END}}
  294. } =${NOP-0}
  295. ${DATA_PLT-${BSS_PLT-${PLT}}}
  296. .text ${RELOCATING-0} :
  297. {
  298. ${RELOCATING+${TEXT_START_SYMBOLS}}
  299. *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
  300. /* .gnu.warning sections are handled specially by elf32.em. */
  301. *(.gnu.warning)
  302. ${RELOCATING+${OTHER_TEXT_SECTIONS}}
  303. } =${NOP-0}
  304. .fini ${RELOCATING-0} :
  305. {
  306. ${RELOCATING+${FINI_START}}
  307. KEEP (*(.fini))
  308. ${RELOCATING+${FINI_END}}
  309. } =${NOP-0}
  310. ${RELOCATING+PROVIDE (__etext = .);}
  311. ${RELOCATING+PROVIDE (_etext = .);}
  312. ${RELOCATING+PROVIDE (etext = .);}
  313. ${WRITABLE_RODATA-${RODATA}}
  314. .rodata1 ${RELOCATING-0} : { *(.rodata1) }
  315. ${CREATE_SHLIB-${SDATA2}}
  316. ${CREATE_SHLIB-${SBSS2}}
  317. ${OTHER_READONLY_SECTIONS}
  318. .eh_frame_hdr : { *(.eh_frame_hdr) }
  319. .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
  320. .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
  321. /* Adjust the address for the data segment. We want to adjust up to
  322. the same address within the page on the next page up. */
  323. ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
  324. ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
  325. ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
  326. /* Exception handling */
  327. .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
  328. .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
  329. /* Thread Local Storage sections */
  330. .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
  331. .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
  332. .preinit_array ${RELOCATING-0} : { KEEP (*(.preinit_array)) }
  333. .init_array ${RELOCATING-0} : { KEEP (*(.init_array)) }
  334. .fini_array ${RELOCATING-0} : { KEEP (*(.fini_array)) }
  335. ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
  336. ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
  337. .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
  338. ${RELOCATING+${DATARELRO}}
  339. ${OTHER_RELRO_SECTIONS}
  340. ${TEXT_DYNAMIC-${DYNAMIC}}
  341. ${NO_SMALL_DATA+${RELRO_NOW+${GOT}}}
  342. ${NO_SMALL_DATA+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}}
  343. ${NO_SMALL_DATA+${RELRO_NOW-${SEPARATE_GOTPLT+${GOTPLT}}}}
  344. ${RELOCATING+${DATA_SEGMENT_RELRO_END}}
  345. ${NO_SMALL_DATA+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}}
  346. ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}}
  347. .data ${RELOCATING-0} :
  348. {
  349. ${RELOCATING+${DATA_START_SYMBOLS}}
  350. *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
  351. ${CONSTRUCTING+SORT(CONSTRUCTORS)}
  352. }
  353. .data1 ${RELOCATING-0} : { *(.data1) }
  354. ${WRITABLE_RODATA+${RODATA}}
  355. ${OTHER_READWRITE_SECTIONS}
  356. ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}}
  357. ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}}
  358. ${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}
  359. ${RELOCATING+${OTHER_GOT_SYMBOLS}}
  360. ${NO_SMALL_DATA-${GOT}}
  361. ${OTHER_GOT_SECTIONS}
  362. ${SDATA}
  363. ${OTHER_SDATA_SECTIONS}
  364. ${RELOCATING+_edata = .;}
  365. ${RELOCATING+PROVIDE (edata = .);}
  366. ${RELOCATING+__bss_start = .;}
  367. ${RELOCATING+${OTHER_BSS_SYMBOLS}}
  368. ${SBSS}
  369. ${BSS_PLT+${PLT}}
  370. .bss ${RELOCATING-0} :
  371. {
  372. *(.dynbss)
  373. *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
  374. *(COMMON)
  375. /* Align here to ensure that the .bss section occupies space up to
  376. _end. Align after .bss to ensure correct alignment even if the
  377. .bss section disappears because there are no input sections. */
  378. ${RELOCATING+. = ALIGN(${ALIGNMENT});}
  379. }
  380. ${OTHER_BSS_SECTIONS}
  381. ${RELOCATING+. = ALIGN(${ALIGNMENT});}
  382. ${RELOCATING+_end = .;}
  383. ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
  384. ${RELOCATING+PROVIDE (end = .);}
  385. ${RELOCATING+${DATA_SEGMENT_END}}
  386. /* Stabs debugging sections. */
  387. .stab 0 : { *(.stab) }
  388. .stabstr 0 : { *(.stabstr) }
  389. .stab.excl 0 : { *(.stab.excl) }
  390. .stab.exclstr 0 : { *(.stab.exclstr) }
  391. .stab.index 0 : { *(.stab.index) }
  392. .stab.indexstr 0 : { *(.stab.indexstr) }
  393. .comment 0 : { *(.comment) }
  394. EOF
  395. . $srcdir/scripttempl/DWARF.sc
  396. cat <<EOF
  397. ${STACK_ADDR+${STACK}}
  398. ${OTHER_SECTIONS}
  399. ${RELOCATING+${OTHER_END_SYMBOLS}}
  400. ${RELOCATING+${DISCARDED}}
  401. }
  402. EOF