[PATCH] [lld] Registry model for Readers and Reference Kind strings

Michael Spencer bigcheesegs at gmail.com
Thu Dec 19 07:16:01 PST 2013

  Looks good here other than the remaining comments.

Comment at: lib/ReaderWriter/ELF/Reader.cpp:119
@@ +118,3 @@
+    std::size_t maxAlignment =
+              1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
+    auto f = createELF<DynamicFileCreateELFTraits>( 
Rui Ueyama wrote:
> This is not new code, but it does not seem to be the right way to calculate an alignment from the buffer start address. If the start address happens to be aligned on a large alignment, maxAlignment will become a large number for no reason. We should probably revisit this after submitting this patch.
maxAlignment is the maximum assumable alignment. createELF handles it correctly.

Comment at: lib/ReaderWriter/ELF/Reader.cpp:126
@@ +125,3 @@
+    std::unique_ptr<File> f2(f->release());
+    result.push_back(std::move(f2));
+    return error_code::success();
Rui Ueyama wrote:
> Can we do this as push_back(std::unique_ptr<File>(f->release)), or just push_back(std::move(f))?
Yes, the previous code should still work.




More information about the llvm-commits mailing list