[cxx-abi-dev] COMDAT group questions
Jim Dehnert
dehnert at transmeta.com
Sun Sep 8 03:32:48 UTC 2002
scott douglass wrote:
>
> Hello,
>
> In section 5.2.2 Static Data the C++ ABI for Itanium (Draft) says:
>
> >Inline functions, whether or not declared as such, and whether they are inline or out-of-line copies, may reference static data or character string literals, that must be kept in common among all copies by using the local symbol mangling defined above. These objects are named according to the rules for local names in the Scope Encoding section above, and the definition of each is emitted in a COMDAT group, identified by the symbol name described in the Scope Encoding section above. Each COMDAT group must be emitted in any object with references to the symbol for the object it contains, whether inline or out-of-line.
>
> Does "the definition of each is emitted in a COMDAT group" mean "the definition of each is emitted in its own COMDAT group"? I think the rest of the paragraph implies this but I want to check that I'm not confused.
Yes, it needs to. Though different compilations will define each matching
object the same, because of optimization differences they may not define the
same set of them. If you put them all in the same COMDAT group, the instance
that is linked might not include the full set that the other need; if they're
separate everything needed will be linked.
> Have I got that right?
>
> Another: What is the purpose of having the vtable, construction vtables and VTT in a single COMDAT group? Is there some way in which problems could arise if the vtable, construction vtables and VTT were in separate COMDAT groups? It seems like the vtable, construction vtables and VTT must be the identical in all translation units and from all compilers. (Except the construction vtables names but they are only referred to from the VTT.)
This is the flip side of the previous issue. By putting construction vtables
and VTT in the same group, you are guaranteed that you'll get a matched set in
the link. Also, a single group should involve a bit less space in the object
file and less linker processing.
Jim
(p.s. I don't know the answer to your second question off hand.
--
- Jim Dehnert dehnert at transmeta.com
(408)919-6984 dehnertj at acm.org
More information about the cxx-abi-dev
mailing list