summaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2009-08-31 12:02:36 +0000
committerJan Beulich <jbeulich@novell.com>2009-08-31 12:02:36 +0000
commit99ee115b8d70a0d74bcd0ac954b32e4b0dc634f4 (patch)
treef629ef8634d6f555073ec693bb0dfc58ca0926cb /bfd/elf.c
parent6325237f0c1c2dfa287c9f9ad341215553b9f78a (diff)
downloadbinutils-redhat-99ee115b8d70a0d74bcd0ac954b32e4b0dc634f4.tar.gz
bfd/
2009-08-31 Jan Beulich <jbeulich@novell.com> * elf-bfd.h (bfd_elf_get_default_section_type): Declare. * elf.c (bfd_elf_get_default_section_type): New. (elf_fake_sections): Use bfd_elf_get_default_section_type. gas/ 2009-08-31 Jan Beulich <jbeulich@novell.com> * config/obj-elf.c (obj_elf_change_section): Set default type by calling bfd_elf_get_default_section_type. gas/testsuite/ 2009-08-31 Jan Beulich <jbeulich@novell.com> * gas/elf/section5.l: Remove no longer issued warning pattern.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 408cebd9f4..13f690465e 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2422,6 +2422,18 @@ _bfd_elf_init_reloc_shdr (bfd *abfd,
return TRUE;
}
+/* Return the default section type based on the passed in section flags. */
+
+int
+bfd_elf_get_default_section_type (flagword flags)
+{
+ if ((flags & SEC_ALLOC) != 0
+ && ((flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0
+ || (flags & SEC_NEVER_LOAD) != 0))
+ return SHT_NOBITS;
+ return SHT_PROGBITS;
+}
+
/* Set up an ELF internal section header for a section. */
static void
@@ -2471,12 +2483,8 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
asect->flags. */
if ((asect->flags & SEC_GROUP) != 0)
sh_type = SHT_GROUP;
- else if ((asect->flags & SEC_ALLOC) != 0
- && (((asect->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
- || (asect->flags & SEC_NEVER_LOAD) != 0))
- sh_type = SHT_NOBITS;
else
- sh_type = SHT_PROGBITS;
+ sh_type = bfd_elf_get_default_section_type (asect->flags);
if (this_hdr->sh_type == SHT_NULL)
this_hdr->sh_type = sh_type;