From: Petr Machata Date: Mon, 18 Oct 2010 17:56:42 +0000 (+0200) Subject: dwarflint: Add --nognu option for not using the GNU extension to DWARF X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9c0ff8cc2eaceb58221871bcc6c70074dc997ed0;p=thirdparty%2Felfutils.git dwarflint: Add --nognu option for not using the GNU extension to DWARF --- diff --git a/dwarflint/dwarf_gnu.cc b/dwarflint/dwarf_gnu.cc index 243b30dc5..36c826c25 100644 --- a/dwarflint/dwarf_gnu.cc +++ b/dwarflint/dwarf_gnu.cc @@ -49,12 +49,11 @@ namespace add (flag_attribute (DW_AT_GNU_vector)); - // http://gcc.gnu.org/wiki/ThreadSafetyAnnotationsInDWARF - // xxx these are glass cl_GNU_mutexlistptr. data4 and data8 are // supposed to have this class. So how do we smuggle this class // to whatever DW_FORM_data4 and DW_FORM_data8 have in current // version? For now, just claim it's plain old constant. + // http://gcc.gnu.org/wiki/ThreadSafetyAnnotationsInDWARF add (const_attribute (DW_AT_GNU_guarded_by)); add (const_attribute (DW_AT_GNU_pt_guarded_by)); add (const_attribute (DW_AT_GNU_guarded)); diff --git a/dwarflint/dwarf_version.cc b/dwarflint/dwarf_version.cc index a8536b712..9b4ebaaf8 100644 --- a/dwarflint/dwarf_version.cc +++ b/dwarflint/dwarf_version.cc @@ -220,17 +220,31 @@ dwarf_version::extend (dwarf_version const *source, return new dwarf_version_union (source, extension); } +global_opt + nognu ("Don't use GNU extension.", "nognu"); + +namespace +{ + dwarf_version const *get_ext () + { + // xxx The GNU toolchain commonly uses DW_AT_MIPS_linkage_name, + // which is part of the MIPS extensions. So that's what we + // return. I wonder how to solve this "right". We cannot simply + // request DW_AT_producer/DW_AT_language values here, since we + // need the version to know how to read these attributes in the + // first place. + + if (nognu) + return dwarf_mips_ext (); + else + return dwarf_version::extend (dwarf_mips_ext (), dwarf_gnu_ext ()); + } +} + dwarf_version const * dwarf_version::get (unsigned version) { - // xxx The GNU toolchain commonly uses DW_AT_MIPS_linkage_name, - // which is part of the MIPS extensions. So that's what we return. - // I wonder how to solve this "right". We cannot simply request - // DW_AT_producer/DW_AT_language values here, since we need the - // version to know how to read these attributes in the first place. - // - // Similarly we assume the GNU extension is used. - static dwarf_version const *ext = extend (dwarf_mips_ext (), dwarf_gnu_ext ()); + static dwarf_version const *ext = get_ext (); switch (version) { @@ -252,7 +266,8 @@ dwarf_version::get (unsigned version) return dw; } - default: return NULL; + default: + return NULL; }; }