[PATCH] D13823: [ELF2] getLocalRelTarget can ask the Target for symbolless relocations

hfinkel@anl.gov via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 12:14:17 PDT 2015


hfinkel created this revision.
hfinkel added reviewers: rafael, ruiu.
hfinkel added a subscriber: llvm-commits.
hfinkel added a project: lld.

R_PPC64_TOC does not have an associated symbol, but does have a non-zero VA that target-specific code must compute using some non-trivial rule. We currently handle this as a special case in PPC64TargetInfo::relocateOne, where we know to write this special address, but does not work when creating shared libraries. The special TOC address needs to be the subject of a R_PPC64_RELATIVE relocation, and so we also need to know how to encode this special address in the addend of that relocation.

Thus, some target-specific logic is necessary when creating R_PPC64_RELATIVE as well. It looks like the best way to solve this problem is to simply have getLocalRelTarget ask the target for the address of special symbolless relocations. This allows us to remove the special case in PPC64TargetInfo::relocateOne (simplifying code there), and naturally allows the existing logic to do the right thing when creating associated R_PPC64_RELATIVE relocations for shared libraries.

http://reviews.llvm.org/D13823

Files:
  ELF/InputSection.cpp
  ELF/OutputSections.cpp
  ELF/OutputSections.h
  ELF/Target.cpp
  ELF/Target.h
  test/elf2/ppc64-shared-rel-toc.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13823.37623.patch
Type: text/x-patch
Size: 6681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151016/ff60b668/attachment.bin>


More information about the llvm-commits mailing list