[PATCH] lld part of the mips64 little endian patch

Shankar Kalpathi Easwaran shankarke at gmail.com
Tue Apr 2 17:33:53 PDT 2013


  Could you also add a testcase with this patch too.


================
Comment at: lib/ReaderWriter/ELF/Atoms.h:36-48
@@ -35,13 +35,15 @@
 
-  ELFReference(const Elf_Rela *rela, uint64_t offset, const Atom *target)
-      : _target(target), _targetSymbolIndex(rela->getSymbol()),
+  ELFReference(const Elf_Rela *rela, uint64_t offset, const Atom *target,
+               bool isMips)
+      : _target(target), _targetSymbolIndex(rela->getSymbol(isMips)),
         _offsetInAtom(offset), _addend(rela->r_addend) {
-    _kind = (Kind) rela->getType();
+    _kind = (Kind) rela->getType(isMips);
   }
 
-  ELFReference(const Elf_Rel *rel, uint64_t offset, const Atom *target)
-      : _target(target), _targetSymbolIndex(rel->getSymbol()),
+  ELFReference(const Elf_Rel *rel, uint64_t offset, const Atom *target,
+               bool isMips)
+      : _target(target), _targetSymbolIndex(rel->getSymbol(isMips)),
         _offsetInAtom(offset), _addend(0) {
-    _kind = (Kind) rel->getType();
+    _kind = (Kind) rel->getType(isMips);
   }
 
----------------
Does Mips have both rel/rela relocations ?

================
Comment at: lib/ReaderWriter/ELF/File.h:579-581
@@ -578,4 +578,5 @@
           continue;
         auto *ERef = new (_readerStorage)
-            ELFReference<ELFT>(&rai, rai.r_offset - symbol->st_value, nullptr);
+           ELFReference<ELFT>(&rai, rai.r_offset - symbol->st_value, nullptr,
+                              _objFile->isMips64EL());
         _references.push_back(ERef);
----------------
the ELFReference should not know about Targets, I think its better to have the TargetHandler return a proper kind and use that information.


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



More information about the llvm-commits mailing list