bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/273] FAIL: size -A


From: dave at hiauly1 dot hia dot nrc dot ca
Subject: [Bug binutils/273] FAIL: size -A
Date: 28 Jul 2004 03:27:38 -0000

------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  
2004-07-28 03:27 -------
Subject: Re:  FAIL: size -A

> Something like this ?

> +       space_size += save_subspace.subspace_length;
                        ^
                        subspace
> --- 2116,2135 ----
>         if (!save_subspace.file_loc_init_value)
>       space_asect->size = 0;
>         else
> !     {
> ! #if 0
> !       /* Setup the size for the space section based upon the info in the
> !          last subspace of the space.  */
> !       space_asect->size = (save_subspace.subspace_start
> !                            - space_asect->vma
> !                            + save_subspace.subspace_length);

I came to the conclusion that we should retain the old code when the
object isn't relocatable only.  I tweaked the patch a bit.  It fixes
the regression and has no new fails.

I'm wondering if spaces should included in the total.

Dave
-- 
J. David Anglin                                  address@hidden
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

Index: som.c
===================================================================
RCS file: /cvs/src/src/bfd/som.c,v
retrieving revision 1.46
diff -u -3 -p -r1.46 som.c
--- som.c       21 Jul 2004 15:42:57 -0000      1.46
+++ som.c       28 Jul 2004 03:10:03 -0000
@@ -1913,6 +1913,7 @@ setup_sections (abfd, file_hdr, current_
       struct som_subspace_dictionary_record subspace, save_subspace;
       unsigned int subspace_index;
       asection *space_asect;
+      bfd_size_type space_size = 0;
       char *newname;
 
       /* Read the space dictionary element.  */
@@ -2104,6 +2105,9 @@ setup_sections (abfd, file_hdr, current_
          subspace_asect->alignment_power = exact_log2 (subspace.alignment);
          if (subspace_asect->alignment_power == (unsigned) -1)
            goto error_return;
+
+         /* Keep track of the accumulated sizes of the sections.  */
+         space_size += subspace.subspace_length;
        }
 
       /* This can happen for a .o which defines symbols in otherwise
@@ -2111,11 +2115,25 @@ setup_sections (abfd, file_hdr, current_
       if (!save_subspace.file_loc_init_value)
        space_asect->size = 0;
       else
-       /* Setup the size for the space section based upon the info in the
-          last subspace of the space.  */
-       space_asect->size = (save_subspace.subspace_start
-                            - space_asect->vma
-                            + save_subspace.subspace_length);
+       {
+         if (file_hdr->a_magic != RELOC_MAGIC)
+           {
+             /* Setup the size for the space section based upon the info
+                in the last subspace of the space.  */
+             space_asect->size = (save_subspace.subspace_start
+                                  - space_asect->vma
+                                  + save_subspace.subspace_length);
+           }
+         else
+           {
+             /* The subspace_start field is not initialised in relocatable
+                only objects, so it cannot be used for length calculations.
+                Instead we use the space_size value which we have been
+                accumulating.  This isn't an accurate estimate since it
+                ignores alignment and ordering issues.  */
+             space_asect->size = space_size;
+           }
+       }
     }
   /* Now that we've read in all the subspace records, we need to assign
      a target index to each subspace.  */


-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=273

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]