Without -gstrict-dwarf gcc allows usage of attributes from
later versions. One strange case is DW_AT_ranges in version 2
since that version doesn't actually define a rangelistptr
class. This case is added in the form_allowed override for dwarf_gnu.
In gnu mode dwarf_version_union::form_allowed checks both variants,
source and extension, in no-gnu mode, only the latest is allowed.
virtual bool
form_allowed (attribute const *attr, form const *form) const
{
+ // Without -gstrict-dwarf gcc allows usage of attributes from
+ // later versions. One strange case is DW_AT_ranges in version 2
+ // since that version doesn't actually define a rangelistptr
+ // class. So we just allow data4 or data8 here.
+ if (attr->name () == DW_AT_ranges)
+ {
+ form_width_t width = form->width (NULL);
+ return (form->classes ()[cl_constant]
+ && (width == fw_4 || width == fw_8));
+ }
+
if (attr->name () == DW_AT_GNU_odr_signature)
return form->classes ()[cl_constant] && form->width (NULL) == fw_8;
else
ret = _m_source->ambiguous_class (form, attribute, candidates);
return ret;
}
+
+ bool
+ form_allowed (attribute const *attr, form const *form) const
+ {
+ // In GNU mode any combination of new attribute/old form goes,
+ // in strict mode only the latest.
+ if (opt_nognu)
+ return _m_extension->form_allowed (attr, form);
+ else
+ return (_m_source->form_allowed (attr, form)
+ || _m_extension->form_allowed (attr, form));
+ }
};
}