Page MenuHomePhabricator

[ELF2] Support relocs for local symbols
ClosedPublic

Authored by davide on Sep 18 2015, 11:42 AM.

Details

Summary

I hope this covers all the cases -- should we handle SHN_XINDEX here as well?
Also, do you want me to introduce a getLocalSymVA(InputSection, OutputSection, Sym) helper?

Event Timeline

davide updated this revision to Diff 35119.Sep 18 2015, 11:42 AM
davide retitled this revision from to [ELF2] Support relocs for local symbols.
davide updated this object.
davide added a reviewer: rafael.
davide added a subscriber: llvm-commits.
rafael edited edge metadata.Sep 18 2015, 1:47 PM
rafael added a subscriber: rafael.

Looks like getRelocationSymbol needs to be fixed first. It doesn't
handle SHN_XINDEX it it doesn't need to be templated over reloc type
since it never looks at the addend.

I will give it a quick try.

rafael added inline comments.Sep 18 2015, 2:22 PM
ELF/Writer.cpp
817 ↗(On Diff #35279)

You need a section index in here, not a symbol index.

854 ↗(On Diff #35279)

git-clang-format

davide updated this revision to Diff 35152.Sep 18 2015, 4:54 PM
davide edited edge metadata.
  • Rebased on top of Michael's patch
  • Use correct index (spotted by Rafael)
davide updated this revision to Diff 35153.Sep 18 2015, 4:57 PM

Fix typo.

rafael added inline comments.Sep 19 2015, 9:56 AM
ELF/Writer.cpp
818 ↗(On Diff #35279)

This is the case where you have to handle Sym->st_shndx being SHN_XINDEX.

davide updated this revision to Diff 35279.Sep 21 2015, 10:36 AM

Trying to wrap this up.

  • Handle SHN_XINDEX,
  • git-clang-format'ed
  • Split code in getLocalSymVA() (I plan to use in other places as well).
rafael accepted this revision.Sep 21 2015, 11:03 AM
rafael edited edge metadata.

LGTM with the test trimmed.

test/elf2/relocation-local.s
8 ↗(On Diff #35279)

This is not being used in this test, is it?

This revision is now accepted and ready to land.Sep 21 2015, 11:03 AM
This revision was automatically updated to reflect the committed changes.