2016-08-15 Jakub Jelinek <jakub@redhat.com>
+ * dwarf2out.c (struct checksum_attributes): Add
+ at_string_length_bit_size and at_string_length_byte_size fields.
+ (collect_checksum_attributes): Handle DW_AT_string_length_bit_size
+ and DW_AT_string_length_byte_size.
+ (die_checksum_ordered): Handle at_string_length_bit_size and
+ at_string_length_byte_size.
+ (gen_array_type_die): For dwarf_version >= 5 emit
+ DW_AT_string_length_byte_size instead of DW_AT_byte_size.
+ (adjust_string_types): For dwarf_version >= 5 remove
+ DW_AT_string_length_byte_size instead of DW_AT_byte_size.
+ (resolve_addr): Likewise.
+
PR debug/71906
* dwarf2out.c (string_types): New variable.
(gen_array_type_die): Change early_dwarf handling of
dw_attr_node *at_small;
dw_attr_node *at_segment;
dw_attr_node *at_string_length;
+ dw_attr_node *at_string_length_bit_size;
+ dw_attr_node *at_string_length_byte_size;
dw_attr_node *at_threads_scaled;
dw_attr_node *at_upper_bound;
dw_attr_node *at_use_location;
case DW_AT_string_length:
attrs->at_string_length = a;
break;
+ case DW_AT_string_length_bit_size:
+ attrs->at_string_length_bit_size = a;
+ break;
+ case DW_AT_string_length_byte_size:
+ attrs->at_string_length_byte_size = a;
+ break;
case DW_AT_threads_scaled:
attrs->at_threads_scaled = a;
break;
CHECKSUM_ATTR (attrs.at_small);
CHECKSUM_ATTR (attrs.at_segment);
CHECKSUM_ATTR (attrs.at_string_length);
+ CHECKSUM_ATTR (attrs.at_string_length_bit_size);
+ CHECKSUM_ATTR (attrs.at_string_length_byte_size);
CHECKSUM_ATTR (attrs.at_threads_scaled);
CHECKSUM_ATTR (attrs.at_upper_bound);
CHECKSUM_ATTR (attrs.at_use_location);
add_AT_location_description (array_die, DW_AT_string_length,
loc);
if (size != DWARF2_ADDR_SIZE)
- add_AT_unsigned (array_die, DW_AT_byte_size, size);
+ add_AT_unsigned (array_die, dwarf_version >= 5
+ ? DW_AT_string_length_byte_size
+ : DW_AT_byte_size, size);
}
}
}
else
{
remove_AT (array_die, DW_AT_string_length);
- remove_AT (array_die, DW_AT_byte_size);
+ remove_AT (array_die, dwarf_version >= 5
+ ? DW_AT_string_length_byte_size
+ : DW_AT_byte_size);
}
}
}
/* For DW_AT_string_length attribute with DW_OP_call4 reference to a variable
or argument, adjust it if needed and return:
- -1 if the DW_AT_string_length attribute and DW_AT_byte_size attribute
- if present should be removed
+ -1 if the DW_AT_string_length attribute and DW_AT_{string_length_,}byte_size
+ attribute if present should be removed
0 keep the attribute as is if the referenced var or argument has
only DWARF expression that covers all ranges
1 if the attribute has been successfully adjusted. */
case -1:
remove_AT (die, a->dw_attr);
ix--;
- /* For DWARF4 and earlier, if we drop DW_AT_string_length,
- we need to drop also DW_AT_byte_size. */
+ /* If we drop DW_AT_string_length, we need to drop also
+ DW_AT_{string_length_,}byte_size. */
remove_AT_byte_size = true;
continue;
default:
}
if (remove_AT_byte_size)
- remove_AT (die, DW_AT_byte_size);
+ remove_AT (die, dwarf_version >= 5
+ ? DW_AT_string_length_byte_size
+ : DW_AT_byte_size);
FOR_EACH_CHILD (die, c, resolve_addr (c));
}