[3.3/mainline] Fix 64bit cleanliness problem in read_uleb128
Geoff Keating
geoffk@geoffk.org
Mon Dec 8 04:26:00 GMT 2003
Jan Hubicka <hubicka@ucw.cz> writes:
> 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
This is OK. I think it'd be fine for 3.3 too, but it's not a
regression fix so Gaby gets the final say.
> 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;
>
--
- Geoffrey Keating <geoffk@geoffk.org>
More information about the Gcc-patches
mailing list