gold patch committed: Fix ODR violation detection reloc handling
Ian Lance Taylor
iant@google.com
Wed Dec 1 19:50:00 GMT 2010
This patch changes the ODR violation detector in gold to include the
reloc addend. This is clearly the correct thing to do. Unfortunately I
don't have a reliable test case. The reloc addend was accidentally
omitted in the past because ODR violations normally happen with
functions with vague linkage, and those are normally always at the start
of a section. The relevant reloc is the one in the debug info, and it
normally always refers to the start of a section with a reloc of zero.
However, when using multiple inheritance, g++ may add a thunk to the
start of a section, in which case the reloc addend does become relevant.
If you are very unlucky, it is possible to get an incorrect report of an
ODR violation because ignoring the addend can cause gold to deduce
different line numbers.
I committed this patch to mainline to fix the problem.
Ian
2010-12-01 Ian Lance Taylor <iant@google.com>
* dwarf_reader.h (class Sized_dwarf_line_info): Add
track_relocs_type_ field.
* dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
Set track_relocs_type_.
(Sized_dwarf_line_info::process_one_opcode): Ignore the section
contents when using RELA relocs.
(Sized_dwarf_line_info::read_relocs): Add the reloc addend to
reloc_map_.
* reloc.cc (Track_relocs::next_addend): New function.
* reloc.h (class Track_relocs): Declare next_addend.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 5274 bytes
Desc: ODR
URL: <https://sourceware.org/pipermail/binutils/attachments/20101201/05535daf/attachment.bin>
More information about the Binutils
mailing list