[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 14:18:16 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)
----------------
hfinkel wrote:
> ruiu wrote:
> > 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();
> I took a quick look at the other ABIs (ARM, MIPS, etc.) and did not see any other similar-looking relocations. This may be a PPC64-specific "feature". I can move the function for determining the TOC address into this file and call it here.
Sounds good to me.


http://reviews.llvm.org/D13823





More information about the llvm-commits mailing list