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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 2 12:45:18 PST 2018


ruiu added a comment.

I don't think I fully understand the code. Can you write more comments so that first-time readers of your code can understand how your code is supposed to work?



================
Comment at: ELF/SyntheticSections.h:331
   int64_t Addend;
+  friend class RelocationBaseSection;
 };
----------------
Basically we should avoid `friend` whenever possible. If you need to access something that is currently private, please make it public.


================
Comment at: ELF/SyntheticSections.h:366
+  void addReloc(const DynamicReloc &Reloc, RelType Type,
+                RelExpr Expr = R_ADDEND);
   bool empty() const override { return Relocs.empty(); }
----------------
Just like above, please avoid writing functions with default parameters (and function overloading) as well. I prefer not to hide arguments.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42843





More information about the llvm-commits mailing list