[lld] r284740 - Fix SectionPiece size when compiling with MSVC

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 20 08:59:08 PDT 2016


Author: hans
Date: Thu Oct 20 10:59:08 2016
New Revision: 284740

URL: http://llvm.org/viewvc/llvm-project?rev=284740&view=rev
Log:
Fix SectionPiece size when compiling with MSVC

Builds were failing with:

  InputSection.h(139): error C2338: SectionPiece is too big

because MSVC does record layout differently, probably not packing the
'OutputOff' and 'Live' bitfields because their types are of different
size. Using size_t for 'Live' seems to fix it.

Modified:
    lld/trunk/ELF/InputSection.h

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=284740&r1=284739&r2=284740&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Thu Oct 20 10:59:08 2016
@@ -133,7 +133,7 @@ struct SectionPiece {
 
   size_t InputOff;
   ssize_t OutputOff : 8 * sizeof(ssize_t) - 1;
-  uint32_t Live : 1;
+  size_t Live : 1;
 };
 static_assert(sizeof(SectionPiece) == 2 * sizeof(size_t),
               "SectionPiece is too big");




More information about the llvm-commits mailing list