[PATCH] D44928: [MC] Pass MCSubtargetInfo through to fixupNeedsRelaxation

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 5 12:41:13 PDT 2018


efriedma added a comment.

For the nop thing, fundamentally, I don't think there's any simpler approach.  We need to annotate each MCAlignFragment created by MCObjectStreamer::EmitCodeAlignment with the correct STI, so we can figure out the correct nops later.  We currently throw away that information, and there isn't any way to recover it later.

Consider something like the following; there are two alignment fragments, which each need a different STI.

  .arch armv6
  foo:
  mov r1, r0
  nop
  .p2align 4
  bx lr
  .arch armv7-a
  bar:
  mov r1, r0
  nop
  .p2align 4
  bx lr

I just tried binutils as for ARM, and it has an amusing bug: the nops used for all alignment directives in a file is based on the last ".arch" directive in that file.


https://reviews.llvm.org/D44928





More information about the llvm-commits mailing list