]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: DW_AT_GNU_odr_signature is 8-byte constant
authorPetr Machata <pmachata@redhat.com>
Wed, 23 Feb 2011 20:31:14 +0000 (21:31 +0100)
committerPetr Machata <pmachata@redhat.com>
Wed, 23 Feb 2011 20:54:05 +0000 (21:54 +0100)
- make dwarf_version::form_allowed virtual.  Override in dwarf_gnu to
  force the right exact

dwarflint/dwarf_4.cc
dwarflint/dwarf_gnu.cc
dwarflint/dwarf_version.hh

index 812eef6275b6378f68db6ef3bbc4265a71196fe8..3beb9b654948302571507f20b66ae6cd9aecc3ec 100644 (file)
@@ -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
index 36c826c25860a5ef04f974047ad54e5f444d56ff..df3e85b1cdc0ead1bfd995d441f1168c6ed1949e 100644 (file)
@@ -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);
+    }
   };
 }
 
index 1d397817f77b0591f96a7861624ff2fe7ec1c495..c8a0e6a31f0c52f5e007b78adc150f048addc8e8 100644 (file)
@@ -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