[PATCH] D97982: [MC] Introduce NeverAlign fragment type

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 8 16:32:34 PDT 2021


efriedma added inline comments.


================
Comment at: llvm/lib/MC/MCAssembler.cpp:389
+    const MCFragment *NF = F.getNextNode();
+    uint64_t Offset = Layout.getFragmentOffset(&NAF);
+    size_t NextFragSize = 0;
----------------
efriedma wrote:
> Recomputing the size of the fragment here is suspicious.  For other fragments, computeFragmentSize is independent from the layout of the section.  If the size needs to be changed based on the layout, it's mutated by MCAssembler::layoutSectionOnce.
> 
> I realize FT_Org doesn't follow this rule, but that's not a great example to follow.  The following currently crashes:
> 
>     foo: .org bar
>     bar:
My biggest concern with the current approach is the potential for an infinite loop.  There isn't any protection against the following fragment's offset moving backwards, which could lead to infinitely oscillating fragment sizes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97982



More information about the llvm-commits mailing list