This is the mail archive of the
dwarf2@corp.sgi.com
mailing list for the dwarf2 project.
Re: duplicate dwarf2 reduction via comdat
Jim Dehnert writes
>Jason Merrill wrote:
>>
>> >>>>> "David" == David B Anderson <davea@quasar.engr.sgi.com> writes:
>>
>> >>> The Elf COMDAT (aka SECTION GROUP) rules forbid relocations
>> >>> which are offsets into a COMDAT section.
>> >>
>> >> Why? Arrgh.
>>
>> > Because 'to the byte identical everywhere' is not required
>> > for section groups with the same name. So one
>> > cannot be sure that blind (internal) section relative relocations
>> > work right. (well that's my guess, not having been part of
>> > the deliberations).
>>
>> > Relocations to a particular external name are fine as these
>> > will work right even if the name is not at the identical byte in.
>>
>> So symbolic references are OK after all? That's how my implementation
>> works.
All (well almost all) relocations are 'symbolic', right?
Following this, the word 'offset' is the distance in bytes (or bits)
from an external symbol.
But some are references to a particular symbol, and some
are offsets from some particular symbol. And many that are offsets
from a symbol are offsets from a section symbol.
>It is fine to refer to a global symbol defined with a value that's in
>a group section's address range, as long as you're conscious about which
>of the group's symbols might not be defined in another instance of the
>group that might displace it. Using an offset from a global symbol
>implies knowledge about how the alternative instances would be laid out,
>and must be done ___very___ carefully.
>
>Jim
There is no problem with a relocation referencing a symbol
in a section group. But if that relocation is really using
a section-offset, referencing a 'section' as the symbol
then, as Jim says, great care is required.
My reading of the Elf doc is that using a section-offset-relocation
into a section-group is formally
and specifically not supported by Elf section groups.
(I could be misreading...).
Jim's comment about layout is the key.
How, in the presence of possibly multiple instances of stdio.h (for example)
in an app, can one guarantee the layout of .debug_info (or other)
data in a section group is byte-for-byte identical in the stdio.h
dwarf2? Something as simple as a different file-path
to the *same* header will change offsets in dwarf2.
(maybe stdio.h is a poor example, as it's not normally guilty of
mutual cross-reference to some other header).
Do we simply insist that the checksum be strong enough, leaving
it to the implementation to get this right?
Or do we set it up so even if the byte offsets are not identical
that the right things happen (for example, using 'local symbols'
resolved by the debugger, as my writeup suggested)?
davea@sgi.com