[VMS/committed]: fix selective_search flag and dmt section creation

Tristan Gingold gingold@adacore.com
Mon May 3 16:04:00 GMT 2010


Hi,

did I commit my previous patch too early ?  After doing more tests, I have found that the dmt section
was created too late in some cases (ie after output_has_begun flag has been set too true).  The creation
of the DMT section is now done earlier.  Also, because the size of the library module header (MHD) has been
adjusted for ia64, the size threshold to read the selective_search flag had to be adjusted.

Tristan.

bfd/
2010-05-03  Tristan Gingold  <gingold@adacore.com>

	* vms-lib.c (vms_lib_bopen): Fix the size threshold to read
	selective_search flag.
	Add comments.
	* vms-alpha.c (alpha_vms_bfd_final_link): Create the DMT section
	before output_has_begun is set.

Index: bfd/vms-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-alpha.c,v
retrieving revision 1.5
diff -c -r1.5 vms-alpha.c
*** bfd/vms-alpha.c	3 May 2010 12:16:44 -0000	1.5
--- bfd/vms-alpha.c	3 May 2010 15:54:49 -0000
***************
*** 8364,8369 ****
--- 8364,8370 ----
    bfd_vma base_addr;
    bfd_vma last_addr;
    asection *dst;
+   asection *dmt;
  
    bfd_get_outsymbols (abfd) = NULL;
    bfd_get_symcount (abfd) = 0;
***************
*** 8478,8483 ****
--- 8479,8499 ----
    alpha_vms_link_hash (info)->fixup = fixupsec;
    alpha_vms_link_hash (info)->base_addr = base_addr;
  
+   /* Create the DMT section, if necessary.  */
+   dst = PRIV (dst_section);
+   if (dst != NULL && dst->size == 0)
+     dst = NULL;
+   if (dst != NULL)
+     {
+       dmt = bfd_make_section_anyway_with_flags
+         (info->output_bfd, "$DMT$",
+          SEC_DEBUGGING | SEC_HAS_CONTENTS | SEC_LINKER_CREATED);
+       if (dmt == NULL)
+         return FALSE;
+     }
+   else
+     dmt = NULL;
+ 
    /* Read all sections from the inputs.  */
    for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
      {
***************
*** 8491,8497 ****
          return FALSE;
      }
  
!   /* Handle all the link order information for the sections.  */
    for (o = abfd->sections; o != NULL; o = o->next)
      {
        for (p = o->map_head.link_order; p != NULL; p = p->next)
--- 8507,8514 ----
          return FALSE;
      }
  
!   /* Handle all the link order information for the sections.
!      Note: past this point, it is not possible to create new sections.  */
    for (o = abfd->sections; o != NULL; o = o->next)
      {
        for (p = o->map_head.link_order; p != NULL; p = p->next)
***************
*** 8518,8538 ****
      return FALSE;
  
    /* Compute the DMT.  */
!   dst = PRIV (dst_section);
!   if (dst != NULL && dst->size == 0)
!     dst = NULL;
!   if (dst != NULL)
      {
-       asection *dmt;
        int pass;
        unsigned char *contents = NULL;
  
-       dmt = bfd_make_section_anyway_with_flags
-         (info->output_bfd, "$DMT$",
-          SEC_DEBUGGING | SEC_HAS_CONTENTS | SEC_LINKER_CREATED);
-       if (dmt == NULL)
-         return FALSE;
- 
        /* In pass 1, compute the size.  In pass 2, write the DMT contents.  */
        for (pass = 0; pass < 2; pass++)
          {
--- 8535,8545 ----
      return FALSE;
  
    /* Compute the DMT.  */
!   if (dmt != NULL)
      {
        int pass;
        unsigned char *contents = NULL;
  
        /* In pass 1, compute the size.  In pass 2, write the DMT contents.  */
        for (pass = 0; pass < 2; pass++)
          {
Index: bfd/vms-lib.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-lib.c,v
retrieving revision 1.6
diff -c -r1.6 vms-lib.c
*** bfd/vms-lib.c	3 May 2010 10:23:33 -0000	1.6
--- bfd/vms-lib.c	3 May 2010 15:54:49 -0000
***************
*** 577,582 ****
--- 577,583 ----
            off = bfd_getl16 (sbm->next);
            if (off != 0)
              {
+               /* Read the 'next' array.  */
                sbmdesc->next = (unsigned short *)bfd_alloc
                  (abfd, sbm_len * sizeof (unsigned short));
                buf1 = data + off;
***************
*** 585,590 ****
--- 586,592 ----
              }
            else
              {
+               /* There is no next array if there is only one submap.  */
                BFD_ASSERT (tdata->nbr_dcxsbm == 1);
                sbmdesc->next = NULL;
              }
***************
*** 1200,1206 ****
    /* Check id.  */
    if (mhd->id != MHD__C_MHDID)
      return FALSE;
!   if (len >= sizeof (struct vms_mhd))
      el->selective_search = (mhd->objstat & MHD__M_SELSRC) ? 1 : 0;
    el->mtime = vms_rawtime_to_time_t (mhd->datim);
    el->mtime_set = TRUE;
--- 1202,1208 ----
    /* Check id.  */
    if (mhd->id != MHD__C_MHDID)
      return FALSE;
!   if (len >= MHD__C_MHDLEN + 1)
      el->selective_search = (mhd->objstat & MHD__M_SELSRC) ? 1 : 0;
    el->mtime = vms_rawtime_to_time_t (mhd->datim);
    el->mtime_set = TRUE;



More information about the Binutils mailing list