[PATCH] D52202: [ELF] Use the Repl point to avoid the segfault when using ICF

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 17 18:01:04 PDT 2018


phosek created this revision.
phosek added a reviewer: ruiu.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.

This addresses PR38918.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D52202

Files:
  lld/ELF/InputSection.cpp


Index: lld/ELF/InputSection.cpp
===================================================================
--- lld/ELF/InputSection.cpp
+++ lld/ELF/InputSection.cpp
@@ -402,7 +402,7 @@
       }
 
       if (RelTy::IsRela)
-        P->r_addend = Sym.getVA(Addend) - Section->getOutputSection()->Addr;
+        P->r_addend = Sym.getVA(Addend) - Section->Repl->getOutputSection()->Addr;
       else if (Config->Relocatable)
         Sec->Relocations.push_back({R_ABS, Type, Rel.r_offset, Addend, &Sym});
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52202.165856.patch
Type: text/x-patch
Size: 501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180918/8a91497d/attachment.bin>


More information about the llvm-commits mailing list