[VMS/committed]: Set extension to archive member

Tristan Gingold gingold@adacore.com
Tue Apr 17 11:27:00 GMT 2012


Hi,

VMS archives member names doesn't have extension (only the 'basename' is stored).
But this is not the usual convention for ar, and some tools (libtool) expect that extracted
members of an archive to have the standard object extension.

This patch implements this behaviour, thus making VMS archives more UNIX friendly.

Committed on trunk.

Tristan.

bfd/
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.<

Index: vms-lib.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-lib.c,v
retrieving revision 1.21
diff -c -p -r1.21 vms-lib.c
*** vms-lib.c	17 Apr 2012 10:28:19 -0000	1.21
--- vms-lib.c	17 Apr 2012 10:47:01 -0000
*************** _bfd_vms_lib_get_module (bfd *abfd, unsi
*** 1296,1301 ****
--- 1296,1302 ----
    struct lib_tdata *tdata = bfd_libdata (abfd);
    bfd *res;
    file_ptr file_off;
+   char *name;
  
    /* Sanity check.  */
    if (modidx >= tdata->nbr_modules)
*************** _bfd_vms_lib_get_module (bfd *abfd, unsi
*** 1357,1363 ****
        res->origin = file_off + tdata->mhd_size;
      }
  
!   res->filename = tdata->modules[modidx].name;
  
    tdata->cache[modidx] = res;
  
--- 1358,1382 ----
        res->origin = file_off + tdata->mhd_size;
      }
  
!   /* 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;
  



More information about the Binutils mailing list