[PATCH] D46630: [RISCV] Insert NOPs and R_RISCV_ALIGN relocation type for .align directive when linker relaxation enabled

Shiva Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 24 02:12:54 PDT 2018


shiva0217 added a comment.

In https://reviews.llvm.org/D46630#1110712, @asb wrote:

> I think that customising the handling of MCAlignFragment is going to be the more correct (with regards to the LLVM MC design and layering) and maintainable way.
>
> I haven't fully stepped through the ordering of function calls when producing an object. Is your concern that the current call to writeNopData  from writeFragment comes too late to create the relocation?


  SMLoc FirstNOPLoc = NOP.getLoc();
  Fixups.push_back(MCFixup::create(0, TotalBytes, MCFixupKind(RISCV::fixup_riscv_align), FirstNOPLoc));

When creating fixup_riscv_align, we need to indicate the first nop position which is recorded by SMLoc data structure.
I can't find a way to implement it in writeFragment yet.


Repository:
  rL LLVM

https://reviews.llvm.org/D46630





More information about the llvm-commits mailing list