[PATCH] Loosen the Gold ODR checker to only compare filenames

Jeffrey Yasskin jyasskin@google.com
Thu Feb 3 06:45:00 GMT 2011


Code compiled with different flags, especially -O, may have a
different line number for the first instruction in a function. This
produces false positives in the ODR checker when linking object files
that should be ABI-compatible.

The best fixes would be to A) look at the DW_AT_decl_line of the
DW_TAG_subprogram for the function, but this would require gold to
parse a whole new debug section, or B) hash the ODR-relevant aspects
of each function into a new dwarf attribute, but this would require
gcc to produce the hash and gold to parse a whole new debug section.

Instead, loosening the ODR check to allow a function's definitions to
be from anywhere within the same file removes the false positives with
much less work, and would have caused very few extra false negatives
in Google's codebase.

2011-02-02  Jeffrey Yasskin  <jyasskin@google.com>

       * dwarf_reader.h: Add a Source_location type, and change the
addr2line functions to return it.
       * dwarf_reader.cc: Implement Source_location, and change the
addr2line functions to return it.
       * symtab.cc: Sort by just the filename.
       * object.cc: Convert a Source_location return to a std::string.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: looser_odr_check.patch
Type: application/octet-stream
Size: 10582 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20110203/f94e4d81/attachment.obj>


More information about the Binutils mailing list