From 229fcec57051103b79422353f53b6053fc5fc4b4 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Mon, 6 Sep 2004 20:55:23 +0000 Subject: [PATCH] * elf-bfd.h (_bfd_elf_make_dynamic_segment): Declare it. * elf.c (_bfd_elf_make_dynamic_segment): New function, split out from ... (map_sections_to_segments): ... here. Use it. Assign a file position to the .dynamic section if it is not loadable, but part of the PT_DYNAMIC segment. * elf32-arm.h (elf32_arm_finish_dynamic_sections): Use file offsets, not VMAs, for the BPABI. Do not fill in the header in the .got.plt section for the BPABI. * elfarm-nabi.c (elf32_arm_symbian_modify_segment_map): Add a PT_DYNAMIC segment. (elf_backend_want_got_plt): Define to zero for Symbian OS. * emulparams/armsymbian.sh: Use armbpabi script. * scripttempl/armbpabi.sc: New script. --- bfd/ChangeLog | 15 ++ bfd/elf-bfd.h | 4 + bfd/elf.c | 43 +++- bfd/elf32-arm.h | 121 +++++++--- bfd/elfarm-nabi.c | 18 ++ ld/ChangeLog | 5 + ld/emulparams/armsymbian.sh | 2 + ld/scripttempl/armbpabi.sc | 435 ++++++++++++++++++++++++++++++++++++ 8 files changed, 609 insertions(+), 34 deletions(-) create mode 100644 ld/scripttempl/armbpabi.sc diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 60c00692662..e6a3777efb8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,18 @@ +2004-09-06 Mark Mitchell + + * elf-bfd.h (_bfd_elf_make_dynamic_segment): Declare it. + * elf.c (_bfd_elf_make_dynamic_segment): New function, split out + from ... + (map_sections_to_segments): ... here. Use it. Assign a file + position to the .dynamic section if it is not loadable, but part + of the PT_DYNAMIC segment. + * elf32-arm.h (elf32_arm_finish_dynamic_sections): Use file + offsets, not VMAs, for the BPABI. Do not fill in the header in + the .got.plt section for the BPABI. + * elfarm-nabi.c (elf32_arm_symbian_modify_segment_map): Add a + PT_DYNAMIC segment. + (elf_backend_want_got_plt): Define to zero for Symbian OS. + 2004-09-06 Nick Clifton * elflink.c (elf_link_add_object_symbols): Set the error code to diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index dfc18de7804..5565e49e96a 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1734,6 +1734,10 @@ extern bfd_boolean bfd_elf_gc_common_final_link extern bfd_boolean bfd_elf_reloc_symbol_deleted_p (bfd_vma, void *); +extern struct elf_segment_map * +_bfd_elf_make_dynamic_segment + (bfd *, asection *); + /* Exported interface for writing elf corefile notes. */ extern char *elfcore_write_note (bfd *, char *, int *, const char *, int, const void *, int); diff --git a/bfd/elf.c b/bfd/elf.c index f9e223527ee..b317d7e70fc 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -3329,6 +3329,25 @@ make_mapping (bfd *abfd, return m; } +/* Create the PT_DYNAMIC segment, which includes DYNSEC. Returns NULL + on failure. */ + +struct elf_segment_map * +_bfd_elf_make_dynamic_segment (bfd *abfd, asection *dynsec) +{ + struct elf_segment_map *m; + + m = bfd_zalloc (abfd, sizeof (struct elf_segment_map)); + if (m == NULL) + return NULL; + m->next = NULL; + m->p_type = PT_DYNAMIC; + m->count = 1; + m->sections[0] = dynsec; + + return m; +} + /* Set up a mapping from BFD sections to program segments. */ static bfd_boolean @@ -3566,15 +3585,9 @@ map_sections_to_segments (bfd *abfd) /* If there is a .dynamic section, throw in a PT_DYNAMIC segment. */ if (dynsec != NULL) { - amt = sizeof (struct elf_segment_map); - m = bfd_zalloc (abfd, amt); + m = _bfd_elf_make_dynamic_segment (abfd, dynsec); if (m == NULL) goto error_return; - m->next = NULL; - m->p_type = PT_DYNAMIC; - m->count = 1; - m->sections[0] = dynsec; - *pm = m; pm = &m->next; } @@ -4215,6 +4228,22 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a if (p->p_type != PT_LOAD && m->count > 0) { BFD_ASSERT (! m->includes_filehdr && ! m->includes_phdrs); + /* If the section has not yet been assigned a file position, + do so now. The ARM BPABI requires that .dynamic section + not be marked SEC_ALLOC because it is not part of any + PT_LOAD segment, so it will not be processed above. */ + if (p->p_type == PT_DYNAMIC && m->sections[0]->filepos == 0) + { + unsigned int i; + Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd); + + i = 1; + while (i_shdrpp[i]->bfd_section != m->sections[0]) + ++i; + off = (_bfd_elf_assign_file_position_for_section + (i_shdrpp[i], off, TRUE)); + p->p_filesz = m->sections[0]->size; + } p->p_offset = m->sections[0]->filepos; } if (m->count == 0) diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index e60ea38b83c..656a8221147 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -3861,14 +3861,16 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info dynobj = elf_hash_table (info)->dynobj; sgot = bfd_get_section_by_name (dynobj, ".got.plt"); - BFD_ASSERT (sgot != NULL); + BFD_ASSERT (elf32_arm_hash_table (info)->symbian_p || sgot != NULL); sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); if (elf_hash_table (info)->dynamic_sections_created) { asection *splt; Elf32_External_Dyn *dyncon, *dynconend; + struct elf32_arm_link_hash_table *htab; + htab = elf32_arm_hash_table (info); splt = bfd_get_section_by_name (dynobj, ".plt"); BFD_ASSERT (splt != NULL && sdyn != NULL); @@ -3885,9 +3887,21 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info switch (dyn.d_tag) { + unsigned int type; + default: break; + case DT_HASH: + name = ".hash"; + goto get_vma_if_bpabi; + case DT_STRTAB: + name = ".dynstr"; + goto get_vma_if_bpabi; + case DT_SYMTAB: + name = ".dynsym"; + goto get_vma_if_bpabi; + case DT_PLTGOT: name = ".got"; goto get_vma; @@ -3896,31 +3910,81 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info get_vma: s = bfd_get_section_by_name (output_bfd, name); BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma; + if (!htab->symbian_p) + dyn.d_un.d_ptr = s->vma; + else + /* In the BPABI, tags in the PT_DYNAMIC section point + at the file offset, not the memory address, for the + convenience of the post linker. */ + dyn.d_un.d_ptr = s->filepos; bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; + get_vma_if_bpabi: + if (htab->symbian_p) + goto get_vma; + break; + case DT_PLTRELSZ: s = bfd_get_section_by_name (output_bfd, ".rel.plt"); BFD_ASSERT (s != NULL); dyn.d_un.d_val = s->size; bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; - + case DT_RELSZ: - /* My reading of the SVR4 ABI indicates that the - procedure linkage table relocs (DT_JMPREL) should be - included in the overall relocs (DT_REL). This is - what Solaris does. However, UnixWare can not handle - that case. Therefore, we override the DT_RELSZ entry - here to make it not include the JMPREL relocs. Since - the linker script arranges for .rel.plt to follow all - other relocation sections, we don't have to worry - about changing the DT_REL entry. */ - s = bfd_get_section_by_name (output_bfd, ".rel.plt"); - if (s != NULL) - dyn.d_un.d_val -= s->size; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + if (!htab->symbian_p) + { + /* My reading of the SVR4 ABI indicates that the + procedure linkage table relocs (DT_JMPREL) should be + included in the overall relocs (DT_REL). This is + what Solaris does. However, UnixWare can not handle + that case. Therefore, we override the DT_RELSZ entry + here to make it not include the JMPREL relocs. Since + the linker script arranges for .rel.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_REL entry. */ + s = bfd_get_section_by_name (output_bfd, ".rel.plt"); + if (s != NULL) + dyn.d_un.d_val -= s->size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + } + /* Fall through */ + + case DT_REL: + case DT_RELA: + case DT_RELASZ: + /* In the BPABI, the DT_REL tag must point at the file + offset, not the VMA, of the first relocation + section. So, we use code similar to that in + elflink.c, but do not check for SHF_ALLOC on the + relcoation section, since relocations sections are + never allocated under the BPABI. The comments above + about Unixware notwithstanding, we include all of the + relocations here. */ + if (htab->symbian_p) + { + unsigned int i; + type = ((dyn.d_tag == DT_REL || dyn.d_tag == DT_RELSZ) + ? SHT_REL : SHT_RELA); + dyn.d_un.d_val = 0; + for (i = 1; i < elf_numsections (output_bfd); i++) + { + Elf_Internal_Shdr *hdr + = elf_elfsections (output_bfd)[i]; + if (hdr->sh_type == type) + { + if (dyn.d_tag == DT_RELSZ + || dyn.d_tag == DT_RELASZ) + dyn.d_un.d_val += hdr->sh_size; + else if (dyn.d_un.d_val == 0 + || hdr->sh_offset < dyn.d_un.d_val) + dyn.d_un.d_val = hdr->sh_offset; + } + } + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } break; /* Set the bottom bit of DT_INIT/FINI if the @@ -3981,19 +4045,22 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info } /* Fill in the first three entries in the global offset table. */ - if (sgot->size > 0) + if (sgot) { - if (sdyn == NULL) - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); - else - bfd_put_32 (output_bfd, - sdyn->output_section->vma + sdyn->output_offset, - sgot->contents); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); - } + if (sgot->size > 0) + { + if (sdyn == NULL) + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + else + bfd_put_32 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + sgot->contents); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + } - elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; + } return TRUE; } diff --git a/bfd/elfarm-nabi.c b/bfd/elfarm-nabi.c index 7c6e7c2cacf..66445784e9d 100644 --- a/bfd/elfarm-nabi.c +++ b/bfd/elfarm-nabi.c @@ -936,6 +936,7 @@ elf32_arm_symbian_modify_segment_map (abfd, info) struct bfd_link_info *info ATTRIBUTE_UNUSED; { struct elf_segment_map *m; + asection *dynsec; /* The first PT_LOAD segment will have the program headers and file headers in it by default -- but BPABI object files should not @@ -946,6 +947,19 @@ elf32_arm_symbian_modify_segment_map (abfd, info) m->includes_filehdr = 0; m->includes_phdrs = 0; } + + /* BPABI shared libraries and executables should have a PT_DYNAMIC + segment. However, because the .dynamic section is not marked + with SEC_LOAD, the generic ELF code will not create such a + segment. */ + dynsec = bfd_get_section_by_name (abfd, ".dynamic"); + if (dynsec) + { + m = _bfd_elf_make_dynamic_segment (abfd, dynsec); + m->next = elf_tdata (abfd)->segment_map; + elf_tdata (abfd)->segment_map = m; + } + return TRUE; } @@ -970,5 +984,9 @@ elf32_arm_symbian_modify_segment_map (abfd, info) #undef elf_backend_got_header_size #define elf_backend_got_header_size 0 +/* Similarly, there is no .got.plt section. */ +#undef elf_backend_want_got_plt +#define elf_backend_want_got_plt 0 + #include "elf32-target.h" diff --git a/ld/ChangeLog b/ld/ChangeLog index ac7b36eddbc..e61f71960bd 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2004-09-06 Mark Mitchell + + * emulparams/armsymbian.sh: Use armbpabi script. + * scripttempl/armbpabi.sc: New script. + 2004-09-02 Mark Mitchell * Makefile.am (ALL_EMULATIONS): Add earmsymbian.o. diff --git a/ld/emulparams/armsymbian.sh b/ld/emulparams/armsymbian.sh index 5301d7ed9b0..630024e3e42 100644 --- a/ld/emulparams/armsymbian.sh +++ b/ld/emulparams/armsymbian.sh @@ -1,4 +1,6 @@ . ${srcdir}/emulparams/armelf.sh +SCRIPT_NAME="armbpabi" +GENERATE_COMBRELOC_SCRIPT=1 OUTPUT_FORMAT="elf32-littlearm-symbian" BIG_OUTPUT_FORMAT="elf32-bigarm-symbian" LITTLE_OUTPUT_FORMAT="$OUTPUT_FORMAT" diff --git a/ld/scripttempl/armbpabi.sc b/ld/scripttempl/armbpabi.sc new file mode 100644 index 00000000000..63d539367ed --- /dev/null +++ b/ld/scripttempl/armbpabi.sc @@ -0,0 +1,435 @@ +# This variant of elf.sc is used for ARM BPABI platforms, like Symbian +# OS, where a separate postlinker will operated on the generated +# executable or shared object. + +# +# Unusual variables checked by this code: +# NOP - four byte opcode for no-op (defaults to 0) +# NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not +# empty. +# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start +# INITIAL_READONLY_SECTIONS - at start of text segment +# OTHER_READONLY_SECTIONS - other than .text .init .rodata ... +# (e.g., .PARISC.milli) +# OTHER_TEXT_SECTIONS - these get put in .text when relocating +# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... +# (e.g., .PARISC.global) +# OTHER_RELRO_SECTIONS - other than .data.rel.ro ... +# (e.g. PPC32 .fixup, .got[12]) +# OTHER_BSS_SECTIONS - other than .bss .sbss ... +# OTHER_SECTIONS - at the end +# EXECUTABLE_SYMBOLS - symbols that must be defined for an +# executable (e.g., _DYNAMIC_LINK) +# TEXT_START_SYMBOLS - symbols that appear at the start of the +# .text section. +# DATA_START_SYMBOLS - symbols that appear at the start of the +# .data section. +# OTHER_SDATA_SECTIONS - sections just after .sdata. +# OTHER_BSS_SYMBOLS - symbols that appear at the start of the +# .bss section besides __bss_start. +# DATA_PLT - .plt should be in data segment, not text segment. +# PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement. +# BSS_PLT - .plt should be in bss segment +# TEXT_DYNAMIC - .dynamic in text segment, not data segment. +# EMBEDDED - whether this is for an embedded system. +# SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set +# start address of shared library. +# INPUT_FILES - INPUT command of files to always include +# WRITABLE_RODATA - if set, the .rodata section should be writable +# INIT_START, INIT_END - statements just before and just after +# combination of .init sections. +# FINI_START, FINI_END - statements just before and just after +# combination of .fini sections. +# STACK_ADDR - start of a .stack section. +# OTHER_END_SYMBOLS - symbols to place right at the end of the script. +# SEPARATE_GOTPLT - if set, .got.plt should be separate output section, +# so that .got can be in the RELRO area. It should be set to +# the number of bytes in the beginning of .got.plt which can be +# in the RELRO area as well. +# +# When adding sections, do note that the names of some sections are used +# when specifying the start address of the next. +# + +# Many sections come in three flavours. There is the 'real' section, +# like ".data". Then there are the per-procedure or per-variable +# sections, generated by -ffunction-sections and -fdata-sections in GCC, +# and useful for --gc-sections, which for a variable "foo" might be +# ".data.foo". Then there are the linkonce sections, for which the linker +# eliminates duplicates, which are named like ".gnu.linkonce.d.foo". +# The exact correspondences are: +# +# Section Linkonce section +# .text .gnu.linkonce.t.foo +# .rodata .gnu.linkonce.r.foo +# .data .gnu.linkonce.d.foo +# .bss .gnu.linkonce.b.foo +# .sdata .gnu.linkonce.s.foo +# .sbss .gnu.linkonce.sb.foo +# .sdata2 .gnu.linkonce.s2.foo +# .sbss2 .gnu.linkonce.sb2.foo +# .debug_info .gnu.linkonce.wi.foo +# .tdata .gnu.linkonce.td.foo +# .tbss .gnu.linkonce.tb.foo +# +# Each of these can also have corresponding .rel.* and .rela.* sections. + +test -z "$ENTRY" && ENTRY=_start +test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} +test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} +if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi +test -z "${ELFSIZE}" && ELFSIZE=32 +test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8" +test "$LD_FLAG" = "N" && DATA_ADDR=. +test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE="" +test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE="" +test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT +DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" +DATA_SEGMENT_RELRO_END="" +DATA_SEGMENT_RELRO_GOTPLT_END="" +DATA_SEGMENT_END="" +if test -n "${COMMONPAGESIZE}"; then + DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})" + DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);" + if test -n "${SEPARATE_GOTPLT}"; then + DATA_SEGMENT_RELRO_GOTPLT_END=". = DATA_SEGMENT_RELRO_END (. + ${SEPARATE_GOTPLT});" + else + DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (.);" + fi +fi +INTERP=".interp 0 : { *(.interp) }" +PLT=".plt ${RELOCATING-0} : { *(.plt) }" +RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }" +DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }" +STACKNOTE="/DISCARD/ : { *(.note.GNU-stack) }" +if test -z "${NO_SMALL_DATA}"; then + SBSS=".sbss ${RELOCATING-0} : + { + ${RELOCATING+PROVIDE (__sbss_start = .);} + ${RELOCATING+PROVIDE (___sbss_start = .);} + *(.dynsbss) + *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*}) + *(.scommon) + ${RELOCATING+PROVIDE (__sbss_end = .);} + ${RELOCATING+PROVIDE (___sbss_end = .);} + }" + SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }" + SDATA="/* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata ${RELOCATING-0} : + { + ${RELOCATING+${SDATA_START_SYMBOLS}} + *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*}) + }" + SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*}) }" + REL_SDATA=".rel.sdata ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) } + .rela.sdata ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }" + REL_SBSS=".rel.sbss ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) } + .rela.sbss ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }" + REL_SDATA2=".rel.sdata2 ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) } + .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }" + REL_SBSS2=".rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) } + .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }" +else + NO_SMALL_DATA=" " +fi +test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" " +CTOR=".ctors ${CONSTRUCTING-0} : + { + ${CONSTRUCTING+${CTOR_START}} + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + + KEEP (*crtbegin*.o(.ctors)) + + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + + KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + ${CONSTRUCTING+${CTOR_END}} + }" +DTOR=".dtors ${CONSTRUCTING-0} : + { + ${CONSTRUCTING+${DTOR_START}} + KEEP (*crtbegin*.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + ${CONSTRUCTING+${DTOR_END}} + }" +STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} : + { + ${RELOCATING+_stack = .;} + *(.stack) + }" + +# if this is for an embedded system, don't add SIZEOF_HEADERS. +if [ -z "$EMBEDDED" ]; then + test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS" +else + test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}" +fi + +cat <