[dwarf reader] Support reference types without explicit DW_AT_byte_size

On x86_64 at least, in the debug info emitted by Clang, reference
types don't necessarily have the DW_AT_byte_size property.  In that
case, assume the size of the pointer type is the address size of the
current translation unit, rather than giving up and not building the
type.

	* src/abg-dwarf-reader.cc (build_reference_type): If the type DIE
	has no DW_AT_byte_size, assume the type size is the translation
	unit's address size.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2015-08-22 09:33:13 +02:00
parent 12123aede6
commit ae5e1be5c3
3 changed files with 37827 additions and 31529 deletions

View File

@ -7052,10 +7052,16 @@ build_reference_type(read_context& ctxt,
type_base_sptr utype = is_type(utype_decl);
assert(utype);
size_t size;
if (!die_unsigned_constant_attribute(die, DW_AT_byte_size, size))
return result;
size *= 8;
// if the DIE for the reference type doesn't have a byte_size
// attribute then we assume the size of the reference is the address
// size of the current translation unit.
size_t size = ctxt.cur_tu()->get_address_size();
if (die_unsigned_constant_attribute(die, DW_AT_byte_size, size))
size *= 8;
// And the size of the pointer must be the same as the address size
// of the current translation unit.
assert((size_t) ctxt.cur_tu()->get_address_size() == size);
bool is_lvalue = (tag == DW_TAG_reference_type) ? true : false;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff