summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSid Manning <sidneym@codeaurora.org>2018-07-19 20:27:43 +0000
committerSid Manning <sidneym@codeaurora.org>2018-07-19 20:27:43 +0000
commit690b544f41d292b105931600d5ffe71ce13d5289 (patch)
tree94c580177a3a29a02ded5f45783b5a286d7f2e6c
parent408f50dbb473cc10b5acb5f7cc79605fb6629d13 (diff)
downloadbcm5719-llvm-690b544f41d292b105931600d5ffe71ce13d5289.tar.gz
bcm5719-llvm-690b544f41d292b105931600d5ffe71ce13d5289.zip
[ELF][HEXAGON] Add support for R_HEX_B15_PCREL
Add support and update the testcase. Differential Revision: https://reviews.llvm.org/D49394 llvm-svn: 337494
-rw-r--r--lld/ELF/Arch/Hexagon.cpp4
-rw-r--r--lld/test/ELF/hexagon.s4
2 files changed, 8 insertions, 0 deletions
diff --git a/lld/ELF/Arch/Hexagon.cpp b/lld/ELF/Arch/Hexagon.cpp
index 8820ddc043d..c0d48a85d23 100644
--- a/lld/ELF/Arch/Hexagon.cpp
+++ b/lld/ELF/Arch/Hexagon.cpp
@@ -53,6 +53,7 @@ static uint32_t applyMask(uint32_t Mask, uint32_t Data) {
RelExpr Hexagon::getRelExpr(RelType Type, const Symbol &S,
const uint8_t *Loc) const {
switch (Type) {
+ case R_HEX_B15_PCREL:
case R_HEX_B22_PCREL:
case R_HEX_B22_PCREL_X:
case R_HEX_B32_PCREL_X:
@@ -68,6 +69,9 @@ void Hexagon::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const {
switch (Type) {
case R_HEX_NONE:
break;
+ case R_HEX_B15_PCREL:
+ or32le(Loc, applyMask(0x00df20fe, Val >> 2));
+ break;
case R_HEX_B22_PCREL:
or32le(Loc, applyMask(0x1ff3ffe, Val >> 2));
break;
diff --git a/lld/test/ELF/hexagon.s b/lld/test/ELF/hexagon.s
index 54922fab8d3..efc7c62fe39 100644
--- a/lld/test/ELF/hexagon.s
+++ b/lld/test/ELF/hexagon.s
@@ -4,6 +4,10 @@
# RUN: ld.lld %t2 %t -o %t3
# RUN: llvm-objdump -d %t3 | FileCheck %s
+# R_HEX_B15_PCREL
+if (p0) jump:nt #_start
+# CHECK: if (p0) jump:nt 0x11000
+
# R_HEX_B22_PCREL
call #_start
# CHECK: call 0x11000
OpenPOWER on IntegriCloud