elfarc.sc 18 KB

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