[PATCH] D47755: [RISCV] Insert R_RISCV_ALIGN relocation type and Nops for alignment when linker relaxation enabled

Shiva Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 4 19:15:57 PDT 2018


shiva0217 created this revision.
shiva0217 added reviewers: asb, apazos.
Herald added subscribers: mgrang, edward-jones, zzheng, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar.

Linker relaxation may change code size. We need to fix up the alignment by inserting Nops and R_RISCV_ALIGN relocation type. So then linker could satisfy the alignment by removing Nops.

To do this:

1. Add insertNopBytesForAlignDirectiveInTextSection target hook to calculate the Nops we need to insert.
2. Add insertFixupForAlignDirectiveInTextSection target hook to insert the fixup type.


Repository:
  rL LLVM

https://reviews.llvm.org/D47755

Files:
  include/llvm/MC/MCAsmBackend.h
  lib/MC/MCAssembler.cpp
  lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
  lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp
  lib/Target/RISCV/MCTargetDesc/RISCVFixupKinds.h
  test/MC/RISCV/align.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47755.149894.patch
Type: text/x-patch
Size: 9685 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180605/9a94b872/attachment.bin>


More information about the llvm-commits mailing list