[PATCH] D41690: Simplify handling of size relocations

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 20:10:19 PST 2018


espindola created this revision.
espindola added reviewers: ruiu, grimar.
Herald added a subscriber: emaste.

This is possible now that getSize is not a template.


https://reviews.llvm.org/D41690

Files:
  ELF/InputSection.cpp
  ELF/Relocations.cpp


Index: ELF/Relocations.cpp
===================================================================
--- ELF/Relocations.cpp
+++ ELF/Relocations.cpp
@@ -1022,10 +1022,6 @@
       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.
Index: ELF/InputSection.cpp
===================================================================
--- ELF/InputSection.cpp
+++ ELF/InputSection.cpp
@@ -625,7 +625,7 @@
   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:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41690.128486.patch
Type: text/x-patch
Size: 977 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180103/4bb91004/attachment.bin>


More information about the llvm-commits mailing list