From: Petr Machata Date: Wed, 23 Feb 2011 20:31:14 +0000 (+0100) Subject: dwarflint: DW_AT_GNU_odr_signature is 8-byte constant X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=92cf230319c6f079498b2912484ef074a5d84c07;p=thirdparty%2Felfutils.git dwarflint: DW_AT_GNU_odr_signature is 8-byte constant - make dwarf_version::form_allowed virtual. Override in dwarf_gnu to force the right exact --- diff --git a/dwarflint/dwarf_4.cc b/dwarflint/dwarf_4.cc index 812eef627..3beb9b654 100644 --- a/dwarflint/dwarf_4.cc +++ b/dwarflint/dwarf_4.cc @@ -1,5 +1,5 @@ /* Pedantic checking of DWARF files - Copyright (C) 2010 Red Hat, Inc. + Copyright (C) 2010, 2011 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -67,8 +67,7 @@ namespace add (exprloc_form (DW_FORM_exprloc)); add (flag_form (DW_FORM_flag_present, fw_0)); - // xxx This actually needs to be something like ref8_form. This - // and DW_AT_GNU_odr_signature. + // http://wiki.dwarfstd.org/index.php?title=COMDAT_Type_Sections add (ref_form (DW_FORM_ref_sig8, fw_8)); // In DWARF 2 we claim that blocks are exprloc forms (see diff --git a/dwarflint/dwarf_gnu.cc b/dwarflint/dwarf_gnu.cc index 36c826c25..df3e85b1c 100644 --- a/dwarflint/dwarf_gnu.cc +++ b/dwarflint/dwarf_gnu.cc @@ -1,5 +1,5 @@ /* Pedantic checking of DWARF files - Copyright (C) 2010 Red Hat, Inc. + Copyright (C) 2010, 2011 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -63,12 +63,10 @@ namespace add (const_attribute (DW_AT_GNU_shared_locks_required)); // Contains a shallower 8-byte signature of the type described - // in the type unit. We encode it the same way as - // DW_AT_signature, which AFAICT is just a standardized name of - // DW_AT_GNU_odr_signature. + // in the type unit. This is nominally a const_attribute, but + // we do the checking ourselves in form_allowed. // http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo - // http://wiki.dwarfstd.org/index.php?title=COMDAT_Type_Sections - add (ref_attribute (DW_AT_GNU_odr_signature)); + add (const_attribute (DW_AT_GNU_odr_signature)); add (string_attribute (DW_AT_GNU_template_name)); // xxx ??? } @@ -80,6 +78,18 @@ namespace dwarf_gnu_ext_t () : std_dwarf (dwarf_gnu_attributes (), form_table ()) {} + + virtual bool + form_allowed (int attribute_name, int form_name) const + { + if (attribute_name == DW_AT_GNU_odr_signature) + { + form const *f = get_form (form_name); + return f->classes ()[cl_constant] && f->width (NULL) == fw_8; + } + else + return std_dwarf::form_allowed (attribute_name, form_name); + } }; } diff --git a/dwarflint/dwarf_version.hh b/dwarflint/dwarf_version.hh index 1d397817f..c8a0e6a31 100644 --- a/dwarflint/dwarf_version.hh +++ b/dwarflint/dwarf_version.hh @@ -186,7 +186,7 @@ public: /// Figure out whether, in given DWARF version, given attribute is /// allowed to have given form. - bool form_allowed (int attribute_name, int form_name) const; + virtual bool form_allowed (int attribute_name, int form_name) const; /// Answer a class of FORM given ATTRIBUTE as a context. If there's /// exactly one candidate class, that's the one answered. If