[MC] Fix PR45805: infinite recursion in assembler
authorThomas Preud'homme <thomasp@graphcore.ai>
Tue, 5 May 2020 18:11:04 +0000 (19:11 +0100)
committerThomas Preud'homme <thomasp@graphcore.ai>
Thu, 25 Jun 2020 14:42:36 +0000 (15:42 +0100)
commit6c67ee0f58323fe39db84635ef8cea629c2214b4
tree791993781295b33df7c4e3abd9f952f9f07ce61e
parent17326ebbd6cc519e0009fef2df0f7f60b89b9831
[MC] Fix PR45805: infinite recursion in assembler

Give up folding an expression if the fragment of one of the operands
would require laying out a fragment already being laid out. This
prevents hitting an infinite recursion when a fill size expression
refers to a later fragment since computing the offset of that fragment
would require laying out the fill fragment and thus computing its size
expression.

Reviewed By: echristo

Differential Revision: https://reviews.llvm.org/D79570
llvm/include/llvm/MC/MCAsmLayout.h
llvm/include/llvm/MC/MCFragment.h
llvm/lib/MC/MCAssembler.cpp
llvm/lib/MC/MCExpr.cpp
llvm/lib/MC/MCFragment.cpp
llvm/test/MC/AsmParser/layout-interdependency.s [new file with mode: 0644]