diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b29d8504976d07cb8e5661db07d8967c7654163d..8b51b177e396dadb24d70383f6ab54001433c8a4 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +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. + 2009-08-30 H.J. Lu <hongjiu.lu@intel.com> * elf32-i386.c (elf_i386_finish_dynamic_symbol): Revert the diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 8f70d7923a048fb0d45601840acaab6452e5b42b..7fbba61f5d480416f20825dc24f787ce0b715e7c 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -2108,6 +2108,8 @@ extern bfd_boolean _bfd_elf_map_sections_to_segments extern bfd_boolean _bfd_elf_is_function_type (unsigned int); +extern int bfd_elf_get_default_section_type (flagword); + extern Elf_Internal_Phdr * _bfd_elf_find_segment_containing_section (bfd * abfd, asection * section); diff --git a/bfd/elf.c b/bfd/elf.c index 408cebd9f4c7023e57bda36b3cc43e38632388af..13f690465ee12b9b7604536ff8a0e366fe5b5f88 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; diff --git a/gas/ChangeLog b/gas/ChangeLog index 34354adee53995509cee2f659eaee2a1a2cc0d5d..d318c92f09476f09e5b612a20129d76eecce3e02 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +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. + 2009-08-31 Jie Zhang <jie.zhang@analog.com> * config/bfin-aux.h: Change format from DOS to UNIX. diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index dd9118352068795d3ffd597b9df8b125d7cd6f0c..4441fb37be3da8a210322bc6191c9ec2af8e5809 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -685,6 +685,8 @@ obj_elf_change_section (const char *name, { symbolS *secsym; + if (type == SHT_NULL) + type = bfd_elf_get_default_section_type (flags); elf_section_type (sec) = type; elf_section_flags (sec) = attr; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index ab53121480830ccd52ad72d72a084a8c965eac2f..4a2f405bf956147903572a921fa55ae3e7663d86 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-08-31 Jan Beulich <jbeulich@novell.com> + + * gas/elf/section5.l: Remove no longer issued warning pattern. + 2009-08-29 Matt Fleming <matt@console-pimps.org> * gas/sh/sign-extension.d: New file. diff --git a/gas/testsuite/gas/elf/section5.l b/gas/testsuite/gas/elf/section5.l index ed547583d733b6a2cc10c1f768b75467f1add31d..31b87e603511446e2a0f9b8a1c24f3ea4809e827 100644 --- a/gas/testsuite/gas/elf/section5.l +++ b/gas/testsuite/gas/elf/section5.l @@ -2,7 +2,6 @@ .*:7: Warning: .* .*:7: Warning: .* .*:10: Warning: .* -.*:13: Warning: .* .*:16: Warning: .* .*:18: Warning: .* .*:20: Warning: .*