[all-commits] [llvm/llvm-project] 992094: [JITLink] Fix the incorrect relocation behavior fo...

luxufan via All-commits all-commits at lists.llvm.org
Sun Feb 6 22:39:15 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9920943ea201189f9b34918c7663d8a03d7e4676
      https://github.com/llvm/llvm-project/commit/9920943ea201189f9b34918c7663d8a03d7e4676
  Author: luxufan <932494295 at qq.com>
  Date:   2022-02-07 (Mon, 07 Feb 2022)

  Changed paths:
    M llvm/include/llvm/ExecutionEngine/JITLink/riscv.h
    M llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
    M llvm/test/ExecutionEngine/JITLink/RISCV/ELF_branch.s

  Log Message:
  -----------
  [JITLink] Fix the incorrect relocation behavior for R_RISCV_BRANCH

In D116573, the relocation behavior of R_RISCV_BRANCH didn't consider that branch instruction like 'bge' has a branch target address which is given as a PC-relative offset, sign-extend and multiplied by 2.
Although the target address is a 12-bits number, acctually its range is [-4096, 4094].

This patch fix it.

Differential Revision: https://reviews.llvm.org/D118151




More information about the All-commits mailing list