[PATCH] D16887: Avoid code duplication when creating dynamic relocations

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 13:16:15 PST 2016


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM with a few nits.


================
Comment at: ELF/OutputSections.cpp:234-236
@@ -236,1 +233,5 @@
+  case DynamicReloc<ELFT>::Off_Got:
+    return Sym->template getGotVA<ELFT>();
+  case DynamicReloc<ELFT>::Off_GotPlt:
+    return Sym->template getGotPltVA<ELFT>();
   }
----------------
You can now remove "template ".

================
Comment at: ELF/OutputSections.cpp:250
@@ +249,3 @@
+      if (Rel.UseSymVA)
+        VA = Sym->template getVA<ELFT>();
+      else if (Rel.TargetSec)
----------------
Remove "template "?

================
Comment at: ELF/OutputSections.cpp:258
@@ +257,3 @@
+    P->r_offset = getOffset(Rel);
+    uint32_t SymIdx = (!Rel.UseSymVA && Sym) ? Sym->DynsymIndex : 0;
+    P->setSymbolAndType(SymIdx, Rel.Type, Config->Mips64EL);
----------------
Is this equivalent to

  uint32_t SymIdx = Rel.UseSymVA ? 0 : Sym->DynsymIndex;

? (You seem to assume that if UseSymVA is true, Rel.Sym is not false in a few lines above this one.)


http://reviews.llvm.org/D16887





More information about the llvm-commits mailing list