aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2006-04-26 13:32:26 +0000
committerH.J. Lu <hjl.tools@gmail.com>2006-04-26 13:32:26 +0000
commite843e0f8801fd13962c7cff7317b9a89292544e3 (patch)
tree07302030c07332bb1f68eed5be975f6b92b9d27f
parent9ca26584e995caf4b1895f6d0d863a32382672f4 (diff)
downloadgdb-e843e0f8801fd13962c7cff7317b9a89292544e3.zip
gdb-e843e0f8801fd13962c7cff7317b9a89292544e3.tar.gz
gdb-e843e0f8801fd13962c7cff7317b9a89292544e3.tar.bz2
2006-04-26 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/2593 * elf.c (_bfd_elf_new_section_hook): Don't set section ELF type and flags if its BFD flags have been set. (_bfd_elf_init_private_section_data): Don't copy the output ELF section type from input if it has been set to something different.
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elf.c19
2 files changed, 21 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4c82cc1..1f1fafa 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2006-04-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2593
+ * elf.c (_bfd_elf_new_section_hook): Don't set section ELF type
+ and flags if its BFD flags have been set.
+ (_bfd_elf_init_private_section_data): Don't copy the output ELF
+ section type from input if it has been set to something
+ different.
+
2006-04-25 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/2467
diff --git a/bfd/elf.c b/bfd/elf.c
index 04eff22..e697722 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2487,10 +2487,13 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec)
bed = get_elf_backend_data (abfd);
sec->use_rela_p = bed->default_use_rela_p;
- /* When we read a file, we don't need section type and flags unless
- it is a linker created section. They will be overridden in
- _bfd_elf_make_section_from_shdr anyway. */
- if (abfd->direction != read_direction
+ /* When we read a file, we don't need to set ELF section type and
+ flags. They will be overridden in _bfd_elf_make_section_from_shdr
+ 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)
|| (sec->flags & SEC_LINKER_CREATED) != 0)
{
ssect = (*bed->get_sec_type_attr) (abfd, sec);
@@ -5906,9 +5909,11 @@ _bfd_elf_init_private_section_data (bfd *ibfd,
|| obfd->xvec->flavour != bfd_target_elf_flavour)
return TRUE;
- /* FIXME: What if the output ELF section type has been set to
- something different? */
- if (elf_section_type (osec) == SHT_NULL)
+ /* Don't copy the output ELF section type from input if the
+ output BFD section flags has been set to something different.
+ elf_fake_sections will set ELF section type based on BFD
+ section flags. */
+ if (osec->flags == isec->flags || !osec->flags)
elf_section_type (osec) = elf_section_type (isec);
/* Set things up for objcopy and relocatable link. The output