[PATCH] D17813: [ELF] - add support for relocations against local symbols when producing relocatable output.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 2 09:03:22 PST 2016


ruiu added inline comments.

================
Comment at: ELF/InputSection.cpp:139
@@ +138,3 @@
+      const Elf_Sym *Sym = this->File->getLocalSymbol(SymIndex);
+      auto I = Out<ELFT>::SymTab->Locals.find(Sym);
+      P->r_offset = RelocatedSection->getOffset(Rel.r_offset);
----------------
The value should always be available, right? So, you want to do

  uint32_t Idx = Out<ELFT>::SymTab->Locals[Sym];

instead of using find.

================
Comment at: ELF/OutputSections.h:246
@@ +245,3 @@
+  // Local symbol -> ID
+  std::map<const Elf_Sym *, unsigned> Locals;
+
----------------
Please use DenseMap. Also, I'd use uint32_t instead of unsigined.


http://reviews.llvm.org/D17813





More information about the llvm-commits mailing list