[all-commits] [llvm/llvm-project] 178ca0: [JITLink][LoongArch] Ignore R_LARCH_RELAX and chec...

ZhaoQi via All-commits all-commits at lists.llvm.org
Thu Jan 9 03:51:43 PST 2025


  Branch: refs/heads/users/zhaoqi5/jitlink-relax-align
  Home:   https://github.com/llvm/llvm-project
  Commit: 178ca010d4fa3a78d06e557a2acee75d0bc7765f
      https://github.com/llvm/llvm-project/commit/178ca010d4fa3a78d06e557a2acee75d0bc7765f
  Author: Qi Zhao <zhaoqi01 at loongson.cn>
  Date:   2025-01-08 (Wed, 08 Jan 2025)

  Changed paths:
    M llvm/lib/ExecutionEngine/JITLink/ELF_loongarch.cpp

  Log Message:
  -----------
  [JITLink][LoongArch] Ignore R_LARCH_RELAX and check R_LARCH_ALIGN

Linker relaxation is not implemented for jitlink now (maybe
implement in the future). But if relaxation is enabled by clang,
R_LARCH_RELAX and R_LARCH_ALIGN relocations will be emitted.
So we just ignore linker relaxation and check the alignment now.

If not, interpreting C++ code using clang-repl when relaxation
is enabled will occur error: `JIT session error: Unsupported
loongarch relocation:102: R_LARCH_ALIGN`.

Similar to: https://github.com/llvm/llvm-project/commit/f5b5398ebf7da1ab54f6793331bca8fbc3340f14.


  Commit: 41de630041d833c4c2f66363e3416df12e680fc9
      https://github.com/llvm/llvm-project/commit/41de630041d833c4c2f66363e3416df12e680fc9
  Author: Qi Zhao <zhaoqi01 at loongson.cn>
  Date:   2025-01-09 (Thu, 09 Jan 2025)

  Changed paths:
    M llvm/include/llvm/ExecutionEngine/JITLink/ELF_loongarch.h
    M llvm/include/llvm/ExecutionEngine/JITLink/loongarch.h
    M llvm/lib/ExecutionEngine/JITLink/ELF_loongarch.cpp
    M llvm/lib/ExecutionEngine/JITLink/loongarch.cpp
    A llvm/test/ExecutionEngine/JITLink/LoongArch/ELF_relax_align.s

  Log Message:
  -----------
  [JITLink][LoongArch] Support R_LARCH_ALIGN relaxation

Linker relaxation is not implemented for jitlink now. But if
relaxation is enabled by clang, R_LARCH_RELAX and R_LARCH_ALIGN
relocations will be emitted.

This commit adapts lld's algorithm to jitlink. Currently, only
relaxing R_LARCH_ALIGN is implemented. Other relaxable relocs
can be implemented in the future.

Without this, interpreting C++ code using clang-repl or running
ir using lli when relaxation is enabled will occur error: `JIT
session error: Unsupported loongarch relocation:102: R_LARCH_ALIGN`.

Similar to https://github.com/llvm/llvm-project/commit/310473c536dd4837934832d1b5454d212f15d5cc but only implement align.


Compare: https://github.com/llvm/llvm-project/compare/178ca010d4fa%5E...41de630041d8

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