[PATCH] D29637: [LLD][ELF] Use synthetic section to hold copy relocations

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 13:14:28 PST 2017


ruiu added a comment.

Generally looking good. A few minor comments.



================
Comment at: ELF/Relocations.cpp:438-439
+
+  // Create a SyntheticSection in CopySec to hold the .bss and the Copy Reloc
+  auto *CopyISec = make<CopyRelSection<ELFT>>(IsReadOnly, Alignment, SymSize);
+  CopyISec->OutSecOff = Off;
----------------
I wonder how many copy relocations are usually made for a program which needs copy relocations. If it is thousands, it is fine to create thousands of input sections here, but if it's more than that, we want to avoid that. (If it is small, I like this approach to create one section per a copy relocation, as it is simple.)


================
Comment at: ELF/Symbols.cpp:87
       return Body.getPltVA<ELFT>();
-    return SS.getBssSectionForCopy()->Addr + SS.CopyOffset;
+    auto *CopyISec = SS.getBssSectionForCopy();
+    return CopyISec->OutSec->Addr + CopyISec->OutSecOff;
----------------
auto -> InputSection<ELFT>


https://reviews.llvm.org/D29637





More information about the llvm-commits mailing list