bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Large size array problem


From: Nick Clifton
Subject: Re: Large size array problem
Date: Thu, 19 Jun 2003 11:13:12 +0100
User-agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.2 (gnu/linux)

Hi Miklos,

> After all I have two problems. It is fair to have an upper limit for the
> array size, but:
>
>  - the error message from 'gas' is misleading when this limit is crossed
> (minor bug);
>
>  - this limit - apparently 2^31 - is fair in the 32 bit environment but
> unreasonably restrictive in the 64 bit world. If 'gas' wants to become a
> true 64 bit tool this limit should be higher in my opinion. I don't know
> if it is possible and what amount of work does it mean. It's up to your
> consideration.


Please could you try the attached patch and let me know if it works
for you.  At the moment it only corrects the sparc target, but I can
extend it into a generic fix if it appears to be the correct approach.

Cheers
        Nick

2003-06-19  Nick Clifton  <address@hidden>

        * write.c (write_contents): Replace 'unsigned long' types with
        addressT and 'long' with offsetT.
        (relax_frag, relax_segment): Likewise.
        (relax_and_size_all_segments): Use addressT for the vma of the
        bss section.
        * config/tc-sparc.c (s_common): Change type of 'temp' and
        'size' to offsetT.  Fix error message to indicate that .comm
        value might be too big.

Index: gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.72
diff -c -3 -p -r1.72 write.c
*** gas/write.c 11 Jun 2003 10:32:08 -0000      1.72
--- gas/write.c 19 Jun 2003 10:10:56 -0000
*************** write_contents (abfd, sec, xxx)
*** 1135,1141 ****
       PTR xxx ATTRIBUTE_UNUSED;
  {
    segment_info_type *seginfo = seg_info (sec);
!   unsigned long offset = 0;
    fragS *f;
  
    /* Write out the frags.  */
--- 1135,1141 ----
       PTR xxx ATTRIBUTE_UNUSED;
  {
    segment_info_type *seginfo = seg_info (sec);
!   addressT offset = 0;
    fragS *f;
  
    /* Write out the frags.  */
*************** write_contents (abfd, sec, xxx)
*** 1148,1156 ****
         f = f->fr_next)
      {
        int x;
!       unsigned long fill_size;
        char *fill_literal;
!       long count;
  
        assert (f->fr_type == rs_fill);
        if (f->fr_fix)
--- 1148,1156 ----
         f = f->fr_next)
      {
        int x;
!       addressT fill_size;
        char *fill_literal;
!       offsetT count;
  
        assert (f->fr_type == rs_fill);
        if (f->fr_fix)
*************** relax_and_size_all_segments ()
*** 1310,1316 ****
  #ifdef OBJ_BOUT
    /* See above comments on b.out data section address.  */
    {
!     long bss_vma;
      if (data_last_frag == 0)
        bss_vma = H_GET_TEXT_SIZE (&headers);
      else
--- 1310,1316 ----
  #ifdef OBJ_BOUT
    /* See above comments on b.out data section address.  */
    {
!     addressT bss_vma;
      if (data_last_frag == 0)
        bss_vma = H_GET_TEXT_SIZE (&headers);
      else
*************** relax_frag (segment, fragP, stretch)
*** 2070,2076 ****
    const relax_typeS *start_type;
    relax_substateT next_state;
    relax_substateT this_state;
!   long growth;
    offsetT aim;
    addressT target;
    addressT address;
--- 2070,2076 ----
    const relax_typeS *start_type;
    relax_substateT next_state;
    relax_substateT this_state;
!   offsetT growth;
    offsetT aim;
    addressT target;
    addressT address;
*************** relax_segment (segment_frag_root, segmen
*** 2293,2299 ****
  
    /* Do relax().  */
    {
!     long stretch;     /* May be any size, 0 or negative.  */
      /* Cumulative number of addresses we have relaxed this pass.
         We may have relaxed more than one address.  */
      int stretched;    /* Have we stretched on this pass?  */
--- 2293,2299 ----
  
    /* Do relax().  */
    {
!     offsetT stretch;  /* May be any size, 0 or negative.  */
      /* Cumulative number of addresses we have relaxed this pass.
         We may have relaxed more than one address.  */
      int stretched;    /* Have we stretched on this pass?  */
*************** relax_segment (segment_frag_root, segmen
*** 2308,2314 ****
  
        for (fragP = segment_frag_root; fragP; fragP = fragP->fr_next)
          {
!           long growth = 0;
            addressT was_address;
            offsetT offset;
            symbolS *symbolP;
--- 2308,2314 ----
  
        for (fragP = segment_frag_root; fragP; fragP = fragP->fr_next)
          {
!           offsetT growth = 0;
            addressT was_address;
            offsetT offset;
            symbolS *symbolP;
*************** relax_segment (segment_frag_root, segmen
*** 2443,2449 ****
                         cannot have fewer than 0 chars.  That is, we can't
                         .org backwards.  */
                      as_bad_where (fragP->fr_file, fragP->fr_line,
!                                   _("attempt to .org backwards"));
  
                      /* We've issued an error message.  Change the
                           frag to avoid cascading errors.  */
--- 2443,2449 ----
                         cannot have fewer than 0 chars.  That is, we can't
                         .org backwards.  */
                      as_bad_where (fragP->fr_file, fragP->fr_line,
!                                   _("attempt to move .org backwards"));
  
                      /* We've issued an error message.  Change the
                           frag to avoid cascading errors.  */
*************** relax_segment (segment_frag_root, segmen
*** 2502,2508 ****
              case rs_leb128:
                {
                  valueT value;
!                 int size;
  
                  value = resolve_symbol_value (fragP->fr_symbol);
                  size = sizeof_leb128 (value, fragP->fr_subtype);
--- 2502,2508 ----
              case rs_leb128:
                {
                  valueT value;
!                 offsetT size;
  
                  value = resolve_symbol_value (fragP->fr_symbol);
                  size = sizeof_leb128 (value, fragP->fr_subtype);
Index: gas/config/tc-sparc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sparc.c,v
retrieving revision 1.47
diff -c -3 -p -r1.47 tc-sparc.c
*** gas/config/tc-sparc.c       21 May 2003 12:07:55 -0000      1.47
--- gas/config/tc-sparc.c       19 Jun 2003 10:10:59 -0000
*************** s_common (ignore)
*** 3764,3770 ****
    char *name;
    char c;
    char *p;
!   int temp, size;
    symbolS *symbolP;
  
    name = input_line_pointer;
--- 3764,3770 ----
    char *name;
    char c;
    char *p;
!   offsetT temp, size;
    symbolS *symbolP;
  
    name = input_line_pointer;
*************** s_common (ignore)
*** 3785,3791 ****
  
    if ((temp = get_absolute_expression ()) < 0)
      {
!       as_bad (_(".COMMon length (%d.) <0! Ignored."), temp);
        ignore_rest_of_line ();
        return;
      }
--- 3785,3791 ----
  
    if ((temp = get_absolute_expression ()) < 0)
      {
!       as_bad (_("negative or huge .COMMon length (%d or %x) ignored."), temp, 
temp);
        ignore_rest_of_line ();
        return;
      }





reply via email to

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