Skip to content

Commit 3241724

Browse files
author
Sid Manning
committedJul 24, 2018
[ELF][HEXAGON] Add R_HEX_B15_PCREL_X relocation
Update testcase Differential Revision: https://reviews.llvm.org/D49567 llvm-svn: 337829
1 parent 36d2e25 commit 3241724

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
 

‎lld/ELF/Arch/Hexagon.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ RelExpr Hexagon::getRelExpr(RelType Type, const Symbol &S,
5454
const uint8_t *Loc) const {
5555
switch (Type) {
5656
case R_HEX_B15_PCREL:
57+
case R_HEX_B15_PCREL_X:
5758
case R_HEX_B22_PCREL:
5859
case R_HEX_B22_PCREL_X:
5960
case R_HEX_B32_PCREL_X:
@@ -72,6 +73,9 @@ void Hexagon::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const {
7273
case R_HEX_B15_PCREL:
7374
or32le(Loc, applyMask(0x00df20fe, Val >> 2));
7475
break;
76+
case R_HEX_B15_PCREL_X:
77+
or32le(Loc, applyMask(0x00df20fe, Val & 0x3f));
78+
break;
7579
case R_HEX_B22_PCREL:
7680
or32le(Loc, applyMask(0x1ff3ffe, Val >> 2));
7781
break;

‎lld/test/ELF/hexagon.s

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
if (p0) jump:nt #_start
99
# CHECK: if (p0) jump:nt 0x11000
1010

11+
# R_HEX_B32_PCREL_X
12+
# R_HEX_B15_PCREL_X
13+
if (p0) jump:nt ##_start
14+
# CHECK: if (p0) jump:nt 0x11000
15+
1116
# R_HEX_B22_PCREL
1217
call #_start
1318
# CHECK: call 0x11000

0 commit comments

Comments
 (0)
Please sign in to comment.