[all-commits] [llvm/llvm-project] ae4635: RISCV, LoongArch: Encode RELAX relocation implicitly

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon May 19 18:28:16 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ae46353f5f47695ef448f558df5e5cdd48159266
      https://github.com/llvm/llvm-project/commit/ae46353f5f47695ef448f558df5e5cdd48159266
  Author: Fangrui Song <i at maskray.me>
  Date:   2025-05-19 (Mon, 19 May 2025)

  Changed paths:
    M llvm/include/llvm/MC/MCAsmBackend.h
    M llvm/include/llvm/MC/MCFixup.h
    M llvm/lib/MC/MCAsmBackend.cpp
    M llvm/lib/MC/MCELFStreamer.cpp
    M llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
    M llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp

  Log Message:
  -----------
  RISCV,LoongArch: Encode RELAX relocation implicitly

When linker relaxation is enabled, relaxable relocations are followed by
a R_RISCV_RELAX/R_LARCH_RELAX relocation. They are encoded as two fixups by
CodeEmitter and expected to have the same `IsResolved` value within
MCAssembler::evaluateFixup (they must lead to either 0 or 2
relocations). This scheme wasite space and requires RISCVAsmBackend::shouldForceRelocation
to be conservative.

This patch introduces MCFixup::NeedsRelax to encode the RELAX relocation implicitly.
The fixup will lead to either 0 or 2 relocations.

Pull Request: https://github.com/llvm/llvm-project/pull/140494



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list