[PATCH] Loosen the Gold ODR checker to only compare filenames
Jeffrey Yasskin
jyasskin@google.com
Thu Feb 3 23:09:00 GMT 2011
This patch should do a better job. I went back to the
substring-comparison the original code used, and chopped off the line
number in addition to the directory. The code to remove the directory
is different because the original code wasn't a transitive relation:
it reported that "c:1" < "d/a:1" < "a/b:1" < "c:1".
2011-02-03 Jeffrey Yasskin <jyasskin@google.com>
* symtab.cc: Sort by just the filename.
On Thu, Feb 3, 2011 at 2:10 PM, Jeffrey Yasskin <jyasskin@google.com> wrote:
> Whoops, please don't submit this. The strings that Source_location
> points at don't live long enough to use them in the way I'm using
> them. I'll send a working patch shortly.
>
> On Wed, Feb 2, 2011 at 10:44 PM, Jeffrey Yasskin <jyasskin@google.com> wrote:
>> 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: text/x-patch
Size: 2716 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20110203/52f73906/attachment.bin>
More information about the Binutils
mailing list