diff options
author | Giuliano Procida <gprocida@google.com> | 2022-01-17 14:51:15 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@redhat.com> | 2022-01-18 10:15:53 +0100 |
commit | 6e0d3f7278465bcfc2ee09b9cfb06f81bb761e4f (patch) | |
tree | f416ad43d80d04cc923e6d97a081c82ab66c4dfc | |
parent | symtab reader: fix up alternative addresses (diff) | |
download | libabigail-6e0d3f7278465bcfc2ee09b9cfb06f81bb761e4f.tar.gz libabigail-6e0d3f7278465bcfc2ee09b9cfb06f81bb761e4f.tar.bz2 libabigail-6e0d3f7278465bcfc2ee09b9cfb06f81bb761e4f.tar.xz |
DWARF reader: use size_t for DWARF expression length
A recent change broke 32-bit builds due to an implicit assumption that
size_t == uint64_t. This appears in the elfutils dwarf_getlocation*
functions' types.
This commit updates callers and other functions to use size_t
consistently for such expression lengths and indexes.
* src/abg-dwarf-reader.cc (die_location_expr): Change expr_len
argument type to size_t*.
(op_manipulates_stack): Change expr_len and index argument
types to size_t; change next_index argument type to size_t&.
(eval_last_constant_dwarf_sub_expr): Change expr_len argument
and local variables index and next_index types to size_t.
(die_member_offset): Change local variable expr_len type to
size_t.
(die_location_address): Likewise.
(die_virtual_function_index): Likewise.
Fixes: 16207c4af7bc ("Bug 28191 - Interpret DWARF 5 addrx locations")
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
-rw-r--r-- | src/abg-dwarf-reader.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index f125196d..7ee8c04a 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc | |||
@@ -7686,7 +7686,7 @@ static bool | |||
7686 | die_location_expr(const Dwarf_Die* die, | 7686 | die_location_expr(const Dwarf_Die* die, |
7687 | unsigned attr_name, | 7687 | unsigned attr_name, |
7688 | Dwarf_Op** expr, | 7688 | Dwarf_Op** expr, |
7689 | uint64_t* expr_len) | 7689 | size_t* expr_len) |
7690 | { | 7690 | { |
7691 | if (!die) | 7691 | if (!die) |
7692 | return false; | 7692 | return false; |
@@ -8022,9 +8022,9 @@ op_pushes_non_constant_value(Dwarf_Op* ops, | |||
8022 | /// DEVM stack, false otherwise. | 8022 | /// DEVM stack, false otherwise. |
8023 | static bool | 8023 | static bool |
8024 | op_manipulates_stack(Dwarf_Op* expr, | 8024 | op_manipulates_stack(Dwarf_Op* expr, |
8025 | uint64_t expr_len, | 8025 | size_t expr_len, |
8026 | uint64_t index, | 8026 | size_t index, |
8027 | uint64_t& next_index, | 8027 | size_t& next_index, |
8028 | dwarf_expr_eval_context& ctxt) | 8028 | dwarf_expr_eval_context& ctxt) |
8029 | { | 8029 | { |
8030 | Dwarf_Op& op = expr[index]; | 8030 | Dwarf_Op& op = expr[index]; |
@@ -8398,7 +8398,7 @@ eval_quickly(Dwarf_Op* expr, | |||
8398 | /// to evaluate, false otherwise. | 8398 | /// to evaluate, false otherwise. |
8399 | static bool | 8399 | static bool |
8400 | eval_last_constant_dwarf_sub_expr(Dwarf_Op* expr, | 8400 | eval_last_constant_dwarf_sub_expr(Dwarf_Op* expr, |
8401 | uint64_t expr_len, | 8401 | size_t expr_len, |
8402 | int64_t& value, | 8402 | int64_t& value, |
8403 | bool& is_tls_address, | 8403 | bool& is_tls_address, |
8404 | dwarf_expr_eval_context &eval_ctxt) | 8404 | dwarf_expr_eval_context &eval_ctxt) |
@@ -8407,7 +8407,7 @@ eval_last_constant_dwarf_sub_expr(Dwarf_Op* expr, | |||
8407 | // expression contained in the DWARF expression 'expr'. | 8407 | // expression contained in the DWARF expression 'expr'. |
8408 | eval_ctxt.reset(); | 8408 | eval_ctxt.reset(); |
8409 | 8409 | ||
8410 | uint64_t index = 0, next_index = 0; | 8410 | size_t index = 0, next_index = 0; |
8411 | do | 8411 | do |
8412 | { | 8412 | { |
8413 | if (op_is_arith_logic(expr, expr_len, index, | 8413 | if (op_is_arith_logic(expr, expr_len, index, |
@@ -8452,7 +8452,7 @@ eval_last_constant_dwarf_sub_expr(Dwarf_Op* expr, | |||
8452 | /// to evaluate, false otherwise. | 8452 | /// to evaluate, false otherwise. |
8453 | static bool | 8453 | static bool |
8454 | eval_last_constant_dwarf_sub_expr(Dwarf_Op* expr, | 8454 | eval_last_constant_dwarf_sub_expr(Dwarf_Op* expr, |
8455 | uint64_t expr_len, | 8455 | size_t expr_len, |
8456 | int64_t& value, | 8456 | int64_t& value, |
8457 | bool& is_tls_address) | 8457 | bool& is_tls_address) |
8458 | { | 8458 | { |
@@ -8775,7 +8775,7 @@ die_member_offset(const read_context& ctxt, | |||
8775 | int64_t& offset) | 8775 | int64_t& offset) |
8776 | { | 8776 | { |
8777 | Dwarf_Op* expr = NULL; | 8777 | Dwarf_Op* expr = NULL; |
8778 | uint64_t expr_len = 0; | 8778 | size_t expr_len = 0; |
8779 | uint64_t bit_offset = 0; | 8779 | uint64_t bit_offset = 0; |
8780 | 8780 | ||
8781 | // First let's see if the DW_AT_data_bit_offset attribute is | 8781 | // First let's see if the DW_AT_data_bit_offset attribute is |
@@ -8852,7 +8852,7 @@ die_location_address(Dwarf_Die* die, | |||
8852 | bool& is_tls_address) | 8852 | bool& is_tls_address) |
8853 | { | 8853 | { |
8854 | Dwarf_Op* expr = NULL; | 8854 | Dwarf_Op* expr = NULL; |
8855 | uint64_t expr_len = 0; | 8855 | size_t expr_len = 0; |
8856 | 8856 | ||
8857 | is_tls_address = false; | 8857 | is_tls_address = false; |
8858 | 8858 | ||
@@ -8898,7 +8898,7 @@ die_virtual_function_index(Dwarf_Die* die, | |||
8898 | return false; | 8898 | return false; |
8899 | 8899 | ||
8900 | Dwarf_Op* expr = NULL; | 8900 | Dwarf_Op* expr = NULL; |
8901 | uint64_t expr_len = 0; | 8901 | size_t expr_len = 0; |
8902 | if (!die_location_expr(die, DW_AT_vtable_elem_location, | 8902 | if (!die_location_expr(die, DW_AT_vtable_elem_location, |
8903 | &expr, &expr_len)) | 8903 | &expr, &expr_len)) |
8904 | return false; | 8904 | return false; |