From 50e7f45b280f1e7922a6525ace10a6bd33f70fa7 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 9 Jul 2019 07:12:58 +0000 Subject: [PATCH] [ELF] Assert sizeof(SymbolUnion) <= 80 Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D64077 llvm-svn: 365443 --- lld/ELF/Symbols.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index 6ca24d4413af..f9b1fc6c4dcf 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -460,6 +460,11 @@ union SymbolUnion { alignas(LazyObject) char F[sizeof(LazyObject)]; }; +// It is important to keep the size of SymbolUnion small for performance and +// memory usage reasons. 80 bytes is a soft limit based on the size of Defined +// on a 64-bit system. +static_assert(sizeof(SymbolUnion) <= 80, "SymbolUnion too large"); + template struct AssertSymbol { static_assert(std::is_trivially_destructible(), "Symbol types must be trivially destructible");