This is an archive of the discontinued LLVM Phabricator instance.

Alternative fix for PR33097
AbandonedPublic

Authored by davide on Aug 21 2017, 7:07 AM.

Details

Reviewers
grimar
pcc
ruiu

Diff Detail

Event Timeline

davide created this revision.Aug 21 2017, 7:07 AM
grimar added inline comments.Aug 21 2017, 7:48 AM
ELF/LTO.cpp
149

Don't we need to allow STV_PROTECTED ?
Also you can probably omit calling computeBinding() as it always return just Binding for relocatable output anyways.
And ExternalReloc sound similar to "External relocation", a bit confusing naming IMO. May be better to not define any variable at all, and just:

if (Config->Relocatable)
  R.VisibleToRegularObj =
      Sym->Binding != STB_LOCAL &&
      (Sym->Visibility == STV_DEFAULT || Sym->Visibility == STV_PROTECTED);
else
  R.VisibleToRegularObj = Sym->IsUsedInRegularObj ||
                          (R.Prevailing && Sym->includeInDynsym()) ||
                          UsedStartStop.count(ObjSym.getSectionName());
davide added inline comments.Aug 21 2017, 10:09 AM
ELF/LTO.cpp
149

Yes, I'm under the impression we need to handle also PROTECTED here. Peter?

pcc added inline comments.Aug 21 2017, 10:13 AM
ELF/LTO.cpp
149

I don't think we can drop any global symbols here regardless of visibility. Hidden symbols may only be dropped during a final (exec or DSO) link.

davide added inline comments.Aug 21 2017, 10:16 AM
ELF/LTO.cpp
149

I assume we can drop symbols marked with STB_LOCAL binding though?

Also, FWIW, we should consider making the same change to the gold plugin.

pcc added inline comments.Aug 21 2017, 10:26 AM
ELF/LTO.cpp
149

I don't think we should ever see STB_LOCAL symbols here during a relocatable link because:

  • we never add local symbols to the global symbol table nor are local symbols exposed by the lto api
  • output symbols have the same binding as input symbols during relocatable links.
davide abandoned this revision.Aug 21 2017, 10:30 AM

Oh, fair enough, my bad.
I guess George's patch should go in instead. Let me abandon this.