The attached patch updates the ABI to document how gcc uses the C5 and D5 comdats to group constructors and destructors. The hope is that by documenting it other implementations can use it too, reducing binary bloat when gcc compiled objects are mixed with objects compiled by some other compiler
Given how comdats work I worded the change to say that an implementation can choose to group the constructors and destructors, but if it chooses to use C5/D5, then it must put the same symbols in them as gcc does. Cheers, Rafael
diff --git a/abi.html b/abi.html index bdd8476..ebbbd32 100644 --- a/abi.html +++ b/abi.html @@ -5563,18 +5563,38 @@ defined, with their complete, and base object variants. For destructors, in classes with a virtual destructor, the deleting variant is emitted as well. A user-defined constructor or destructor with non-inline, internal linkage is emitted where defined, with only -the variants actually referenced. Implicitly-defined or inline -user-defined constructors and destructors are emitted where -referenced, each in its own COMDAT group identified by the constructor -or destructor name. +the variants actually referenced. <p> This ABI does not require the generation or use of allocating constructors or deleting destructors for classes without a virtual destructor. However, if an implementation emits such functions, it -must use the external names specified in this ABI. If such a function -has external linkage, it must be emitted wherever referenced, in a -COMDAT group whose name is the external name of the function. +must use the external names specified in this ABI. + +<p> +Implicitly-defined or inline user-defined constructors and destructors are +emitted where referenced. An implementation can emit each constructor or +destructor in its own COMDAT group identified by the constructor or destructor +name or it may choose to group them. It can make the decision based on any +profitability criterion. + +<p> +If constructors for a class are grouped in a COMDAT, it is suggested that it +be named after the constructor, but with a C5 suffix. Similarly for destructors, +but with a D5 suffix. + +<p> +If the C5/D5 COMDATs are use, the implementation must obey the following +constraints: + +<ul> +<li> A C5 comdat must have exactly C1 and C2. +<li> If a class has a virtual destructor, the D5 comdat must have exactly + D0, D1 and D2. +<li> If a class has a non-virtual destructor, the D5 comdat must have only the + D1 and D2 destructors. That is true even if the implementation uses D0 + for something other than the vtable. +</ul> <p> <a name="vague-itemplate">
_______________________________________________ cxx-abi-dev mailing list [email protected] http://sourcerytools.com/cgi-bin/mailman/listinfo/cxx-abi-dev
