Skip to content

Commit

Permalink
[Hexagon] Fix relocation kind for extended predicated calls
Browse files Browse the repository at this point in the history
Patch by Sid Manning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293931 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Krzysztof Parzyszek committed Feb 2, 2017
1 parent 4dfaf93 commit 42f1fb1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,16 @@ Hexagon::Fixups HexagonMCCodeEmitter::getFixupNoBits(
return Hexagon::fixup_Hexagon_B32_PCREL_X;
case MCSymbolRefExpr::VK_None: {
auto Insts = HexagonMCInstrInfo::bundleInstructions(**CurrentBundle);
for (auto I = Insts.begin(), N = Insts.end(); I != N; ++I)
for (auto I = Insts.begin(), N = Insts.end(); I != N; ++I) {
if (I->getInst() == &MI) {
if (HexagonMCInstrInfo::getDesc(MCII, *(I + 1)->getInst()).isBranch() ||
(HexagonMCInstrInfo::getType(MCII, *(I + 1)->getInst()) == HexagonII::TypeCR))
const MCInst &NextI = *(I+1)->getInst();
const MCInstrDesc &D = HexagonMCInstrInfo::getDesc(MCII, NextI);
if (D.isBranch() || D.isCall() ||
HexagonMCInstrInfo::getType(MCII, NextI) == HexagonII::TypeCR)
return Hexagon::fixup_Hexagon_B32_PCREL_X;
else
return Hexagon::fixup_Hexagon_32_6_X;
return Hexagon::fixup_Hexagon_32_6_X;
}
}
raise_relocation_error(0, kind);
}
default:
Expand Down
6 changes: 6 additions & 0 deletions test/MC/Hexagon/ext-callt-rel.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# RUN: llvm-mc -arch=hexagon -filetype=obj %s -o - | llvm-objdump -r - | FileCheck %s

if (p0) call foo
#CHECK: R_HEX_B32_PCREL_X
#CHECK: R_HEX_B15_PCREL_X

0 comments on commit 42f1fb1

Please sign in to comment.