[lld] r321900 - Simplify handling of size relocations.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 13:41:17 PST 2018


Author: rafael
Date: Fri Jan  5 13:41:17 2018
New Revision: 321900

URL: http://llvm.org/viewvc/llvm-project?rev=321900&view=rev
Log:
Simplify handling of size relocations.

This is possible now that getSize is not a template.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/Relocations.cpp

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=321900&r1=321899&r2=321900&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri Jan  5 13:41:17 2018
@@ -625,7 +625,7 @@ static uint64_t getRelocTargetVA(RelType
   case R_NEG_TLS:
     return Out::TlsPhdr->p_memsz - Sym.getVA(A);
   case R_SIZE:
-    return A; // Sym.getSize was already folded into the addend.
+    return Sym.getSize() + A;
   case R_TLSDESC:
     return InX::Got->getGlobalDynAddr(Sym) + A;
   case R_TLSDESC_PAGE:

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=321900&r1=321899&r2=321900&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Fri Jan  5 13:41:17 2018
@@ -997,10 +997,6 @@ static void scanRelocs(InputSectionBase
       continue;
     }
 
-    // The size is not going to change, so we fold it in here.
-    if (Expr == R_SIZE)
-      Addend += Sym.getSize();
-
     // If the produced value is a constant, we just remember to write it
     // when outputting this section. We also have to do it if the format
     // uses Elf_Rel, since in that case the written value is the addend.




More information about the llvm-commits mailing list