[PATCH] D70062: MCObjectStreamer: assign MCSymbols in the dummy fragment to offset 0.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 16:37:00 PST 2019


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

> In MCObjectStreamer, when there is no current fragment, initially symbols are created in a "pending" state and assigned to a dummy empty fragment.

Maybe clarify that "pending" means `SymContentsUnset`.

The following snippet (contained in `assembler-expressions.s`) fails before this change.

  .text
  text1:
  # In MCExpr.cpp, AttemptToFoldSymbolOffsetDifference cannot fold because MCValue(.).SymA is SymContentsUnset (and also MCValue(text1).SymB)
  .if . - text1 == 0
  	nop
  .endif

The second .if does not emit an error.

  .text
  text1:
  .if . - text1 == 0
  	nop
  .endif
  
  text2:
          nop
  # This does not error, because MCObjectStreamer.cpp EmitLabel changes the MCValue(.).SymA to SymContentsOffset.
  .if . - text2 == 1
  	nop
  .else
  	ret
  .endif

Probably wait for a sign-off from other reviewers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70062





More information about the llvm-commits mailing list