[PATCH] D38193: Pre compute the tail of the archive

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 17:33:52 PDT 2017


ruiu added inline comments.


================
Comment at: lib/Object/ArchiveWriter.cpp:311-318
   // ld64 expects the members to be 8-byte aligned for 64-bit content and at
   // least 4-byte aligned for 32-bit content.  Opt for the larger encoding
   // uniformly.
   // We do this for all bsd formats because it simplifies aligning members.
   unsigned Alignment = isBSDLike(Kind) ? 8 : 2;
-  unsigned Pad = OffsetToAlignment(Out.tell(), Alignment);
-  while (Pad--)
-    Out.write(uint8_t(0));
+  unsigned Pad = OffsetToAlignment(Size, Alignment);
+  Size += Pad;
----------------
This is not new code, but I wonder if we can just align all members to 8 bytes. Is there any reason not to do that?


https://reviews.llvm.org/D38193





More information about the llvm-commits mailing list