[all-commits] [llvm/llvm-project] b57159: [LoongArch] Support R_LARCH_{ADD, SUB}_ULEB128 for ...

Jinyang He via All-commits all-commits at lists.llvm.org
Mon Jan 8 23:15:08 PST 2024


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

  Changed paths:
    M llvm/include/llvm/MC/MCAsmBackend.h
    M llvm/lib/MC/MCAssembler.cpp
    M llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
    M llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h
    A llvm/test/MC/LoongArch/Relocations/leb128.s
    M llvm/test/MC/LoongArch/Relocations/relax-addsub.s

  Log Message:
  -----------
  [LoongArch] Support R_LARCH_{ADD,SUB}_ULEB128 for .uleb128 and force relocs when sym is not in section (#76433)

1, Follow RISCV 1df5ea29 to support generates relocs for .uleb128 which
can not be folded. Unlike RISCV, the located content of LoongArch should
be zero. LoongArch fixup uleb128 value by in-place addition and
subtraction reloc types named R_LARCH_{ADD,SUB}_ULEB128. The located
content can affect the result and R_LARCH_ADD_ULEB128 has enough info to
represent the first symbol value, so it needs to be set to zero.
2, Force relocs if sym is not in section so that it can emit relocs for
external symbol.

Fixes:
https://github.com/llvm/llvm-project/pull/72960#issuecomment-1866844679




More information about the All-commits mailing list