r218141 - In the Itanium ABI, move stuff to the comdat of variables with static init.

Richard Smith richard at metafoo.co.uk
Thu Dec 18 17:46:50 PST 2014


On Thu, Dec 18, 2014 at 2:30 PM, David Majnemer <david.majnemer at gmail.com>
wrote:
>
> On Wednesday, December 17, 2014, Richard Smith <richard at metafoo.co.uk>
> wrote:
>
>> On Wed, Dec 17, 2014 at 3:52 PM, Rafael EspĂ­ndola <
>> rafael.espindola at gmail.com> wrote:
>>>
>>> > Based on talking to David, we think the frontend should be responsible
>>> for
>>> > picking whether things are ODR or not, and then LLVM optimizations can
>>> > continue to be mostly ignorant of comdats. For example, the D5
>>> destructor
>>> > comdat group functions should all be inlinable.
>>>
>>> +1 :-)
>>>
>>
>> I think that makes a lot of sense. Does this imply that globals within a
>> comdat would need to have some kind of weak linkage?
>>
>
> The only non-weak linkage we allow in COMDATs is external.  The closest
> analog is weak_odr but it has subtly different semantics wrt duplicate
> symbol definitions.
>
> I'll try to dig up a concrete example as soon as I can get to my laptop.
>

I think Rafael's right here: external symbols in a comdat are meaningful
(and presumably they mean that you can't have that symbol defined in any
other object file you link in, so you either get your definition or no
definition), and I can imagine (rare) cases when they might be what you
want. (And if not, don't do that...)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141218/e5746645/attachment.html>


More information about the cfe-commits mailing list