[ARC] Fix typo in extension instruction name.
[deliverable/binutils-gdb.git] / bfd / vms-lib.c
index 78696951f2f478783a8e8fdb63bbe2ef8b875a73..863b915dfe1696a435ed8c52ff25bdfdffa0972d 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for VMS archive files.
 
-   Copyright 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2016 Free Software Foundation, Inc.
    Written by Tristan Gingold <gingold@adacore.com>, AdaCore.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -25,6 +25,7 @@
 #include "libbfd.h"
 #include "safe-ctype.h"
 #include "bfdver.h"
+#include "libiberty.h"
 #include "vms.h"
 #include "vms/lbr.h"
 #include "vms/dcx.h"
@@ -630,7 +631,7 @@ _bfd_vms_lib_archive_p (bfd *abfd, enum vms_lib_kind kind)
 
  err:
   bfd_release (abfd, tdata);
-  abfd->tdata.any = (void *)tdata_hold;;
+  abfd->tdata.any = (void *)tdata_hold;
   return NULL;
 }
 
@@ -1296,6 +1297,7 @@ _bfd_vms_lib_get_module (bfd *abfd, unsigned int modidx)
   struct lib_tdata *tdata = bfd_libdata (abfd);
   bfd *res;
   file_ptr file_off;
+  char *name;
 
   /* Sanity check.  */
   if (modidx >= tdata->nbr_modules)
@@ -1336,7 +1338,7 @@ _bfd_vms_lib_get_module (bfd *abfd, unsigned int modidx)
       res = _bfd_create_empty_archive_element_shell (abfd);
       if (res == NULL)
         return NULL;
-      arelt = bfd_zalloc (res, sizeof (*arelt));
+      arelt = bfd_zmalloc (sizeof (*arelt));
       if (arelt == NULL)
         return NULL;
       res->arelt_data = arelt;
@@ -1357,7 +1359,25 @@ _bfd_vms_lib_get_module (bfd *abfd, unsigned int modidx)
       res->origin = file_off + tdata->mhd_size;
     }
 
-  res->filename = tdata->modules[modidx].name;
+  /* Set filename.  */
+  name = tdata->modules[modidx].name;
+  switch (tdata->type)
+    {
+    case LBR__C_TYP_IOBJ:
+    case LBR__C_TYP_EOBJ:
+      /* For object archives, append .obj to mimic standard behaviour.  */
+      {
+       size_t namelen = strlen (name);
+       char *name1 = bfd_alloc (res, namelen + 4 + 1);
+       memcpy (name1, name, namelen);
+       strcpy (name1 + namelen, ".obj");
+       name = name1;
+      }
+      break;
+    default:
+      break;
+    }
+  res->filename = xstrdup (name);
 
   tdata->cache[modidx] = res;
 
@@ -2291,7 +2311,7 @@ _bfd_vms_lib_write_archive_contents (bfd *arch)
 /* Add a target for text library.  This costs almost nothing and is useful to
    read VMS library on the host.  */
 
-const bfd_target vms_lib_txt_vec =
+const bfd_target alpha_vms_lib_txt_vec =
 {
   "vms-libtxt",                        /* Name.  */
   bfd_target_unknown_flavour,
@@ -2327,5 +2347,5 @@ const bfd_target vms_lib_txt_vec =
 
   NULL,
 
-  (PTR) 0
+  NULL
 };
This page took 0.038338 seconds and 4 git commands to generate.