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

Rahul Chaudhry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 2 12:58:34 PDT 2018


rahulchaudhry added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:1783
+
+    Elf_Relr R;
+    if (Bits == 0) {
----------------
ruiu wrote:
> Please use `typename ELFT::uint` instead of Elf_Relr.
See above.


================
Comment at: ELF/SyntheticSections.h:547
+private:
+  std::vector<Elf_Relr> RelrRelocs;
+};
----------------
ruiu wrote:
> Use `typename ELFT::uint` instead of ELF_Relr.
I don't think these are interchangeable here. Elf_Relr is defined as packed<uint> in ELFT. The packed<> takes care of endianness conversion when cross-compiling for a target architecture with a different endianness.
RelrRelocs is written to output using a memcpy() in writeTo(). If we convert RelrRelocs to store raw ELFT::uint values, we'll need to do byte swapping in writeTo() in case the target endianness is different.
Maybe I'm missing something or understood it all wrong.



Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D48247





More information about the llvm-commits mailing list