[PATCH] D91018: [ELF] Make InputSection smaller

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 17:58:36 PST 2020


MaskRay marked an inline comment as done.
MaskRay added inline comments.


================
Comment at: lld/ELF/InputSection.h:393
 
+static_assert(sizeof(InputSection) <= 184, "InputSection is too big");
+
----------------
lxfind wrote:
> Curious, what's the purpose of static_assert like this? Will the program behave incorrectly if the size of InputSection is larger than 184?
> Asking because with this assertion whoever adding or removing fields from this class or the base class will need to remember updating this static_assert accordingly, which I am not sure is scalable. That doesn't seem to serve the typical purpose of static_assert (which should be that the program behavior depends on it to be true) I think?
There are a few other static_assert for objects which are allocated a lot. This is important to prevent accidental regression or memory usage and performance.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91018/new/

https://reviews.llvm.org/D91018



More information about the llvm-commits mailing list