ubsan: moxie: left shift of negative value
[deliverable/binutils-gdb.git] / bfd / vms-alpha.c
index b52f580ad3358060e702d9b3d9dac21f76bb0af9..4dde056e1ee67e638a3af4beda2a08897f0e557b 100644 (file)
@@ -1,5 +1,5 @@
 /* vms.c -- BFD back-end for EVAX (openVMS/Alpha) files.
-   Copyright (C) 1996-2018 Free Software Foundation, Inc.
+   Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
    Initial version written by Klaus Kaempf (kkaempf@rmi.de)
    Major rewrite by Adacore.
@@ -632,7 +632,7 @@ _bfd_vms_slurp_eisd (bfd *abfd, unsigned int offset)
       section->size = size;
       section->vma = vaddr;
 
-      if (!bfd_set_section_flags (abfd, section, bfd_flags))
+      if (!bfd_set_section_flags (section, bfd_flags))
        return FALSE;
     }
 
@@ -687,7 +687,7 @@ _bfd_vms_slurp_eihs (bfd *abfd, unsigned int offset)
       section->size = dstsize;
       section->filepos = VMS_BLOCK_SIZE * (dstvbn - 1);
 
-      if (!bfd_set_section_flags (abfd, section, bfd_flags))
+      if (!bfd_set_section_flags (section, bfd_flags))
        return FALSE;
 
       PRIV (dst_section) = section;
@@ -705,7 +705,7 @@ _bfd_vms_slurp_eihs (bfd *abfd, unsigned int offset)
       section->size = dmtbytes;
       section->filepos = VMS_BLOCK_SIZE * (dmtvbn - 1);
 
-      if (!bfd_set_section_flags (abfd, section, bfd_flags))
+      if (!bfd_set_section_flags (section, bfd_flags))
        return FALSE;
     }
 
@@ -1261,7 +1261,7 @@ _bfd_vms_slurp_egsd (bfd *abfd)
                    new_flags |= SEC_CODE;
                    new_flags &= ~SEC_DATA;
                  }
-               if (!bfd_set_section_flags (abfd, section, new_flags))
+               if (!bfd_set_section_flags (section, new_flags))
                  return FALSE;
 
                /* Give a non-overlapping vma to non absolute sections.  */
@@ -2441,7 +2441,7 @@ vms_slurp_debug (bfd *abfd)
       section = bfd_make_section (abfd, "$DST$");
       if (!section)
        return FALSE;
-      if (!bfd_set_section_flags (abfd, section, flags))
+      if (!bfd_set_section_flags (section, flags))
        return FALSE;
       PRIV (dst_section) = section;
     }
@@ -4001,6 +4001,7 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
                  break;
 
                case ALPHA_R_LINKAGE:
+                 size = 16;
                  etir_output_check (abfd, section, curr_addr, 64);
                  _bfd_vms_output_begin_subrec (recwr, ETIR__C_STC_LP_PSB);
                  _bfd_vms_output_long
@@ -4093,7 +4094,10 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
            {
              /* Output rest of section.  */
              if (curr_addr > section->size)
-               _bfd_error_handler (_("size error in section %pA"), section);
+               {
+                 _bfd_error_handler (_("size error in section %pA"), section);
+                 return FALSE;
+               }
              size = section->size - curr_addr;
              sto_imm (abfd, section, size, curr_data, curr_addr);
              curr_data += size;
@@ -4619,7 +4623,7 @@ build_module_list (bfd *abfd)
         section and build the list of modules.  This is sufficient
         since we can compute the start address and the end address
         of every module from the section contents.  */
-      bfd_size_type size = bfd_get_section_size (dmt);
+      bfd_size_type size = bfd_section_size (dmt);
       unsigned char *ptr, *end;
 
       ptr = (unsigned char *) bfd_alloc (abfd, size);
@@ -5157,6 +5161,7 @@ alpha_vms_slurp_relocs (bfd *abfd)
            asection *sec;
            struct vms_section_data_struct *vms_sec;
            arelent *reloc;
+           bfd_size_type size;
 
            /* Get section to which the relocation applies.  */
            if (cur_psect < 0 || cur_psect > (int)PRIV (section_count))
@@ -5237,7 +5242,11 @@ alpha_vms_slurp_relocs (bfd *abfd)
            reloc->address = cur_address;
            reloc->addend = cur_addend;
 
-           vaddr += bfd_get_reloc_size (reloc->howto);
+           if (reloc_code == ALPHA_R_LINKAGE)
+             size = 16;
+           else
+             size = bfd_get_reloc_size (reloc->howto);
+           vaddr += size;
          }
 
          cur_addend = 0;
