[all-commits] [llvm/llvm-project] b205f2: [AMDGPU] Handle s_branch to another section.

abidh via All-commits all-commits at lists.llvm.org
Tue Jul 13 04:21:21 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b205f2bb8938447638e9ddc4ee1f6b82caeb1ad3
      https://github.com/llvm/llvm-project/commit/b205f2bb8938447638e9ddc4ee1f6b82caeb1ad3
  Author: Hafiz Abid Qadeer <abidh at codesourcery.com>
  Date:   2021-07-13 (Tue, 13 Jul 2021)

  Changed paths:
    M llvm/docs/AMDGPUUsage.rst
    M llvm/include/llvm/BinaryFormat/ELFRelocs/AMDGPU.def
    M llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
    M llvm/test/MC/AMDGPU/reloc.s
    M llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-amdgpu.test

  Log Message:
  -----------
  [AMDGPU] Handle s_branch to another section.

Currently, if target of s_branch instruction is in another section, it will fail with the error of undefined label.  Although in this case, the label is not undefined but present in another section. This patch tries to handle this issue. So while handling fixup_si_sopp_br fixup in getRelocType, if the target label is undefined we issue an error as before. If it is defined, a new relocation type R_AMDGPU_REL16 is returned.

This issue has been reported in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100181 and https://bugs.llvm.org/show_bug.cgi?id=45887. Before https://reviews.llvm.org/D79943, we used to get an crash for this scenario. The crash is fixed now but the we still get an undefined label error.  Jumps to other section can arise with hold/cold splitting.

A patch to handle the relocation in lld will follow shortly.

Reviewed By: arsenm

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




More information about the All-commits mailing list