[MachO] Fix struct size assertion

std::vector can have different sizes depending on the STL's debug level,
so account for its size separately. (You could argue that we should be
accounting for all the other members separately as well, but that would
be very unergonomic, and std::vector is the only one that's caused
problems so far.)
This commit is contained in:
Shoaib Meenai 2021-11-22 14:34:42 -08:00
parent ae5348a38e
commit 2f5d6a0ea5
1 changed files with 5 additions and 2 deletions

View File

@ -26,8 +26,11 @@ using namespace llvm::support;
using namespace lld;
using namespace lld::macho;
// Verify ConcatInputSection's size on 64-bit builds.
static_assert(sizeof(void *) != 8 || sizeof(ConcatInputSection) == 120,
// Verify ConcatInputSection's size on 64-bit builds. The size of std::vector
// can differ based on STL debug levels (e.g. iterator debugging on MSVC's STL),
// so account for that.
static_assert(sizeof(void *) != 8 ||
sizeof(ConcatInputSection) == sizeof(std::vector<Reloc>) + 96,
"Try to minimize ConcatInputSection's size, we create many "
"instances of it");