[PATCH] D42843: Ensure that Elf_Rel addends are always written for dynamic relocations

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 9 06:44:43 PST 2018


arichardson added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:1208
+                                     uint64_t OffsetInSec, Symbol *Sym) {
+  addReloc({DynType, InputSec, OffsetInSec, false, Sym, 0}, DynType, R_INVALID);
+}
----------------
ruiu wrote:
> Do I understand it correctly that, when you call the second `addReloc` (by the way it is better to give the two functions different name), `if (!Config->IsRela)` part won't be executed? If so, can this function just be
> 
>   if (Reloc.Type == Target->RelativeRel)
>     ++NumRelativeRelocs;
>   Relocs.push_back(Reloc);
> 
> ?
Since the UseSymVA flag is always zero and and the addend is zero it will not be doing anything. I avoid calling this function now to skip unnecessary checks.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42843





More information about the llvm-commits mailing list