This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[3.3/mainline] Fix 64bit cleanliness problem in read_uleb128


Hi,
this is needed to get unwinding right for frames larger then 4GB.  I
would like this to get to 3.3 too so the libgcc produced by 3.3 is safe
even when 3.3 does not support large frames.


OK? Regtested/bootstrapped x86_64-unknown-linux
Honza

2003-12-06  Jan Hubicka  <jh@suse.cz>
	* unwind-pe.h (read_uleb128): Fix handling of large values
	(read_sleb128): Fix handling of large values

Index: unwind-pe.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-pe.h,v
retrieving revision 1.11
diff -c -3 -p -r1.11 unwind-pe.h
*** unwind-pe.h	15 Aug 2002 18:01:30 -0000	1.11
--- unwind-pe.h	6 Dec 2003 14:41:20 -0000
*************** read_uleb128 (const unsigned char *p, _U
*** 124,130 ****
    do
      {
        byte = *p++;
!       result |= (byte & 0x7f) << shift;
        shift += 7;
      }
    while (byte & 0x80);
--- 124,130 ----
    do
      {
        byte = *p++;
!       result |= ((_Unwind_Word)byte & 0x7f) << shift;
        shift += 7;
      }
    while (byte & 0x80);
*************** read_sleb128 (const unsigned char *p, _U
*** 146,159 ****
    do
      {
        byte = *p++;
!       result |= (byte & 0x7f) << shift;
        shift += 7;
      }
    while (byte & 0x80);
  
    /* Sign-extend a negative value.  */
    if (shift < 8 * sizeof(result) && (byte & 0x40) != 0)
!     result |= -(1L << shift);
  
    *val = (_Unwind_Sword) result;
    return p;
--- 146,159 ----
    do
      {
        byte = *p++;
!       result |= ((_Unwind_Word)byte & 0x7f) << shift;
        shift += 7;
      }
    while (byte & 0x80);
  
    /* Sign-extend a negative value.  */
    if (shift < 8 * sizeof(result) && (byte & 0x40) != 0)
!     result |= -(((_Unwind_Word)1L) << shift);
  
    *val = (_Unwind_Sword) result;
    return p;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]