]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd/
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 26 Jul 2003 01:06:27 +0000 (01:06 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 26 Jul 2003 01:06:27 +0000 (01:06 +0000)
2003-07-25  H.J. Lu  <hongjiu.lu@intel.com>

* elf.c (_bfd_elf_new_section_hook): Set the default section
type to SHT_NULL.
(elf_fake_sections): Set the section type based on asect->flags
if it is SHT_NULL. Don't abort on processor specific section
types.

gas/

2003-07-25  H.J. Lu  <hongjiu.lu@intel.com>

* config/obj-elf.c (obj_elf_change_section): Update
elf_section_type and elf_section_flags only when they are
specified.

bfd/ChangeLog
bfd/elf.c
gas/ChangeLog
gas/config/obj-elf.c

index 80fc0a5356c0d54b91a4e65546c654f234d9feda..aabf428289c97587efa93ce92664f2e2b658a308 100644 (file)
@@ -1,3 +1,11 @@
+2003-07-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf.c (_bfd_elf_new_section_hook): Set the default section
+       type to SHT_NULL.
+       (elf_fake_sections): Set the section type based on asect->flags
+       if it is SHT_NULL. Don't abort on processor specific section
+       types.
+
 2003-07-25  H.J. Lu  <hongjiu.lu@intel.com>
 
        * bfd-in2.h: Regenerated.
index 95aa1929d5dfc3bd8d4f487b8a546f926d3b0bd8..9f7eb464dfe5881e675e7899f1f78eb479e5cc49 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2293,12 +2293,7 @@ _bfd_elf_new_section_hook (abfd, sec)
       sec->used_by_bfd = (PTR) sdata;
     }
 
-  if ((sec->flags & SEC_ALLOC) != 0
-      && (((sec->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
-         || (sec->flags & SEC_NEVER_LOAD) != 0))
-    elf_section_type (sec) = SHT_NOBITS;
-  else
-    elf_section_type (sec) = SHT_PROGBITS;
+  elf_section_type (sec) = SHT_NULL;
   if (sec->name && _bfd_elf_get_sec_type_attr (abfd, sec->name,
                                               &type, &attr))
     {
@@ -2544,14 +2539,21 @@ elf_fake_sections (abfd, asect, failedptrarg)
   this_hdr->bfd_section = asect;
   this_hdr->contents = NULL;
 
+  /* If the section type is unspecified, we set it based on
+     asect->flags.  */
+  if (this_hdr->sh_type == SHT_NULL)
+    {
+      if ((asect->flags & SEC_ALLOC) != 0
+         && (((asect->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
+             || (asect->flags & SEC_NEVER_LOAD) != 0))
+       this_hdr->sh_type = SHT_NOBITS;
+      else
+       this_hdr->sh_type = SHT_PROGBITS;
+    }
+
   switch (this_hdr->sh_type)
     {
     default:
-      (*_bfd_error_handler)
-       (_("%s: Section `%s' has unknown type 0x%0x"),
-       bfd_get_filename (asect->owner), asect->name,
-       this_hdr->sh_type);
-      abort ();
       break;
 
     case SHT_STRTAB:
index c46be5df0615a516f28e623637a0cdb54f71e200..fe4210685bd20ef8dfd61e0ab9f1db620aeaab29 100644 (file)
@@ -1,3 +1,9 @@
+2003-07-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * config/obj-elf.c (obj_elf_change_section): Update
+       elf_section_type and elf_section_flags only when they are
+       specified.
+
 2003-07-25  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/obj-elf.c (obj_elf_change_section): Always set section
index a8ba588370c1faff6a30838435c63f92b931df66..86879653e230cb606ee124b6ffa081f11cb42e74 100644 (file)
@@ -683,8 +683,10 @@ obj_elf_change_section (name, type, attr, entsize, group_name, linkonce, push)
       attr |= def_attr;
     }
 
-  elf_section_type (sec) = type;
-  elf_section_flags (sec) = attr;
+  if (type != SHT_NULL)
+    elf_section_type (sec) = type;
+  if (attr != 0)
+    elf_section_flags (sec) = attr;
 
   /* Convert ELF type and flags to BFD flags.  */
   flags = (SEC_RELOC