diff options
| author | Roland McGrath <[email protected]> | 2010-06-21 23:00:35 -0700 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2010-06-21 23:00:35 -0700 |
| commit | 0c5638c2ac488a4a49f76ddb074e87bdebe90288 (patch) | |
| tree | 5fb0c6dd2122b17e21173a65b5ccd9f00d73da7d /libdw/memory-access.h | |
| parent | 2b1f09548b66c2c75d5be6f13cd9374adc95f8d8 (diff) | |
Fix readelf for large SLEB128 values.
Diffstat (limited to 'libdw/memory-access.h')
| -rw-r--r-- | libdw/memory-access.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libdw/memory-access.h b/libdw/memory-access.h index 13f79ec2..b7799e92 100644 --- a/libdw/memory-access.h +++ b/libdw/memory-access.h @@ -1,5 +1,5 @@ /* Unaligned memory access functionality. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2009 Red Hat, Inc. + Copyright (C) 2000-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <[email protected]>, 2001. @@ -90,7 +90,7 @@ _v |= (uint64_t) (__b & 0x7f) << (nth * 7); \ if (likely ((__b & 0x80) == 0)) \ { \ - var = (_v << (64 - (nth * 7) - 7) >> (64 - (nth * 7) - 7)); \ + var = (_v << (64 - (nth * 7) - 7)) >> (64 - (nth * 7) - 7); \ break; \ } \ else do {} while (0) @@ -109,9 +109,13 @@ { \ get_sleb128_step (var, *addrp, i, return var); \ } \ - /* Other implementations set VALUE to INT_MAX in this \ - case. So we better do this as well. */ \ - return INT64_MAX; \ + __b = *(*addrp)++; \ + if (likely ((__b & 0x80) == 0)) \ + return var | ((uint64_t) __b << 63); \ + else \ + /* Other implementations set VALUE to INT_MAX in this \ + case. So we better do this as well. */ \ + return INT64_MAX; \ } while (0) #ifdef IS_LIBDW @@ -122,14 +126,14 @@ extern int64_t __libdw_get_sleb128 (int64_t acc, unsigned int i, const unsigned char **addrp) internal_function attribute_hidden; #else -static uint64_t +static inline uint64_t __attribute__ ((unused)) __libdw_get_uleb128 (uint64_t acc, unsigned int i, const unsigned char **addrp) { unsigned char __b; get_uleb128_rest_return (acc, i, addrp); } -static int64_t +static inline int64_t __attribute__ ((unused)) __libdw_get_sleb128 (int64_t acc, unsigned int i, const unsigned char **addrp) { |
