summaryrefslogtreecommitdiffstats
path: root/binutils
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2004-12-27 19:08:31 +0000
committerH.J. Lu <hjl.tools@gmail.com>2004-12-27 19:08:31 +0000
commit0c548fce692d32ea292cd72ff8266005f758e316 (patch)
treea73a38a573b40a565832763e495a149fd46ce443 /binutils
parente0eee039cee45fa261fbd3ef48182aaa1f189a0e (diff)
downloadppe42-binutils-0c548fce692d32ea292cd72ff8266005f758e316.tar.gz
ppe42-binutils-0c548fce692d32ea292cd72ff8266005f758e316.zip
2004-12-27 H.J. Lu <hongjiu.lu@intel.com>
* readelf.c (read_leb128): Support 64bit host.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog4
-rw-r--r--binutils/readelf.c8
2 files changed, 8 insertions, 4 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index f418f99792..80fe241662 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,7 @@
+2004-12-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ * readelf.c (read_leb128): Support 64bit host.
+
2004-12-22 Nick Clifton <nickc@redhat.com>
* readelf.c (last_pointer_size, warned_about_missing_comp_units):
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 36103765da..6cecdc3480 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -6933,7 +6933,7 @@ read_leb128 (unsigned char *data, int *length_return, int sign)
{
unsigned long int result = 0;
unsigned int num_read = 0;
- int shift = 0;
+ unsigned int shift = 0;
unsigned char byte;
do
@@ -6941,7 +6941,7 @@ read_leb128 (unsigned char *data, int *length_return, int sign)
byte = *data++;
num_read++;
- result |= (byte & 0x7f) << shift;
+ result |= ((unsigned long int) (byte & 0x7f)) << shift;
shift += 7;
@@ -6951,8 +6951,8 @@ read_leb128 (unsigned char *data, int *length_return, int sign)
if (length_return != NULL)
*length_return = num_read;
- if (sign && (shift < 32) && (byte & 0x40))
- result |= -1 << shift;
+ if (sign && (shift < 8 * sizeof (result)) && (byte & 0x40))
+ result |= -1L << shift;
return result;
}
OpenPOWER on IntegriCloud