Preserve machine dependent section header flags when reading ELF object file.
authorJim Wilson <wilson@tuliptree.org>
Thu, 5 Oct 2000 22:22:27 +0000 (22:22 +0000)
committerJim Wilson <wilson@tuliptree.org>
Thu, 5 Oct 2000 22:22:27 +0000 (22:22 +0000)
* elf-bfd.h (struct elf_backend_data): Add elf_backend_section_flags
field.
* elf.c (_bfd_elf_make_section_from_shdr): Call the
elf_backend_section_flags function.
* elf64-ia64.c (elf64_ia64_section_from_shdr): Delete flag conversion
code.
(elf64_ia64_section_flags): New function containing flag conversion
code.
(elf_backend_section_flags): Define to elf64_ia64_section_flags.
* elfxx-target.h (elf_backend_section_flags): Define.
(elfNN_bed): Initialize elf_backend_section_flags field.

bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf.c
bfd/elf64-ia64.c
bfd/elfxx-target.h

index 322ae48fff4a016cf9d69a945b8d421c43d86c60..dc4e67d5a9b27313f1f906898601817b250c7cbd 100644 (file)
@@ -1,3 +1,17 @@
+2000-10-05  Jim Wilson  <wilson@cygnus.com>
+
+       * elf-bfd.h (struct elf_backend_data): Add elf_backend_section_flags
+       field.
+       * elf.c (_bfd_elf_make_section_from_shdr): Call the
+       elf_backend_section_flags function.
+       * elf64-ia64.c (elf64_ia64_section_from_shdr): Delete flag conversion
+       code.
+       (elf64_ia64_section_flags): New function containing flag conversion
+       code.
+       (elf_backend_section_flags): Define to elf64_ia64_section_flags.
+       * elfxx-target.h (elf_backend_section_flags): Define.
+       (elfNN_bed): Initialize elf_backend_section_flags field.
+
 2000-10-02  Alan Modra  <alan@linuxcare.com.au>
 
        * elf32-hppa.c (elf32_hppa_check_relocs): Correct call to
index b84948f63a26aad035750ee0e7e5c5a9751401c9..574411c1bfc3bfe9b078d64a8e8b8651b9d05201 100644 (file)
@@ -391,6 +391,11 @@ struct elf_backend_data
                                                    Elf32_Internal_Shdr *,
                                                    char *));
 
+  /* A function to convert machine dependent section header flags to
+     BFD internal section header flags.  */
+  boolean (*elf_backend_section_flags) PARAMS ((flagword *,
+                                               Elf32_Internal_Shdr *));
+
   /* A function to handle unusual program segment types when creating BFD
      sections from ELF program segments. */
   boolean (*elf_backend_section_from_phdr) PARAMS ((bfd *,
index 5dac0a35a85e6c450b26f8e61ef23ecbb6617362..3aede147dfa0bfd7539b697a819b2ffa84b4eef9 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -345,6 +345,7 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
 {
   asection *newsect;
   flagword flags;
+  struct elf_backend_data *bed;
 
   if (hdr->bfd_section != NULL)
     {
@@ -410,6 +411,11 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
   if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
     flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
 
+  bed = get_elf_backend_data (abfd);
+  if (bed->elf_backend_section_flags)
+    if (! bed->elf_backend_section_flags (&flags, hdr))
+      return false;
+
   if (! bfd_set_section_flags (abfd, newsect, flags))
     return false;
 
index f1ea331b6c068c6ba29285e7b945f4e98e591a1c..cc6383894dc09262a2aa38795713468a71f66f85 100644 (file)
@@ -946,8 +946,21 @@ elf64_ia64_section_from_shdr (abfd, hdr, name)
     return false;
   newsect = hdr->bfd_section;
 
+  return true;
+}
+
+/* Convert IA-64 specific section flags to bfd internal section flags.  */
+
+/* ??? There is no bfd internal flag equivalent to the SHF_IA_64_NORECOV
+   flag.  */
+
+static boolean
+elf64_ia64_section_flags (flags, hdr)
+     flagword *flags;
+     Elf64_Internal_Shdr *hdr;
+{
   if (hdr->sh_flags & SHF_IA_64_SHORT)
-    newsect->flags |= SEC_SMALL_DATA;
+    *flags |= SEC_SMALL_DATA;
 
   return true;
 }
@@ -4064,6 +4077,8 @@ elf64_ia64_print_private_bfd_data (abfd, ptr)
 
 #define elf_backend_section_from_shdr \
        elf64_ia64_section_from_shdr
+#define elf_backend_section_flags \
+       elf64_ia64_section_flags
 #define elf_backend_fake_sections \
        elf64_ia64_fake_sections
 #define elf_backend_add_symbol_hook \
index 4c3ca1c41169b29c102ba91e829fae70ca509d9c..6957e3ae2ccb22e702238b06770cba2bf85d1d63 100644 (file)
@@ -237,6 +237,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #ifndef elf_backend_section_from_shdr
 #define elf_backend_section_from_shdr  0
 #endif
+#ifndef elf_backend_section_flags
+#define elf_backend_section_flags      0
+#endif
 #ifndef elf_backend_section_from_phdr
 #define elf_backend_section_from_phdr  0
 #endif
@@ -368,6 +371,7 @@ static CONST struct elf_backend_data elfNN_bed =
   elf_backend_get_symbol_type,
   elf_backend_section_processing,
   elf_backend_section_from_shdr,
+  elf_backend_section_flags,
   elf_backend_section_from_phdr,
   elf_backend_fake_sections,
   elf_backend_section_from_bfd_section,
This page took 0.03651 seconds and 4 git commands to generate.