[lld] r250243 - [ELF2/PPC64] S+A -> R in more places when handling R_PPC64_REL24

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 15:54:24 PDT 2015


Author: hfinkel
Date: Tue Oct 13 17:54:24 2015
New Revision: 250243

URL: http://llvm.org/viewvc/llvm-project?rev=250243&view=rev
Log:
[ELF2/PPC64] S+A -> R in more places when handling R_PPC64_REL24

We already have a variable, R, that equals S + A. Use it. NFC.

Modified:
    lld/trunk/ELF/Target.cpp

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=250243&r1=250242&r2=250243&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Tue Oct 13 17:54:24 2015
@@ -409,17 +409,17 @@ void PPC64TargetInfo::relocateOne(uint8_
   case R_PPC64_REL24: {
     uint64_t PltStart = Out<ELF64BE>::Plt->getVA();
     uint64_t PltEnd = PltStart + Out<ELF64BE>::Plt->getSize();
-    bool InPlt = PltStart <= S + A && S + A < PltEnd;
+    bool InPlt = PltStart <= R && R < PltEnd;
 
     if (!InPlt && Out<ELF64BE>::Opd) {
       // If this is a local call, and we currently have the address of a
       // function-descriptor, get the underlying code address instead.
       uint64_t OpdStart = Out<ELF64BE>::Opd->getVA();
       uint64_t OpdEnd = OpdStart + Out<ELF64BE>::Opd->getSize();
-      bool InOpd = OpdStart <= S + A && S + A < OpdEnd;
+      bool InOpd = OpdStart <= R && R < OpdEnd;
 
       if (InOpd)
-        R = read64be(&Out<ELF64BE>::OpdBuf[S + A - OpdStart]);
+        R = read64be(&Out<ELF64BE>::OpdBuf[R - OpdStart]);
     }
 
     uint32_t Mask = 0x03FFFFFC;




More information about the llvm-commits mailing list