[all-commits] [llvm/llvm-project] 60a8ec: [lld][ELF] Support relax R_LARCH_ALIGN (#78692)

Jinyang He via All-commits all-commits at lists.llvm.org
Fri Feb 16 05:39:59 PST 2024


  Branch: refs/heads/release/18.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 60a8ec3a35c722a9eb8298c215321b89d0faf5b5
      https://github.com/llvm/llvm-project/commit/60a8ec3a35c722a9eb8298c215321b89d0faf5b5
  Author: Jinyang He <hejinyang at loongson.cn>
  Date:   2024-02-16 (Fri, 16 Feb 2024)

  Changed paths:
    M lld/ELF/Arch/LoongArch.cpp
    M lld/ELF/Arch/RISCV.cpp
    M lld/ELF/InputSection.cpp
    M lld/ELF/InputSection.h
    M lld/ELF/Target.h
    M lld/ELF/Writer.cpp
    A lld/test/ELF/loongarch-relax-align.s
    A lld/test/ELF/loongarch-relax-emit-relocs.s

  Log Message:
  -----------
  [lld][ELF] Support relax R_LARCH_ALIGN (#78692)

Refer to commit 6611d58f5bbc ("Relax R_RISCV_ALIGN"), we can relax
R_LARCH_ALIGN by same way. Reuse `SymbolAnchor`, `RISCVRelaxAux` and
`initSymbolAnchors` to simplify codes. As `riscvFinalizeRelax` is an
arch-specific function, put it override on `TargetInfo::finalizeRelax`,
so that LoongArch can override it, too.

The flow of relax R_LARCH_ALIGN is almost consistent with RISCV. The
difference is that LoongArch only has 4-bytes NOP and all executable
insn is 4-bytes aligned. So LoongArch not need rewrite NOP sequence.
Alignment maxBytesEmit parameter is supported in psABI v2.30.

(cherry picked from commit 06a728f3feab876f9195738b5774e82dadc0f3a7)




More information about the All-commits mailing list