From fcd8f3f203513c4e0dd75b3a256cbb4b80e4b856 Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Wed, 19 Aug 2009 15:47:15 +0200 Subject: [PATCH] dwarflint: Reorganize data structures * ... to elimiate holes where possible * and get rid of dwarf_64/addr_64, use offset_size/address_size instead * also DW_FORM_ref_addr now has address_size in dwarf 2 --- src/dwarflint.c | 174 +++++++++++++++++++++++------------------------- src/dwarflint.h | 28 ++++---- 2 files changed, 98 insertions(+), 104 deletions(-) diff --git a/src/dwarflint.c b/src/dwarflint.c index 90a009672..f74c099e8 100644 --- a/src/dwarflint.c +++ b/src/dwarflint.c @@ -679,40 +679,39 @@ parse_opt (int key, char *arg __attribute__ ((unused)), struct abbrev { uint64_t code; - - /* While ULEB128 can hold numbers > 32bit, these are not legal - values of many enum types. So just use as large type as - necessary to cover valid values. */ - uint16_t tag; - bool has_children; - struct where where; - /* Whether some DIE uses this abbrev. */ - bool used; - /* Attributes. */ struct abbrev_attrib { + struct where where; uint16_t name; uint8_t form; - struct where where; } *attribs; size_t size; size_t alloc; + + /* While ULEB128 can hold numbers > 32bit, these are not legal + values of many enum types. So just use as large type as + necessary to cover valid values. */ + uint16_t tag; + bool has_children; + + /* Whether some DIE uses this abbrev. */ + bool used; }; struct abbrev_table { + struct abbrev_table *next; + struct abbrev *abbr; uint64_t offset; + size_t size; + size_t alloc; bool used; /* There are CUs using this table. */ bool skip_check; /* There were errors during loading one of the CUs that use this table. Check for unused abbrevs should be skipped. */ - struct abbrev *abbr; - size_t size; - size_t alloc; - struct abbrev_table *next; }; static struct abbrev_table *abbrev_table_load (struct read_ctx *ctx); @@ -765,10 +764,10 @@ static void ref_record_free (struct ref_record *rr); struct cu { + struct cu *next; uint64_t offset; uint64_t cudie_offset; uint64_t length; - int address_size; // Address size in bytes on the target machine. uint64_t low_pc; // DW_AT_low_pc value of CU DIE, -1 if not present. struct addr_record die_addrs; // Addresses where DIEs begin in this CU. struct ref_record die_refs; // DIE references into other CUs from this CU. @@ -776,10 +775,12 @@ struct cu struct ref_record range_refs; // references into .debug_ranges from this CU. struct ref_record line_refs; // references into .debug_line from this CU. struct where where; // Where was this section defined. + int address_size; // Address size in bytes on the target machine. + int offset_size; // Offset size in this CU. + int version; // CU version bool has_arange; // Whether we saw arange section pointing to this CU. bool has_pubnames; // Likewise for pubnames. bool has_pubtypes; // Likewise for pubtypes. - struct cu *next; }; static void cu_free (struct cu *cu_chain); @@ -815,11 +816,11 @@ static bool check_pub_structural (struct elf_file *file, static bool check_location_expression (struct elf_file *file, struct read_ctx *ctx, + struct cu *cu, uint64_t init_off, struct relocation_data *reloc, size_t length, - struct where *wh, - bool addr_64); + struct where *wh); static bool check_loc_or_range_structural (struct elf_file *file, struct sec *sec, @@ -1044,16 +1045,16 @@ elf_file_init (struct elf_file *file, Elf *elf) struct secinfo { const char *name; - enum section_id id; /* Section type. */ Elf_Data *reldata; /* Relocation data if any found. */ size_t reltype; /* SHT_REL or SHT_RELA. We need this temporary store to be able to resolve relocation section appearing before relocated section. */ size_t secndx; /* Index into file->sec or 0 if not yet loaded. */ + enum section_id id; /* Section type. */ }; struct secinfo secinfo[] = { -#define SEC(n) {".debug_" #n, sec_##n, NULL, 0, 0}, +#define SEC(n) {".debug_" #n, NULL, 0, 0, sec_##n}, DEBUGINFO_SECTIONS #undef SEC }; @@ -1365,13 +1366,13 @@ checked_read_sleb128 (struct read_ctx *ctx, int64_t *ret, type-casted int64_t. WHAT and WHERE describe error message and context for LEB128 loading. */ static bool -read_ctx_read_form (struct read_ctx *ctx, bool addr_64, uint8_t form, +read_ctx_read_form (struct read_ctx *ctx, struct cu *cu, uint8_t form, uint64_t *valuep, struct where *where, const char *what) { switch (form) { case DW_FORM_addr: - return read_ctx_read_offset (ctx, addr_64, valuep); + return read_ctx_read_offset (ctx, cu->address_size == 8, valuep); case DW_FORM_udata: return checked_read_uleb128 (ctx, valuep, where, what); case DW_FORM_sdata: @@ -2246,7 +2247,7 @@ check_global_die_references (struct cu *cu_chain) static bool read_size_extra (struct read_ctx *ctx, uint32_t size32, uint64_t *sizep, - bool *dwarf_64p, struct where *wh) + int *offset_sizep, struct where *wh) { if (size32 == DWARF3_LENGTH_64_BIT) { @@ -2256,7 +2257,7 @@ read_size_extra (struct read_ctx *ctx, uint32_t size32, uint64_t *sizep, return false; } - *dwarf_64p = true; + *offset_sizep = 8; } else if (size32 >= DWARF3_LENGTH_MIN_ESCAPE_CODE) { @@ -2267,7 +2268,7 @@ read_size_extra (struct read_ctx *ctx, uint32_t size32, uint64_t *sizep, else { *sizep = size32; - *dwarf_64p = false; + *offset_sizep = 4; } return true; @@ -2705,7 +2706,6 @@ read_die_chain (struct elf_file *file, struct cu *cu, struct abbrev_table *abbrevs, Elf_Data *strings, - bool dwarf_64, bool addr_64, bool ref_64, struct ref_record *local_die_refs, struct coverage *strings_coverage, struct relocation_data *reloc, @@ -2944,7 +2944,7 @@ read_die_chain (struct elf_file *file, switch (form) { case DW_FORM_data8: - if (!dwarf_64) + if (cu->offset_size == 4) wr_error (&where, ": location attribute with form \"%s\" in 32-bit CU.\n", dwarf_form_string (form)); @@ -2978,7 +2978,7 @@ read_die_chain (struct elf_file *file, switch (form) { case DW_FORM_data8: - if (!dwarf_64) + if (cu->offset_size == 4) wr_error (&where, ": %s with form DW_FORM_data8 in 32-bit CU.\n", dwarf_attr_string (it->name)); @@ -3027,7 +3027,9 @@ read_die_chain (struct elf_file *file, switch (form) { case DW_FORM_strp: - if (!read_ctx_read_offset (ctx, dwarf_64, &value)) + value_check_cb = check_strp; + case DW_FORM_sec_offset: + if (!read_ctx_read_offset (ctx, cu->offset_size == 8, &value)) { cant_read: wr_error (&where, ": can't read value of attribute %s.\n", @@ -3036,8 +3038,7 @@ read_die_chain (struct elf_file *file, } relocate = rel_require; - width = dwarf_64 ? 8 : 4; - value_check_cb = check_strp; + width = cu->offset_size; break; case DW_FORM_string: @@ -3047,17 +3048,17 @@ read_die_chain (struct elf_file *file, case DW_FORM_ref_addr: value_check_cb = check_die_ref_global; - case DW_FORM_sec_offset: - width = dwarf_64 ? 8 : 4; - if (false) + width = cu->offset_size; + + if (cu->version == 2) case DW_FORM_addr: - width = addr_64 ? 8 : 4; + width = cu->address_size; + if (!read_ctx_read_offset (ctx, width == 8, &value)) goto cant_read; - /* In non-rel files, neither addr, nor ref_addr /need/ a - relocation. We at least check that ref_addr points - to sensible datum by recording the reference below. */ + /* In non-rel files, neither addr, nor ref_addr /need/ + a relocation. */ relocate = rel_nonzero; break; @@ -3148,9 +3149,8 @@ read_die_chain (struct elf_file *file, if (is_location_attrib (it->name)) { uint64_t expr_start = cu->offset + read_ctx_get_offset (ctx); - if (!check_location_expression (file, ctx, expr_start, - reloc, length, - &where, addr_64)) + if (!check_location_expression (file, ctx, cu, expr_start, + reloc, length, &where)) return -1; } else @@ -3251,7 +3251,6 @@ read_die_chain (struct elf_file *file, if (abbrev->has_children) { int st = read_die_chain (file, ctx, cu, abbrevs, strings, - dwarf_64, addr_64, ref_64, local_die_refs, strings_coverage, reloc, cu_coverage); @@ -3278,7 +3277,6 @@ check_cu_structural (struct elf_file *file, struct cu *const cu, struct abbrev_table *abbrev_chain, Elf_Data *strings, - bool dwarf_64, struct coverage *strings_coverage, struct relocation_data *reloc, struct cu_coverage *cu_coverage) @@ -3295,16 +3293,17 @@ check_cu_structural (struct elf_file *file, } if (!supported_version (version, 2, &cu->where, 2, 3)) return false; - if (version == 2 && dwarf_64) + if (version == 2 && cu->offset_size == 8) /* Keep going. It's a standard violation, but we may still be able to read the unit under consideration and do high-level checks. */ wr_error (&cu->where, ": invalid 64-bit unit in DWARF 2 format.\n"); + cu->version = version; /* Abbrev offset. */ uint64_t abbrev_offset; uint64_t ctx_offset = read_ctx_get_offset (ctx) + cu->offset; - if (!read_ctx_read_offset (ctx, dwarf_64, &abbrev_offset)) + if (!read_ctx_read_offset (ctx, cu->offset_size == 8, &abbrev_offset)) { wr_error (&cu->where, ": can't read abbrev offset.\n"); return false; @@ -3313,7 +3312,7 @@ check_cu_structural (struct elf_file *file, struct relocation *rel = relocation_next (reloc, ctx_offset, &cu->where, skip_mismatched); if (rel != NULL) - relocate_one (file, reloc, rel, dwarf_64 ? 8 : 4, + relocate_one (file, reloc, rel, cu->offset_size, &abbrev_offset, &cu->where, sec_abbrev, NULL); else if (file->ehdr.e_type == ET_REL) wr_message (mc_impact_2 | mc_info | mc_reloc, &cu->where, @@ -3355,10 +3354,7 @@ check_cu_structural (struct elf_file *file, WIPE (local_die_refs); cu->cudie_offset = read_ctx_get_offset (ctx) + cu->offset; - bool addr_64 = address_size == 8; - bool ref_64 = version == 2 ? addr_64 : (assert (version == 3), dwarf_64); if (read_die_chain (file, ctx, cu, abbrevs, strings, - dwarf_64, addr_64, ref_64, &local_die_refs, strings_coverage, (reloc != NULL && reloc->size > 0) ? reloc : NULL, cu_coverage) < 0) @@ -3413,7 +3409,6 @@ check_info_structural (struct elf_file *file, uint32_t size32; uint64_t size; - bool dwarf_64 = false; /* Reading CU header is a bit tricky, because we don't know if we have run into (superfluous but allowed) zero padding. */ @@ -3431,7 +3426,7 @@ check_info_structural (struct elf_file *file, if (size32 == 0 && check_zero_padding (&ctx, mc_info | mc_header, &where)) break; - if (!read_size_extra (&ctx, size32, &size, &dwarf_64, &where)) + if (!read_size_extra (&ctx, size32, &size, &cur->offset_size, &where)) { success = false; break; @@ -3451,7 +3446,7 @@ check_info_structural (struct elf_file *file, cur->length = cu_end - cu_begin; // Length including the length field. /* version + debug_abbrev_offset + address_size */ - uint64_t cu_header_size = 2 + (dwarf_64 ? 8 : 4) + 1; + uint64_t cu_header_size = 2 + cur->offset_size + 1; if (size < cu_header_size) { wr_error (&where, ": claimed length of %" PRIx64 @@ -3474,8 +3469,7 @@ check_info_structural (struct elf_file *file, cu_ctx.ptr = ctx.ptr; if (!check_cu_structural (file, &cu_ctx, cur, abbrev_chain, - strings, dwarf_64, - strings_coverage, reloc, + strings, strings_coverage, reloc, cu_coverage)) { success = false; @@ -3555,7 +3549,7 @@ check_info_structural (struct elf_file *file, if (success) coverage_find_holes (strings_coverage, 0, strings->d_size, found_hole, &((struct hole_info) - {sec_str, mc_strings, 0, strings->d_buf})); + {sec_str, mc_strings, strings->d_buf, 0})); coverage_free (strings_coverage); } @@ -3694,13 +3688,13 @@ check_aranges_structural (struct elf_file *file, /* Size. */ uint32_t size32; uint64_t size; - bool dwarf_64; + int offset_size; if (!read_ctx_read_4ubyte (&ctx, &size32)) { wr_error (&where, ": can't read table length.\n"); return false; } - if (!read_size_extra (&ctx, size32, &size, &dwarf_64, &where)) + if (!read_size_extra (&ctx, size32, &size, &offset_size, &where)) return false; struct read_ctx sub_ctx; @@ -3731,7 +3725,7 @@ check_aranges_structural (struct elf_file *file, /* CU offset. */ uint64_t cu_offset; uint64_t ctx_offset = sub_ctx.ptr - ctx.begin; - if (!read_ctx_read_offset (&sub_ctx, dwarf_64, &cu_offset)) + if (!read_ctx_read_offset (&sub_ctx, offset_size == 8, &cu_offset)) { wr_error (&where, ": can't read debug info offset.\n"); retval = false; @@ -3741,7 +3735,7 @@ check_aranges_structural (struct elf_file *file, struct relocation *rel; if ((rel = relocation_next (&sec->rel, ctx_offset, &where, skip_mismatched))) - relocate_one (file, &sec->rel, rel, dwarf_64 ? 8 : 4, + relocate_one (file, &sec->rel, rel, offset_size, &cu_offset, &where, sec_info, NULL); else if (file->ehdr.e_type == ET_REL) wr_message (mc_impact_2 | mc_aranges | mc_reloc | mc_header, &where, @@ -3936,13 +3930,13 @@ check_pub_structural (struct elf_file *file, /* Size. */ uint32_t size32; uint64_t size; - bool dwarf_64; + int offset_size; if (!read_ctx_read_4ubyte (&ctx, &size32)) { wr_error (&where, ": can't read table length.\n"); return false; } - if (!read_size_extra (&ctx, size32, &size, &dwarf_64, &where)) + if (!read_size_extra (&ctx, size32, &size, &offset_size, &where)) return false; struct read_ctx sub_ctx; @@ -3972,7 +3966,7 @@ check_pub_structural (struct elf_file *file, /* CU offset. */ uint64_t cu_offset; /* Offset of related CU. */ uint64_t ctx_offset = sub_ctx.ptr - ctx.begin; - if (!read_ctx_read_offset (&sub_ctx, dwarf_64, &cu_offset)) + if (!read_ctx_read_offset (&sub_ctx, offset_size == 8, &cu_offset)) { wr_error (&where, ": can't read debug info offset.\n"); retval = false; @@ -3982,7 +3976,7 @@ check_pub_structural (struct elf_file *file, struct relocation *rel; if ((rel = relocation_next (&sec->rel, ctx_offset, &where, skip_mismatched))) - relocate_one (file, &sec->rel, rel, dwarf_64 ? 8 : 4, + relocate_one (file, &sec->rel, rel, offset_size, &cu_offset, &where, sec_info, NULL); else if (file->ehdr.e_type == ET_REL) wr_message (mc_impact_2 | mc_pubtables | mc_reloc | mc_header, &where, @@ -4005,7 +3999,7 @@ check_pub_structural (struct elf_file *file, /* Covered length. */ uint64_t cu_len; - if (!read_ctx_read_offset (&sub_ctx, dwarf_64, &cu_len)) + if (!read_ctx_read_offset (&sub_ctx, offset_size == 8, &cu_len)) { wr_error (&where, ": can't read covered length.\n"); retval = false; @@ -4027,7 +4021,7 @@ check_pub_structural (struct elf_file *file, where_reset_2 (&where, ctx_offset); uint64_t offset; - if (!read_ctx_read_offset (&sub_ctx, dwarf_64, &offset)) + if (!read_ctx_read_offset (&sub_ctx, offset_size == 8, &offset)) { wr_error (&where, ": can't read offset field.\n"); retval = false; @@ -4104,11 +4098,11 @@ get_location_opcode_operands (uint8_t opcode, uint8_t *op1, uint8_t *op2) static bool check_location_expression (struct elf_file *file, struct read_ctx *parent_ctx, + struct cu *cu, uint64_t init_off, struct relocation_data *reloc, size_t length, - struct where *wh, - bool addr_64) + struct where *wh) { struct read_ctx ctx; if (!read_ctx_init_sub (&ctx, parent_ctx, parent_ctx->ptr, @@ -4152,7 +4146,7 @@ check_location_expression (struct elf_file *file, { \ uint64_t _off = read_ctx_get_offset (&ctx) + init_off; \ uint64_t *_ptr = (PTR); \ - if (!read_ctx_read_form (&ctx, addr_64, (OP), \ + if (!read_ctx_read_form (&ctx, cu, (OP), \ _ptr, &where, STR " operand")) \ { \ wr_error (&where, ": opcode \"%s\"" \ @@ -4165,7 +4159,7 @@ check_location_expression (struct elf_file *file, if ((_rel = relocation_next (reloc, _off, \ &where, skip_mismatched))) \ relocate_one (file, reloc, _rel, \ - addr_64 ? 8 : 4, _ptr, &where, \ + cu->address_size, _ptr, &where, \ reloc_target_loc (opcode), NULL); \ } \ } while (0) @@ -4202,13 +4196,13 @@ check_location_expression (struct elf_file *file, case DW_OP_const8u: case DW_OP_const8s: - if (!addr_64) + if (cu->address_size == 4) wr_error (&where, ": %s on 32-bit machine.\n", dwarf_locexpr_opcode_string (opcode)); break; default: - if (!addr_64 + if (cu->address_size == 4 && (opcode == DW_OP_constu || opcode == DW_OP_consts || opcode == DW_OP_deref_size @@ -4245,7 +4239,6 @@ check_loc_or_range_ref (struct elf_file *file, struct coverage_map *coverage_map, struct cu_coverage *cu_coverage, uint64_t addr, - bool addr_64, struct where *wh, enum message_category cat) { @@ -4276,7 +4269,8 @@ check_loc_or_range_ref (struct elf_file *file, retval = false; } - uint64_t escape = addr_64 ? (uint64_t)-1 : (uint64_t)(uint32_t)-1; + uint64_t escape = cu->address_size == 8 + ? (uint64_t)-1 : (uint64_t)(uint32_t)-1; bool overlap = false; uint64_t base = cu->low_pc; @@ -4298,10 +4292,10 @@ check_loc_or_range_ref (struct elf_file *file, GElf_Sym begin_symbol_mem, *begin_symbol = &begin_symbol_mem; bool begin_relocated = false; if (!overlap - && coverage_is_overlap (coverage, begin_off, addr_64 ? 8 : 4)) + && coverage_is_overlap (coverage, begin_off, cu->address_size)) HAVE_OVERLAP; - if (!read_ctx_read_offset (&ctx, addr_64, &begin_addr)) + if (!read_ctx_read_offset (&ctx, cu->address_size == 8, &begin_addr)) { wr_error (&where, ": can't read address range beginning.\n"); return false; @@ -4312,7 +4306,7 @@ check_loc_or_range_ref (struct elf_file *file, &where, skip_mismatched))) { begin_relocated = true; - relocate_one (file, &sec->rel, rel, addr_64 ? 8 : 4, + relocate_one (file, &sec->rel, rel, cu->address_size, &begin_addr, &where, rel_value, &begin_symbol); } @@ -4322,10 +4316,10 @@ check_loc_or_range_ref (struct elf_file *file, GElf_Sym end_symbol_mem, *end_symbol = &end_symbol_mem; bool end_relocated = false; if (!overlap - && coverage_is_overlap (coverage, end_off, addr_64 ? 8 : 4)) + && coverage_is_overlap (coverage, end_off, cu->address_size)) HAVE_OVERLAP; - if (!read_ctx_read_offset (&ctx, addr_64, &end_addr)) + if (!read_ctx_read_offset (&ctx, cu->address_size == 8, &end_addr)) { wr_error (&where, ": can't read address range ending.\n"); return false; @@ -4335,7 +4329,7 @@ check_loc_or_range_ref (struct elf_file *file, &where, skip_mismatched))) { end_relocated = true; - relocate_one (file, &sec->rel, rel, addr_64 ? 8 : 4, + relocate_one (file, &sec->rel, rel, cu->address_size, &end_addr, &where, rel_value, &end_symbol); if (begin_addr != escape) { @@ -4404,8 +4398,8 @@ check_loc_or_range_ref (struct elf_file *file, /* location expression itself */ uint64_t expr_start = read_ctx_get_offset (&ctx); - if (!check_location_expression (file, &ctx, expr_start, - &sec->rel, len, &where, addr_64)) + if (!check_location_expression (file, &ctx, cu, expr_start, + &sec->rel, len, &where)) return false; uint64_t expr_end = read_ctx_get_offset (&ctx); if (!overlap @@ -4529,8 +4523,7 @@ check_loc_or_range_structural (struct elf_file *file, if (!check_loc_or_range_ref (file, &ctx, refs[i].cu, sec, &coverage, coverage_map, sec->id == sec_ranges ? cu_coverage : NULL, - off, refs[i].cu->address_size == 8, - &refs[i].ref.who, cat)) + off, &refs[i].ref.who, cat)) retval = false; last_off = off; } @@ -4544,14 +4537,13 @@ check_loc_or_range_structural (struct elf_file *file, chain. */ coverage_find_holes (&coverage, 0, ctx.data->d_size, found_hole, &((struct hole_info) - {sec->id, cat, cu_chain->address_size, - ctx.data->d_buf})); + {sec->id, cat, ctx.data->d_buf, + cu_chain->address_size})); if (coverage_map) coverage_map_find_holes (coverage_map, &coverage_map_found_hole, &(struct coverage_map_hole_info) - {{sec->id, cat, 0, NULL}, - coverage_map->elf}); + {coverage_map->elf, {sec->id, cat, NULL, 0}}); } coverage_free (&coverage); @@ -4744,13 +4736,13 @@ check_line_structural (struct elf_file *file, /* Size. */ uint32_t size32; uint64_t size; - bool dwarf_64; + int offset_size; if (!read_ctx_read_4ubyte (&ctx, &size32)) { wr_error (&where, ": can't read table length.\n"); return false; } - if (!read_size_extra (&ctx, size32, &size, &dwarf_64, &where)) + if (!read_size_extra (&ctx, size32, &size, &offset_size, &where)) return false; struct read_ctx sub_ctx; @@ -4779,7 +4771,7 @@ check_line_structural (struct elf_file *file, /* Header length. */ uint64_t header_length; - if (!read_ctx_read_offset (&sub_ctx, dwarf_64, &header_length)) + if (!read_ctx_read_offset (&sub_ctx, offset_size == 8, &header_length)) { wr_error (&where, ": can't read attribute value.\n"); goto skip; diff --git a/src/dwarflint.h b/src/dwarflint.h index 4de91e924..6c2508205 100644 --- a/src/dwarflint.h +++ b/src/dwarflint.h @@ -69,17 +69,19 @@ extern "C" struct where { enum section_id section; + enum where_formatting formatting; uint64_t addr1; // E.g. a CU offset. uint64_t addr2; // E.g. a DIE address. uint64_t addr3; // E.g. an attribute. - enum where_formatting formatting; struct where *ref; // Related reference, e.g. an abbrev related to given DIE. struct where *next; // For forming "caused-by" chains. }; # define WHERE(SECTION, NEXT) \ ((struct where) \ - {(SECTION), (uint64_t)-1, (uint64_t)-1, (uint64_t)-1, wf_plain, NULL, NEXT}) + {(SECTION), wf_plain, \ + (uint64_t)-1, (uint64_t)-1, (uint64_t)-1, \ + NULL, NEXT}) extern const char *where_fmt (const struct where *wh, char *ptr); extern void where_fmt_chain (const struct where *wh, const char *severity); @@ -193,24 +195,21 @@ extern "C" struct sec { - Elf_Scn *scn; GElf_Shdr shdr; - enum section_id id; + struct relocation_data rel; + Elf_Scn *scn; const char *name; Elf_Data *data; /* May be NULL if data in this section are missing or not substantial. */ - struct relocation_data rel; + enum section_id id; }; struct elf_file { + GElf_Ehdr ehdr; /* Header of underlying Elf. */ Elf *elf; Ebl *ebl; - GElf_Ehdr ehdr; /* Header of underlying Elf. */ - bool addr_64; /* True if it's 64-bit Elf. */ - bool other_byte_order; /* True if the file has a byte order - different from the host. */ struct sec *sec; /* Array of sections. */ size_t size; @@ -218,6 +217,10 @@ extern "C" /* Pointers into SEC above. Maps section_id to section. */ struct sec *debugsec[count_debuginfo_sections]; + + bool addr_64; /* True if it's 64-bit Elf. */ + bool other_byte_order; /* True if the file has a byte order + different from the host. */ }; struct section_coverage @@ -232,11 +235,10 @@ extern "C" struct coverage_map { struct elf_file *elf; - bool allow_overlap; - struct section_coverage *scos; size_t size; size_t alloc; + bool allow_overlap; }; void section_coverage_init (struct section_coverage *sco, @@ -260,8 +262,8 @@ extern "C" { enum section_id section; enum message_category category; - unsigned align; void *data; + unsigned align; }; /* DATA has to be a pointer to an instance of struct hole_info. @@ -270,8 +272,8 @@ extern "C" struct coverage_map_hole_info { - struct hole_info info; struct elf_file *elf; + struct hole_info info; }; /* DATA has to be a pointer to an instance of struct hole_info. -- 2.47.3