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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 10:08:19 PST 2016


ruiu added inline comments.

================
Comment at: ELF/Writer.cpp:234-237
@@ -231,4 +233,6 @@
     if (!Opt && Out<ELFT>::Got->addDynTlsEntry(Body)) {
-      Out<ELFT>::RelaDyn->addReloc({&C, &RI});
-      Out<ELFT>::RelaDyn->addReloc({nullptr, nullptr});
+      Out<ELFT>::RelaDyn->addReloc(
+          {Target->TlsModuleIndexRel, DynamicReloc<ELFT>::Off_GTlsIndex, Body});
+      Out<ELFT>::RelaDyn->addReloc(
+          {Target->TlsOffsetRel, DynamicReloc<ELFT>::Off_GTlsOffset, Body});
       Body->setUsedInDynamicReloc();
----------------
I like this part. It naturally represents what we are doing for the TLS relocations (rather than reserving an extra slot in an obscure way.)


Repository:
  rL LLVM

http://reviews.llvm.org/D16887





More information about the llvm-commits mailing list