bfd/
authorTristan Gingold <gingold@adacore.com>
Mon, 3 May 2010 16:04:32 +0000 (16:04 +0000)
committerTristan Gingold <gingold@adacore.com>
Mon, 3 May 2010 16:04:32 +0000 (16:04 +0000)
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.

bfd/ChangeLog
bfd/vms-alpha.c
bfd/vms-lib.c

index 6ebbe7f2a2085a8e404d4034ec7f543923da770a..13c242de2c630c9ee7e59986e360a4b5d78a7f43 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2010-05-03  Tristan Gingold  <gingold@adacore.com>
 
        * vms-alpha.c: Add comments.
@@ -11,6 +19,7 @@
        Write the dmt section.
        (evax_bfd_print_image): Also print the dst size in hexa.  Fix typo.
        (alpha_vms_read_sections_content): Do not set image_autoextend.
+       (alpha_vms_bfd_final_link): Generate the dst.
 
 2010-05-03  Tristan Gingold  <gingold@adacore.com>
 
index 92d0693567adb3c47f876de593165b579fcad2ba..5ae54c245a95a5dc5c7f48576543ea6edeb23283 100644 (file)
@@ -8364,6 +8364,7 @@ alpha_vms_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
   bfd_vma base_addr;
   bfd_vma last_addr;
   asection *dst;
+  asection *dmt;
 
   bfd_get_outsymbols (abfd) = NULL;
   bfd_get_symcount (abfd) = 0;
@@ -8478,6 +8479,21 @@ alpha_vms_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
   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,7 +8507,8 @@ alpha_vms_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
         return FALSE;
     }
 
-  /* Handle all the link order information for the sections.  */
+  /* 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,21 +8535,11 @@ alpha_vms_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
     return FALSE;
 
   /* Compute the DMT.  */
-  dst = PRIV (dst_section);
-  if (dst != NULL && dst->size == 0)
-    dst = NULL;
-  if (dst != NULL)
+  if (dmt != 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++)
         {
index bbef19c7f4191a69d617aeb9b48b32df7905f9b9..0b45a131b8de92ccf6d939e0efeb22e550e6f687 100644 (file)
@@ -577,6 +577,7 @@ _bfd_vms_lib_archive_p (bfd *abfd, enum vms_lib_kind kind)
           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,6 +586,7 @@ _bfd_vms_lib_archive_p (bfd *abfd, enum vms_lib_kind kind)
             }
           else
             {
+              /* There is no next array if there is only one submap.  */
               BFD_ASSERT (tdata->nbr_dcxsbm == 1);
               sbmdesc->next = NULL;
             }
@@ -1200,7 +1202,7 @@ vms_lib_bopen (bfd *el, file_ptr filepos)
   /* Check id.  */
   if (mhd->id != MHD__C_MHDID)
     return FALSE;
-  if (len >= sizeof (struct vms_mhd))
+  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;
This page took 0.032137 seconds and 4 git commands to generate.