summaryrefslogtreecommitdiff
path: root/libdw
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2013-09-30 00:39:07 +0200
committerMark Wielaard <mjw@redhat.com>2013-09-30 00:39:13 +0200
commit74f9b7337562c06a93722ad757d258db8f082663 (patch)
tree11b05d94cc21f4f73e3ed862860c59efefb59052 /libdw
parentb43bcfe4235d3fda3ea22d96af0f8f0c71924013 (diff)
downloadelfutils-74f9b7337562c06a93722ad757d258db8f082663.tar.gz
libdw: Fix compiler warnings on 32-bit.
Don't cast directly to/from Dwarf_Word (uint64_t) to/from pointers, but use uintptr_t as intermediary to prevent cast to pointer from integer of different size warnings. Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'libdw')
-rw-r--r--libdw/ChangeLog9
-rw-r--r--libdw/dwarf_getlocation.c8
-rw-r--r--libdw/dwarf_getlocation_attr.c6
3 files changed, 17 insertions, 6 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 21cc4854..951f1cba 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,12 @@
+2013-09-29 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getlocation.c (store_implicit_value): Cast op->number2 to
+ uintptr_t before casting to char *.
+ (__libdw_intern_expression): Cast data to uintptr_t before casting
+ to Dwarf_Word.
+ * dwarf_getlocation_attr.c (dwarf_getlocation_attr): Cast
+ op->number2 to uintptr_t before casting to char *.
+
2013-09-24 Josh Stone <jistone@redhat.com>
* libdw_visit_scopes.c (classify_die): Removed.
diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c
index f7d64f41..ff25fc7c 100644
--- a/libdw/dwarf_getlocation.c
+++ b/libdw/dwarf_getlocation.c
@@ -99,7 +99,7 @@ store_implicit_value (Dwarf *dbg, void **cache, Dwarf_Op *op)
{
struct loc_block_s *block = libdw_alloc (dbg, struct loc_block_s,
sizeof (struct loc_block_s), 1);
- const unsigned char *data = (const unsigned char *) op->number2;
+ const unsigned char *data = (const unsigned char *) (uintptr_t) op->number2;
Dwarf_Word blength; // Ignored, equal to op->number.
get_uleb128 (blength, data);
block->addr = op;
@@ -414,7 +414,8 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
if (unlikely (dbg == NULL))
goto invalid;
- newloc->number2 = (Dwarf_Word) data; /* start of block inc. len. */
+ /* start of block inc. len. */
+ newloc->number2 = (Dwarf_Word) (uintptr_t) data;
/* XXX Check size. */
get_uleb128 (newloc->number, data); /* Block length. */
if (unlikely ((Dwarf_Word) (end_data - data) < newloc->number))
@@ -447,7 +448,8 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
if (unlikely (data >= end_data))
goto invalid;
- newloc->number2 = (Dwarf_Word) data; /* start of block inc. len. */
+ /* start of block inc. len. */
+ newloc->number2 = (Dwarf_Word) (uintptr_t) data;
size = *data++;
if (unlikely ((Dwarf_Word) (end_data - data) < size))
goto invalid;
diff --git a/libdw/dwarf_getlocation_attr.c b/libdw/dwarf_getlocation_attr.c
index 2d6084e9..bf155840 100644
--- a/libdw/dwarf_getlocation_attr.c
+++ b/libdw/dwarf_getlocation_attr.c
@@ -50,19 +50,19 @@ dwarf_getlocation_attr (attr, op, result)
case DW_OP_implicit_value:
result->code = DW_AT_const_value;
result->form = DW_FORM_block;
- result->valp = (unsigned char *) op->number2;
+ result->valp = (unsigned char *) (uintptr_t) op->number2;
break;
case DW_OP_GNU_entry_value:
result->code = DW_AT_location;
result->form = DW_FORM_exprloc;
- result->valp = (unsigned char *) op->number2;
+ result->valp = (unsigned char *) (uintptr_t) op->number2;
break;
case DW_OP_GNU_const_type:
result->code = DW_AT_const_value;
result->form = DW_FORM_block1;
- result->valp = (unsigned char *) op->number2;
+ result->valp = (unsigned char *) (uintptr_t) op->number2;
break;
case DW_OP_call2: