gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / bfd / elf64-ia64-vms.c
index aa2aa119f5e6e7b6c8cde7c46b8ad89d49dd5c9f..a97858ebfbe8af1ac31f0f822b2ce3c14d2143f4 100644 (file)
@@ -1,5 +1,5 @@
 /* IA-64 support for OpenVMS
-   Copyright (C) 1998-2019 Free Software Foundation, Inc.
+   Copyright (C) 1998-2020 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -792,13 +792,11 @@ elf64_ia64_relax_section (bfd *abfd, asection *sec,
   return TRUE;
 
  error_return:
-  if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents)
+  if ((unsigned char *) isymbuf != symtab_hdr->contents)
     free (isymbuf);
-  if (contents != NULL
-      && elf_section_data (sec)->this_hdr.contents != contents)
+  if (elf_section_data (sec)->this_hdr.contents != contents)
     free (contents);
-  if (internal_relocs != NULL
-      && elf_section_data (sec)->relocs != internal_relocs)
+  if (elf_section_data (sec)->relocs != internal_relocs)
     free (internal_relocs);
   return FALSE;
 }
@@ -822,11 +820,10 @@ is_unwind_section_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
    flag.  */
 
 static bfd_boolean
-elf64_ia64_section_flags (flagword *flags,
-                         const Elf_Internal_Shdr *hdr)
+elf64_ia64_section_flags (const Elf_Internal_Shdr *hdr)
 {
   if (hdr->sh_flags & SHF_IA_64_SHORT)
-    *flags |= SEC_SMALL_DATA;
+    hdr->bfd_section->flags |= SEC_SMALL_DATA;
 
   return TRUE;
 }
@@ -1000,14 +997,11 @@ elf64_ia64_global_dyn_info_free (void **xentry,
   if (entry->root.root.type == bfd_link_hash_warning)
     entry = (struct elf64_ia64_link_hash_entry *) entry->root.root.u.i.link;
 
-  if (entry->info)
-    {
-      free (entry->info);
-      entry->info = NULL;
-      entry->count = 0;
-      entry->sorted_count = 0;
-      entry->size = 0;
-    }
+  free (entry->info);
+  entry->info = NULL;
+  entry->count = 0;
+  entry->sorted_count = 0;
+  entry->size = 0;
 
   return TRUE;
 }
@@ -1021,14 +1015,11 @@ elf64_ia64_local_dyn_info_free (void **slot,
   struct elf64_ia64_local_hash_entry *entry
     = (struct elf64_ia64_local_hash_entry *) *slot;
 
-  if (entry->info)
-    {
-      free (entry->info);
-      entry->info = NULL;
-      entry->count = 0;
-      entry->sorted_count = 0;
-      entry->size = 0;
-    }
+  free (entry->info);
+  entry->info = NULL;
+  entry->count = 0;
+  entry->sorted_count = 0;
+  entry->size = 0;
 
   return TRUE;
 }
@@ -1674,7 +1665,7 @@ get_dyn_sym_info (struct elf64_ia64_link_hash_table *ia64_info,
       *size_p = size;
       *info_p = info;
 
-has_space:
+    has_space:
       /* Append the new one to the array.  */
       dyn_i = info + count;
       memset (dyn_i, 0, sizeof (*dyn_i));
@@ -2845,7 +2836,7 @@ elf64_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
                                           elf_ia64_vms_ident (abfd)))
            return FALSE;
 
-         soname = vms_get_module_name (abfd->filename, TRUE);
+         soname = vms_get_module_name (bfd_get_filename (abfd), TRUE);
          if (soname == NULL)
            return FALSE;
          strindex = dynstrsec->size;
@@ -3284,7 +3275,7 @@ elf64_ia64_choose_gp (bfd *abfd, struct bfd_link_info *info, bfd_boolean final)
     {
       if (max_short_vma - min_short_vma >= 0x400000)
        {
-overflow:
+       overflow:
          _bfd_error_handler
            /* xgettext:c-format */
            (_("%pB: short data segment overflowed (%#" PRIx64 " >= 0x400000)"),
@@ -4234,6 +4225,10 @@ elf64_ia64_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   flagword in_flags;
   bfd_boolean ok = TRUE;
 
+  /* FIXME: What should be checked when linking shared libraries?  */
+  if ((ibfd->flags & DYNAMIC) != 0)
+    return TRUE;
+
   /* Don't even pretend to support mixed-format linking.  */
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
@@ -4374,7 +4369,7 @@ elf64_ia64_object_p (bfd *abfd)
   flagword flags;
   const char *name;
   char *unwi_name, *unw_name;
-  bfd_size_type amt;
+  size_t amt;
 
   if (abfd->flags & DYNAMIC)
     return TRUE;
@@ -4611,14 +4606,18 @@ elf64_vms_object_p (bfd *abfd)
   return TRUE;
 }
 
-static void
-elf64_vms_post_process_headers (bfd *abfd,
-                               struct bfd_link_info *info ATTRIBUTE_UNUSED)
+static bfd_boolean
+elf64_vms_init_file_header (bfd *abfd, struct bfd_link_info *info)
 {
-  Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
+  Elf_Internal_Ehdr *i_ehdrp;
+
+  if (!_bfd_elf_init_file_header (abfd, info))
+    return FALSE;
 
+  i_ehdrp = elf_elfheader (abfd);
   i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_OPENVMS;
   i_ehdrp->e_ident[EI_ABIVERSION] = 2;
+  return TRUE;
 }
 
 static bfd_boolean
@@ -4844,7 +4843,7 @@ elf64_vms_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
       /* Extract IDENT.  */
       if (!bfd_malloc_and_get_section (abfd, s, &dynbuf))
        {
-error_free_dyn:
+       error_free_dyn:
          free (dynbuf);
          goto error_return;
        }
@@ -5235,11 +5234,8 @@ error_free_dyn:
        }
     }
 
-  if (isymbuf != NULL)
-    {
-      free (isymbuf);
-      isymbuf = NULL;
-    }
+  free (isymbuf);
+  isymbuf = NULL;
 
   /* If this object is the same format as the output object, and it is
      not a shared library, then let the backend look through the
@@ -5296,8 +5292,7 @@ error_free_dyn:
 
  error_free_vers:
  error_free_sym:
-  if (isymbuf != NULL)
-    free (isymbuf);
+  free (isymbuf);
  error_return:
   return FALSE;
 }
@@ -5553,8 +5548,8 @@ static const struct elf_size_info elf64_ia64_vms_size_info = {
 #undef  elf_backend_section_from_shdr
 #define elf_backend_section_from_shdr elf64_vms_section_from_shdr
 
-#undef  elf_backend_post_process_headers
-#define elf_backend_post_process_headers elf64_vms_post_process_headers
+#undef  elf_backend_init_file_header
+#define elf_backend_init_file_header elf64_vms_init_file_header
 
 #undef  elf_backend_section_processing
 #define elf_backend_section_processing elf64_vms_section_processing
This page took 0.031835 seconds and 4 git commands to generate.