[all-commits] [llvm/llvm-project] c51ab4: [LoongArch] Insert nops and emit align reloc when ...

Jinyang He via All-commits all-commits at lists.llvm.org
Tue Jan 23 17:18:01 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c51ab483e6c2d991a01179584705b83fbea1940d
      https://github.com/llvm/llvm-project/commit/c51ab483e6c2d991a01179584705b83fbea1940d
  Author: Jinyang He <hejinyang at loongson.cn>
  Date:   2024-01-24 (Wed, 24 Jan 2024)

  Changed paths:
    M llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
    M llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h
    M llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h
    A llvm/test/MC/LoongArch/Relocations/align-non-executable.s
    M llvm/test/MC/LoongArch/Relocations/relax-addsub.s
    A llvm/test/MC/LoongArch/Relocations/relax-align.s

  Log Message:
  -----------
  [LoongArch] Insert nops and emit align reloc when handle alignment directive (#72962)

Refer to RISCV, we will fix up the alignment if linker relaxation
changes code size and breaks alignment. Insert enough Nops and emit
R_LARCH_ALIGN relocation type so that linker could satisfy the alignment
by removing Nops.
It does so only in sections with the SHF_EXECINSTR flag.

In LoongArch psABI v2.30, R_LARCH_ALIGN requires symbol index. The
lowest 8 bits of addend represent alignment and the other bits of addend
represent the maximum number of bytes to emit.




More information about the All-commits mailing list