aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-12-15 14:56:40 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-12-15 14:56:40 +0000
commit02ecc8e968f7524f4c41cd7942adff4ff31afe5c (patch)
treed380df5339289f8d485d5cf384ff3285f3516647 /bfd
parentbef6be3d9f7368a79569cdefefde45724aa64fa5 (diff)
downloadgdb-02ecc8e968f7524f4c41cd7942adff4ff31afe5c.zip
gdb-02ecc8e968f7524f4c41cd7942adff4ff31afe5c.tar.gz
gdb-02ecc8e968f7524f4c41cd7942adff4ff31afe5c.tar.bz2
Add SORT_BY_INIT_PRIORITY.
bfd/ 2010-12-15 H.J. Lu <hongjiu.lu@intel.com> * elf.c (_bfd_elf_new_section_hook): Special handling for .init_array/.fini_array output sections. ld/ 2010-12-15 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (GENSCRIPTS): Add @enable_initfini_array@. * NEWS: Mention SORT_BY_INIT_PRIORITY. * configure.in: Add AC_CANONICAL_BUILD. Add --enable-initfini-array. * genscripts.sh (ENABLE_INITFINI_ARRAY): New. * ld.h (sort_type): Add by_init_priority. * ld.texinfo: Document SORT_BY_INIT_PRIORITY. * ldgram.y (SORT_BY_INIT_PRIORITY): New. (wildcard_spec): Handle SORT_BY_INIT_PRIORITY. * ldlang.c (get_init_priority): New. (compare_section): Use get_init_priority for by_init_priority. * ldlex.l (SORT_BY_INIT_PRIORITY): New. * scripttempl/elf.sc: Support ENABLE_INITFINI_ARRAY. * Makefile.in: Regenerated. * aclocal.m4: Regenerated. * config.in: Likewise. * configure: Likewise. ld/testsuite/ 2010-12-15 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/elf.exp (array_tests): Add init-mixed. (array_tests_static): Likewise. Also delete tmpdir/init-mixed. * ld-elf/init-mixed.c: New. * ld-elf/init-mixed.out: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf.c13
2 files changed, 15 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8e12461..fcf2843 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2010-12-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (_bfd_elf_new_section_hook): Special handling for
+ .init_array/.fini_array output sections.
+
2010-12-13 Alan Modra <amodra@gmail.com>
* aoutx.h (aout_link_check_ar_symbols): Formatting.
diff --git a/bfd/elf.c b/bfd/elf.c
index 0e7cd9a..de0ab61 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2304,12 +2304,19 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec)
anyway. We will set ELF section type and flags for all linker
created sections. If user specifies BFD section flags, we will
set ELF section type and flags based on BFD section flags in
- elf_fake_sections. */
- if ((!sec->flags && abfd->direction != read_direction)
+ elf_fake_sections. Special handling for .init_array/.fini_array
+ output sections since they may contain .ctors/.dtors input
+ sections. We don't want _bfd_elf_init_private_section_data to
+ copy ELF section type from .ctors/.dtors input sections. */
+ if (abfd->direction != read_direction
|| (sec->flags & SEC_LINKER_CREATED) != 0)
{
ssect = (*bed->get_sec_type_attr) (abfd, sec);
- if (ssect != NULL)
+ if (ssect != NULL
+ && (!sec->flags
+ || (sec->flags & SEC_LINKER_CREATED) != 0
+ || ssect->type == SHT_INIT_ARRAY
+ || ssect->type == SHT_FINI_ARRAY))
{
elf_section_type (sec) = ssect->type;
elf_section_flags (sec) = ssect->attr;