[PATCH] [lld][ELF][Writer] Add dynamic relocation tables.

Shankar Kalpathi Easwaran shankarke at gmail.com
Tue Feb 26 08:43:12 PST 2013



================
Comment at: lib/ReaderWriter/ELF/SectionChunks.h:771-783
@@ +770,15 @@
+
+  bool getRelocationIndex(const Reference &r, uint32_t &res) {
+    auto rel = std::find_if(
+        _relocs.begin(), _relocs.end(),
+        [&](const std::pair<const DefinedAtom *, const Reference *> &p) {
+      if (p.second == &r)
+        return true;
+      return false;
+    });
+    if (rel == _relocs.end())
+      return false;
+    res = std::distance(_relocs.begin(), rel);
+    return true;
+  }
+
----------------
How is this function used, I dont see a call to this.

================
Comment at: lib/ReaderWriter/ELF/SectionChunks.h:798-799
@@ -761,3 +797,4 @@
       Elf_Rela *r = reinterpret_cast<Elf_Rela *>(dest);
-      r->setSymbolAndType(0, rel.second->kind());
+      r->setSymbolAndType(_symbolTable->getSymbolTableIndex(
+                              rel.second->target()), rel.second->kind());
       r->r_offset =
----------------
Do you need to check if the dynamic symbol table exists, not sure, if there is a case where the dynamic symbol table may not exist(You already check in finalize to check if the symbol table exists, same logic may apply here).


http://llvm-reviews.chandlerc.com/D461



More information about the llvm-commits mailing list