This is an archive of the discontinued LLVM Phabricator instance.

[lto] Don't add variables with private linkage to the symbol table.
ClosedPublic

Authored by silvas on Mar 8 2016, 3:06 PM.

Details

Summary

Do we need any other special handling for these?

This causes the issue in PR26872 to go away now that we aren't creating
symbols for the string literals, but that may just be concealing a
deeper problem, so best to keep that PR open.

In my testing, it seems that InternalLinkage also needs to be added to
this if condition (to avoid duplicate symbol errors for C/C++
"static") and also AppendingLinkage (to avoid duplicate symbols for
llvm.global_ctors).
Those will be in separate patches though.

Diff Detail

Repository
rL LLVM

Event Timeline

silvas updated this revision to Diff 50076.Mar 8 2016, 3:06 PM
silvas retitled this revision from to [lto] Don't add variables with private linkage to the symbol table..
silvas updated this object.
silvas added a reviewer: rafael.
silvas added subscribers: llvm-commits, Bigcheese.
rafael accepted this revision.Mar 8 2016, 3:28 PM
rafael edited edge metadata.

LGTM with nits.

ELF/InputFiles.cpp
447 ↗(On Diff #50076)

Please move getFlags earlier and use

if (!(Fags & object::BasicSymbolRef::SF_Global))

continue;
test/ELF/lto/linkage.ll
4 ↗(On Diff #50076)

Can you just pass %t1.o twice?

This revision is now accepted and ready to land.Mar 8 2016, 3:28 PM
This revision was automatically updated to reflect the committed changes.