This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Symbols from object files that override symbols in DSO are added to .dynsym table.
ClosedPublic

Authored by grimar on Jan 21 2016, 6:20 AM.

Details

Summary

Main executable did not export symbols that exist both in the main executable and in DSOs before this patch.
Symbols from object files that override symbols in DSO should be added to .dynsym table.

This fixes https://llvm.org/bugs/show_bug.cgi?id=26222

Diff Detail

Repository
rL LLVM

Event Timeline

grimar updated this revision to Diff 45524.Jan 21 2016, 6:20 AM
grimar retitled this revision from to [ELF] - Symbols from object files that override symbols in DSO are added to .dynsym table..
grimar updated this object.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.
grimar updated this revision to Diff 45536.Jan 21 2016, 8:14 AM
grimar added a reviewer: atanasyan.
  • Updated failing test for mips

Simon, could you please look at mips test part of the patch ? I just not sure is it fine to fix the mips test or it means changes broke something.

ruiu added inline comments.Jan 21 2016, 11:00 AM
ELF/Symbols.cpp
66 ↗(On Diff #45536)

Let's do this here for consistency.

// We want to export all symbols that exist both in the executable and in DSOs
// so that the symbols in the executable can interrupt symbols in the DSO at runtime.
if (isShared() != Other->isShared())
  if (!isa<DefinedRegular<ELFT>>(isShared() ? this : Other))
    IsUsedInDynamicReloc = Other->IsUsedInDynamicReloc = true;

By the way, is this correct to have this inside if (IsUsedInRegularObj || Other->IsUsedInRegularObj) {}?

grimar updated this revision to Diff 45671.Jan 22 2016, 2:17 AM

Addressed review comments.

ELF/Symbols.cpp
66 ↗(On Diff #45536)

I think it does not make sence here. SymbolBody::compare() does not accepts lazy symbols and I also call isa<DefinedRegular<ELFT>() check.
So I think this check only works for me like check that at least one symbol is not shared. Since I have direct check for that below, there is no much sence to keep that inside.
I moved logic outside for clarity.

ruiu accepted this revision.Jan 22 2016, 3:23 PM
ruiu edited edge metadata.

LGTM

ELF/Symbols.cpp
56 ↗(On Diff #45671)

Let's add a comment.

// We want to export all symbols that exist both in the executable
// and in DSOs, so that the symbols in the executable can interrupt
// symbols in the DSO at runtime.
This revision is now accepted and ready to land.Jan 22 2016, 3:23 PM
This revision was automatically updated to reflect the committed changes.