2012-04-17 Tristan Gingold <gingold@adacore.com>
+ * vms-lib.c (_bfd_vms_lib_get_module): Append .obj extension to
+ member of an object archive.<
+
+2012-04-17 Tristan Gingold <gingold@adacore.com>
+
* vms-lib.c (MAX_EKEYLEN): Define.
(MAX_KEYLEN): Fix value.
(vms_write_index): Add comments and fix indentation.
struct lib_tdata *tdata = bfd_libdata (abfd);
bfd *res;
file_ptr file_off;
+ char *name;
/* Sanity check. */
if (modidx >= tdata->nbr_modules)
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 = name;
tdata->cache[modidx] = res;