@@ -5496,8 +5505,8 @@ static reloc_howto_type alpha_howto_table[] =
   /* Hack. Linkage is done by linker.  */
   HOWTO (ALPHA_R_LINKAGE,      /* Type.  */
         0,                     /* Rightshift.  */
-        8,                     /* Size (0 = byte, 1 = short, 2 = long).  */
-        256,                   /* Bitsize.  */
+        0,                     /* Size (0 = byte, 1 = short, 2 = long).  */
+        0,                     /* Bitsize.  */
         FALSE,                 /* PC relative.  */
         0,                     /* Bitpos.  */
         complain_overflow_dont,/* Complain_on_overflow.  */
@@ -5601,7 +5610,7 @@ static reloc_howto_type alpha_howto_table[] =
 /* Return a pointer to a howto structure which, when invoked, will perform
    the relocation code on data from the architecture noted.  */
 
-static const struct reloc_howto_struct *
+static reloc_howto_type *
 alpha_vms_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
                                 bfd_reloc_code_real_type code)
 {
@@ -8903,8 +8912,8 @@ alpha_vms_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
       return FALSE;
     }
 
-  bfd_get_outsymbols (abfd) = NULL;
-  bfd_get_symcount (abfd) = 0;
+  abfd->outsymbols = NULL;
+  abfd->symcount = 0;
 
   /* Mark all sections which will be included in the output file.  */
   for (o = abfd->sections; o != NULL; o = o->next)
@@ -9315,7 +9324,7 @@ vms_new_section_hook (bfd * abfd, asection *section)
   vms_debug2 ((1, "vms_new_section_hook (%p, [%u]%s)\n",
               abfd, section->index, section->name));
 
-  if (! bfd_set_section_alignment (abfd, section, 0))
+  if (!bfd_set_section_alignment (section, 0))
     return FALSE;
 
   vms_debug2 ((7, "%u: %s\n", section->index, section->name));
@@ -9403,11 +9412,11 @@ vms_get_symbol_info (bfd * abfd ATTRIBUTE_UNUSED,
   else if (bfd_is_ind_section (sec))
     ret->type = 'I';
   else if ((symbol->flags & BSF_FUNCTION)
-          || (bfd_get_section_flags (abfd, sec) & SEC_CODE))
+          || (bfd_section_flags (sec) & SEC_CODE))
     ret->type = 'T';
-  else if (bfd_get_section_flags (abfd, sec) & SEC_DATA)
+  else if (bfd_section_flags (sec) & SEC_DATA)
     ret->type = 'D';
-  else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
+  else if (bfd_section_flags (sec) & SEC_ALLOC)
     ret->type = 'B';
   else
     ret->type = '?';
@@ -9495,9 +9504,11 @@ bfd_vms_get_data (bfd *abfd)
 #define vms_bfd_copy_link_hash_symbol_type \
   _bfd_generic_copy_link_hash_symbol_type
 #define vms_bfd_is_group_section         bfd_generic_is_group_section
+#define vms_bfd_group_name               bfd_generic_group_name
 #define vms_bfd_discard_group            bfd_generic_discard_group
 #define vms_section_already_linked       _bfd_generic_section_already_linked
 #define vms_bfd_define_common_symbol     bfd_generic_define_common_symbol
+#define vms_bfd_link_hide_symbol         _bfd_generic_link_hide_symbol
 #define vms_bfd_define_start_stop         bfd_generic_define_start_stop
 #define vms_bfd_copy_private_header_data  _bfd_generic_bfd_copy_private_header_data
 
@@ -9540,11 +9551,13 @@ bfd_vms_get_data (bfd *abfd)
 #define alpha_vms_bfd_lookup_section_flags bfd_generic_lookup_section_flags
 #define alpha_vms_bfd_merge_sections bfd_generic_merge_sections
 #define alpha_vms_bfd_is_group_section bfd_generic_is_group_section
+#define alpha_vms_bfd_group_name bfd_generic_group_name
 #define alpha_vms_bfd_discard_group bfd_generic_discard_group
 #define alpha_vms_section_already_linked \
   _bfd_generic_section_already_linked
 
 #define alpha_vms_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define alpha_vms_bfd_link_hide_symbol _bfd_generic_link_hide_symbol
 #define alpha_vms_bfd_define_start_stop bfd_generic_define_start_stop
 #define alpha_vms_bfd_link_just_syms _bfd_generic_link_just_syms
 #define alpha_vms_bfd_copy_link_hash_symbol_type \
This page took 0.026332 seconds and 4 git commands to generate.