[patch] Add support for comdats to the gold plugin

Duncan P. N. Exon Smith dexonsmith at apple.com
Fri Aug 22 15:44:28 PDT 2014


> On 2014-Aug-22, at 15:32, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> 
> Duh, now with the attached patch.
> 
> On 22 August 2014 18:32, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
>>>> What gets things a bit more complicated is that gold only seems
>>>> symbols. In particular, if A is an alias to B, it only see the symbols
>>>> A and B. It can then ask us to keep symbol A but drop symbol B. What
>>>> we have to do instead is to create an internal version of B and make A
>>>> an alias to that.
>>>> 
>>> 
>>> Why not just give B internal (or private?) linkage?
>> 
>> Because in general, some uses might need to see it mapped. Consider
>> 
>> $c2 = comdat any
>> @v1 = weak global i32 41, comdat $c2
>> @r21 = global i32* @v1
>> @a21 = alias i32* @v1
>> 
>> If @v1 gets replaced with so other @v1 in another file (is in the
>> Dropped set) the correct (matching native file) semantics are that
>> @r21 will point to the new position (it uses a relocation) but @a21
>> should still point to a position with a value of 41 (that is all there

Okay, this SGTM then.



More information about the llvm-commits mailing list