struct cu *cu_chain);
static bool check_location_expression (struct read_ctx *ctx,
+ uint64_t init_off,
struct relocation_data *reloc,
size_t length,
struct where *wh,
if (is_location_attrib (it->name))
{
- if (!check_location_expression (ctx, reloc, length,
+ uint64_t expr_start = cu->offset + read_ctx_get_offset (ctx);
+ if (!check_location_expression (ctx, expr_start,
+ reloc, length,
&where, addr_64))
return -1;
}
static bool
check_location_expression (struct read_ctx *parent_ctx,
+ uint64_t init_off,
struct relocation_data *reloc,
size_t length,
struct where *wh,
wr_error (wh, PRI_NOT_ENOUGH, "location expression");
return false;
}
- uint64_t off0 = read_ctx_get_offset (parent_ctx);
struct ref_record oprefs;
WIPE (oprefs);
while (!read_ctx_eof (&ctx))
{
struct where where = WHERE (sec_locexpr, wh);
- uint64_t opcode_off = read_ctx_get_offset (&ctx);
+ uint64_t opcode_off = read_ctx_get_offset (&ctx) + init_off;
where_reset_1 (&where, opcode_off);
addr_record_add (&opaddrs, opcode_off);
do { \
if (OP != 0) \
{ \
- uint64_t _off = read_ctx_get_offset (&ctx); \
+ uint64_t _off = read_ctx_get_offset (&ctx) + init_off; \
uint64_t *_ptr = (PTR); \
if (!read_ctx_read_form (&ctx, addr_64, (OP), \
_ptr, &where, STR " operand")) \
goto out; \
} \
struct relocation *_rel; \
- if ((_rel = relocation_next (reloc, _off + off0, \
+ if ((_rel = relocation_next (reloc, _off, \
&where, skip_mismatched))) \
relocate_one (reloc, _rel, \
addr_64 ? 8 : 4, _ptr, &where, \
/* location expression itself */
uint64_t expr_start = read_ctx_get_offset (&ctx);
- if (!check_location_expression (&ctx, &data->rel, len, &where, addr_64))
+ if (!check_location_expression (&ctx, expr_start, &data->rel,
+ len, &where, addr_64))
return false;
uint64_t expr_end = read_ctx_get_offset (&ctx);
if (!overlap