gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / bfd / elf64-hppa.c
index 77811580c679b535aea388ea8f10fb9be78937c7..7fc2dc0e0c1384babf3b7eee1c56c1a735d40dbc 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for HPPA 64-bit ELF
-   Copyright (C) 1999-2019 Free Software Foundation, Inc.
+   Copyright (C) 1999-2020 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -169,9 +169,6 @@ static struct bfd_link_hash_table *elf64_hppa_hash_table_create
 static bfd_boolean elf64_hppa_object_p
   (bfd *);
 
-static void elf64_hppa_post_process_headers
-  (bfd *, struct bfd_link_info *);
-
 static bfd_boolean elf64_hppa_create_dynamic_sections
   (bfd *, struct bfd_link_info *);
 
@@ -292,7 +289,7 @@ static struct bfd_link_hash_table*
 elf64_hppa_hash_table_create (bfd *abfd)
 {
   struct elf64_hppa_link_hash_table *htab;
-  bfd_size_type amt = sizeof (*htab);
+  size_t amt = sizeof (*htab);
 
   htab = bfd_zmalloc (amt);
   if (htab == NULL)
@@ -386,7 +383,9 @@ elf64_hppa_section_from_shdr (bfd *abfd,
   if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
     return FALSE;
 
-  return TRUE;
+  return ((hdr->sh_flags & SHF_PARISC_SHORT) == 0
+         || bfd_set_section_flags (hdr->bfd_section,
+                                   hdr->bfd_section->flags | SEC_SMALL_DATA));
 }
 
 /* SEC is a section containing relocs for an input BFD when linking; return
@@ -422,7 +421,7 @@ get_reloc_section (bfd *abfd,
                                                  | SEC_LINKER_CREATED
                                                  | SEC_READONLY));
       if (srel == NULL
-         || !bfd_set_section_alignment (dynobj, srel, 3))
+         || !bfd_set_section_alignment (srel, 3))
        return FALSE;
     }
 
@@ -535,8 +534,7 @@ elf64_hppa_check_relocs (bfd *abfd,
 
         ?!? Note we leak the last section_syms array.  Presumably we
         could free it in one of the later routines in this file.  */
-      if (hppa_info->section_syms)
-       free (hppa_info->section_syms);
+      free (hppa_info->section_syms);
 
       /* Read this BFD's local symbols.  */
       if (symtab_hdr->sh_info != 0)
@@ -1120,16 +1118,18 @@ allocate_global_data_opd (struct elf_link_hash_entry *eh, void *data)
 /* HP requires the EI_OSABI field to be filled in.  The assignment to
    EI_ABIVERSION may not be strictly necessary.  */
 
-static void
-elf64_hppa_post_process_headers (bfd *abfd,
-                        struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
+static bfd_boolean
+elf64_hppa_init_file_header (bfd *abfd, struct bfd_link_info *info)
 {
-  Elf_Internal_Ehdr * i_ehdrp;
+  Elf_Internal_Ehdr *i_ehdrp;
 
-  i_ehdrp = elf_elfheader (abfd);
+  if (!_bfd_elf_init_file_header (abfd, info))
+    return FALSE;
 
+  i_ehdrp = elf_elfheader (abfd);
   i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
   i_ehdrp->e_ident[EI_ABIVERSION] = 1;
+  return TRUE;
 }
 
 /* Create function descriptor section (.opd).  This section is called .opd
@@ -1159,7 +1159,7 @@ get_opd (bfd *abfd,
                                                 | SEC_IN_MEMORY
                                                 | SEC_LINKER_CREATED));
       if (!opd
-         || !bfd_set_section_alignment (abfd, opd, 3))
+         || !bfd_set_section_alignment (opd, 3))
        {
          BFD_ASSERT (0);
          return FALSE;
@@ -1195,7 +1195,7 @@ get_plt (bfd *abfd,
                                                 | SEC_IN_MEMORY
                                                 | SEC_LINKER_CREATED));
       if (!plt
-         || !bfd_set_section_alignment (abfd, plt, 3))
+         || !bfd_set_section_alignment (plt, 3))
        {
          BFD_ASSERT (0);
          return FALSE;
@@ -1231,7 +1231,7 @@ get_dlt (bfd *abfd,
                                                 | SEC_IN_MEMORY
                                                 | SEC_LINKER_CREATED));
       if (!dlt
-         || !bfd_set_section_alignment (abfd, dlt, 3))
+         || !bfd_set_section_alignment (dlt, 3))
        {
          BFD_ASSERT (0);
          return FALSE;
@@ -1267,7 +1267,7 @@ get_stub (bfd *abfd,
                                                  | SEC_READONLY
                                                  | SEC_LINKER_CREATED));
       if (!stub
-         || !bfd_set_section_alignment (abfd, stub, 3))
+         || !bfd_set_section_alignment (stub, 3))
        {
          BFD_ASSERT (0);
          return FALSE;
@@ -1347,7 +1347,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd,
                                           | SEC_READONLY
                                           | SEC_LINKER_CREATED));
   if (s == NULL
-      || !bfd_set_section_alignment (abfd, s, 3))
+      || !bfd_set_section_alignment (s, 3))
     return FALSE;
   hppa_info->dlt_rel_sec = s;
 
@@ -1358,7 +1358,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd,
                                           | SEC_READONLY
                                           | SEC_LINKER_CREATED));
   if (s == NULL
-      || !bfd_set_section_alignment (abfd, s, 3))
+      || !bfd_set_section_alignment (s, 3))
     return FALSE;
   hppa_info->plt_rel_sec = s;
 
@@ -1369,7 +1369,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd,
                                           | SEC_READONLY
                                           | SEC_LINKER_CREATED));
   if (s == NULL
-      || !bfd_set_section_alignment (abfd, s, 3))
+      || !bfd_set_section_alignment (s, 3))
     return FALSE;
   hppa_info->other_rel_sec = s;
 
@@ -1380,7 +1380,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd,
                                           | SEC_READONLY
                                           | SEC_LINKER_CREATED));
   if (s == NULL
-      || !bfd_set_section_alignment (abfd, s, 3))
+      || !bfd_set_section_alignment (s, 3))
     return FALSE;
   hppa_info->opd_rel_sec = s;
 
@@ -1750,7 +1750,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
 
       /* It's OK to base decisions on the section name, because none
         of the dynobj section names depend upon the input files.  */
-      name = bfd_get_section_name (dynobj, sec);
+      name = bfd_section_name (sec);
 
       if (strcmp (name, ".plt") == 0)
        {
@@ -1783,8 +1783,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
                     entry.  The entries in the .rela.plt section
                     really apply to the .got section, which we
                     created ourselves and so know is not readonly.  */
-                 outname = bfd_get_section_name (output_bfd,
-                                                 sec->output_section);
+                 outname = bfd_section_name (sec->output_section);
                  target = bfd_get_section_by_name (output_bfd, outname + 4);
                  if (target != NULL
                      && (target->flags & SEC_READONLY) != 0
@@ -3040,7 +3039,7 @@ elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
   /* Do not attempt to sort non-regular files.  This is here
      especially for configure scripts and kernel builds which run
      tests with "ld [...] -o /dev/null".  */
-  if (stat (abfd->filename, &buf) != 0
+  if (stat (bfd_get_filename (abfd), &buf) != 0
       || !S_ISREG(buf.st_mode))
     return TRUE;
 
@@ -3882,13 +3881,14 @@ elf64_hppa_relocate_section (bfd *output_bfd,
          else if (!bfd_link_relocatable (info))
            {
              bfd_boolean err;
-             err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
-                    || ELF_ST_VISIBILITY (eh->other) != STV_DEFAULT);
-             (*info->callbacks->undefined_symbol) (info,
-                                                   eh->root.root.string,
-                                                   input_bfd,
-                                                   input_section,
-                                                   rel->r_offset, err);
+
+             err = (info->unresolved_syms_in_objects == RM_DIAGNOSE
+                    && !info->warn_unresolved_syms)
+               || ELF_ST_VISIBILITY (eh->other) != STV_DEFAULT;
+
+             info->callbacks->undefined_symbol
+               (info, eh->root.root.string, input_bfd,
+                input_section, rel->r_offset, err);
            }
 
          if (!bfd_link_relocatable (info)
@@ -3900,7 +3900,7 @@ elf64_hppa_relocate_section (bfd *output_bfd,
              if (info->unresolved_syms_in_objects == RM_IGNORE
                  && ELF_ST_VISIBILITY (eh->other) == STV_DEFAULT
                  && eh->type == STT_PARISC_MILLI)
-               (*info->callbacks->undefined_symbol)
+               info->callbacks->undefined_symbol
                  (info, eh_name (eh), input_bfd,
                   input_section, rel->r_offset, FALSE);
            }
@@ -3938,7 +3938,7 @@ elf64_hppa_relocate_section (bfd *output_bfd,
                    if (sym_name == NULL)
                      return FALSE;
                    if (*sym_name == '\0')
-                     sym_name = bfd_section_name (input_bfd, sym_sec);
+                     sym_name = bfd_section_name (sym_sec);
                  }
 
                (*info->callbacks->reloc_overflow)
@@ -4025,7 +4025,7 @@ const struct elf_size_info hppa64_elf_size_info =
 
 #define elf_backend_create_dynamic_sections \
                                        elf64_hppa_create_dynamic_sections
-#define elf_backend_post_process_headers       elf64_hppa_post_process_headers
+#define elf_backend_init_file_header   elf64_hppa_init_file_header
 
 #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all
 
This page took 0.028038 seconds and 4 git commands to generate.