[PATCH] D14623: [ThinLTO] Comdat importing fixes and related cleanup

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 11:18:16 PST 2015


On Mon, Nov 30, 2015 at 11:08 AM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> On 30 November 2015 at 11:39, Teresa Johnson <tejohnson at google.com> wrote:
> > tejohnson added inline comments.
> >
> > ================
> > Comment at: lib/Linker/LinkModules.cpp:558
> > @@ +557,3 @@
> > +  void stripDeclsFromComdats();
> > +  void convertInvalidAliasesToDeclarations();
> > +
> > ----------------
> > rafael wrote:
> >> We cannot convert aliases to declarations.
> > Why? Note that after the conversion it isn't an alias, just a
> declaration to an externally defined symbol. This is needed to import
> anything that references an alias (especially now with your change in
> r254170).
> >
> > I.e. if we import function foo() and it calls f() which is actually an
> alias to function f2(). If we don't import f2 (or with r254170 if f2() is
> not linkonce), then f() cannot be an alias in the destination (importing)
> module. So we convert the imported f() alias into a declaration. The linker
> will resolve this to the f() alias in the importing module eventually. It
> shouldn't be any different than having a module reference an alias defined
> elsewhere originally.
>
> Why do we create the alias in the first place?
>
> If we don't want the alias to be imported, we should have not tried to
> clone it.
> If we want to import the alias but not the aliasee, we have to convert
> the aliasee to internal linkage.


Do you mean if the imported function (say 'foo') references an alias ('f'),
the aliasee 'f2' will have to be imported and converted to internal
linkage?

David




> That is something that is currently
> done only in the gold plugin. The existing llvm-link just gives the
> wrong result.
>
> All the logic behind doImportAsDefinition is something I hope to move
> out of the IR moving logic with the IRMover.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151130/cf868221/attachment.html>


More information about the llvm-commits mailing list