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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 13:45:32 PDT 2015


ruiu added inline comments.

================
Comment at: ELF/OutputSections.cpp:434
@@ -432,3 +433,3 @@
   // For certain special relocations, such as R_PPC64_TOC, there's no
   // corresponding symbol. Just return 0 in that case.
   if (!Sym)
----------------
ruiu wrote:
> Update the comment to mention that we usually return 0 but may be different on PPC64.
> 
> But, actually, does this happen on non-PPC64 platform? If there's no other platform that we have to take care of this case, this is probably over-designed. We can define a function like getPPC64TocDefault() and use that function here if it's on PPC64.
So this can be as easy as

  // R_PPC64_TOC is special as that has no corresponding symbol.
  // getPPCTocBase will take care of the details for PPC.
  if (Config->EMachine == EM_PPC64 && Type == R_PPC64_TOC)
    return getPPCTocBase();


http://reviews.llvm.org/D13823





More information about the llvm-commits mailing list