[PATCH] D48247: lld: add experimental support for SHT_RELR sections.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 26 21:45:10 PDT 2018


ruiu added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:1761
+  // Word size in number of bytes.
+  const size_t WordSize = sizeof(Word);
+
----------------
This is the same as Config->Wordsize.


================
Comment at: ELF/SyntheticSections.cpp:1768
+  // Get offsets for all relative relocations and sort them.
+  std::vector<Word> Offsets;
+  for (const DynamicReloc &Rel : Relocs) {
----------------
I think you can always use `std::vector<uint64_t>` instead of defining `Word` and using `std::vector<Word>` because the larger integral type will just work fine for 32-bit machines in this case.


================
Comment at: ELF/SyntheticSections.cpp:1778
+    Word Current = *Curr;
+    if (Current%2 != 0) {
+      error("odd offset for RELR relocation (" + Twine(Current) + "), " +
----------------
Could you use clang-format-diff to format your patch?


================
Comment at: ELF/SyntheticSections.cpp:1785
+
+    Word Bits = 0;
+    typename std::vector<Word>::iterator Next = Curr;
----------------
I believe you can use `uint64_t` as well. We generally prefer uint64_t instead of the target-dependent integral type for the sake of simplicity.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D48247





More information about the llvm-commits mailing list