bug-binutils
[Top][All Lists]
Advanced

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

Re: [Bug binutils/273] FAIL: size -A


From: Nick Clifton
Subject: Re: [Bug binutils/273] FAIL: size -A
Date: Tue, 27 Jul 2004 12:37:24 +0100
User-agent: Mozilla Thunderbird 0.7 (X11/20040615)

Hi Dave, Hi Alan,

Sub Sp AC RDCLQIOENKT Key Loc/Init InitLn  Start    Len  Align Fixups Name

  0  0 2c ...L0.O....  24 000001ec 000008 00000000 000008  8    0   3 $CODE$
  1  0 2c ...L0......  16 000001f4 000000 00000000 000000  8    3   0 $LIT$
  2  0 2c ...L0......   8 000001f4 000000 00000000 000000  8    3   0 
$MILLICODE$
  3  1 1f ...L1......  24 000001f4 000008 00000000 000008  8    3   1 $DATA$
  4  1 1f ...L1......  80 00000000 000000 00000000 000000  8   -1   0 $BSS$

You can see that the start addresses for all subspaces are zero.  There
is something a bit strange about $DATA$.  I'm not sure why it doesn't
start at 0x40000000.  When the code loops through choosing save_subspace,
it picks $LIT$.  So, the size calculated by

        space_asect->size = (save_subspace.subspace_start
                             - space_asect->vma
                             + save_subspace.subspace_length);

is 0 - 0 + 0 = 0.  The test would pass if $LIT$ and $MILLICODE$ didn't
appear.  However, the code is still broken for .o files because we are
not calculating subspace_start.  The HP documentation indicates that
this field is used to ensure subspaces don't overlap.  However, I think
the linker usually ignores it and computes its own values.

In relocatable objects, possibly we should just add up the sizes of the
individual subspaces in each space.  This ignores the alignment and
sort order of the subspaces.

Something like this ?

Cheers
  Nick


Index: bfd/som.c
===================================================================
RCS file: /cvs/src/src/bfd/som.c,v
retrieving revision 1.46
diff -c -3 -p -r1.46 som.c
*** bfd/som.c   21 Jul 2004 15:42:57 -0000      1.46
--- bfd/som.c   27 Jul 2004 11:15:27 -0000
*************** setup_sections (abfd, file_hdr, current_
*** 1913,1918 ****
--- 1913,1919 ----
        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.  */
*************** setup_sections (abfd, file_hdr, current_
*** 2104,2109 ****
--- 2105,2114 ----
          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.
+            This ignores alignment and ordering issues...  */
+         space_size += save_subspace.subspace_length;
        }
  
        /* This can happen for a .o which defines symbols in otherwise
*************** setup_sections (abfd, file_hdr, current_
*** 2111,2121 ****
        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);
      }
    /* Now that we've read in all the subspace records, we need to assign
       a target index to each 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);
! #else
!         /* The subspace_start field is not initialised, so it cannot
!            be used for length calculations.  Instead we use the
!            space_size value which we have been accumulating.  */
!         space_asect->size = space_size;
! #endif
!       }
      }
    /* Now that we've read in all the subspace records, we need to assign
       a target index to each subspace.  */

reply via email to

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