From: H.J. Lu Date: Wed, 26 Apr 2006 13:32:26 +0000 (+0000) Subject: 2006-04-26 H.J. Lu X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e843e0f8801fd13962c7cff7317b9a89292544e3;p=binutils-gdb.git 2006-04-26 H.J. Lu 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4c82cc16afa..1f1fafaf076 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2006-04-26 H.J. Lu + + 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 PR binutils/2467 diff --git a/bfd/elf.c b/bfd/elf.c index 04eff22e15a..e6977228d24 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