[PATCH] D123283: [MC] Improve st_size propagation rule

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 7 16:55:19 PDT 2022


MaskRay added a comment.

> So it is not as simple as propagating the size on assignment. Perhaps it would be some kind of size propagation step for all symbols prior to writing them.

Agree. The complexity is largely because the base symbol's size may be set after an assignment.

The size propagation basically needs to be done in a topological order (e.g. reverse post-order).
It can be implemented as a separate pass, or as the current approach does.
The current approach just has quadratic complexity in terms of the number of assignments. I think it is fine since MC already has such quadratic behaviors in several places (e.g. Asmparser "Recursive use of " error checking, `Layout.getBaseSymbol(Symbol)` just few lines above).
What's implemented here seems enough for a large number of use cases of using linker scripts symbol assignments and .symver.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123283



More information about the llvm-commits mailing list