From bff671945044fd90c91bfddf65fd3f7e020c681f Mon Sep 17 00:00:00 2001 From: Sid Manning Date: Sun, 29 Jul 2018 11:59:38 +0000 Subject: [PATCH] [ELF][HEXAGON] Add R_HEX_32_6_X and R_HEX_12_X And add a test. llvm-svn: 338213 --- lld/ELF/Arch/Hexagon.cpp | 6 ++++++ lld/test/ELF/hexagon.s | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/lld/ELF/Arch/Hexagon.cpp b/lld/ELF/Arch/Hexagon.cpp index 2d5c23fd5ad6..ff5e862bafa2 100644 --- a/lld/ELF/Arch/Hexagon.cpp +++ b/lld/ELF/Arch/Hexagon.cpp @@ -70,6 +70,12 @@ void Hexagon::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const { switch (Type) { case R_HEX_NONE: break; + case R_HEX_12_X: + or32le(Loc, applyMask(0x000007e0, Val)); + break; + case R_HEX_32_6_X: + or32le(Loc, applyMask(0x0fff3fff, Val >> 6)); + break; case R_HEX_B15_PCREL: or32le(Loc, applyMask(0x00df20fe, Val >> 2)); break; diff --git a/lld/test/ELF/hexagon.s b/lld/test/ELF/hexagon.s index 8c824ea3c78a..1b3273374c67 100644 --- a/lld/test/ELF/hexagon.s +++ b/lld/test/ELF/hexagon.s @@ -4,6 +4,13 @@ # RUN: ld.lld %t2 %t -o %t3 # RUN: llvm-objdump -d %t3 | FileCheck %s +# Note: 69632 == 0x11000 +# R_HEX_32_6_X +# R_HEX_12_X +if (p0) r0 = ##_start +# CHECK: immext(#69632) +# CHECK: if (p0) r0 = ##69632 + # R_HEX_B15_PCREL if (p0) jump:nt #_start # CHECK: if (p0) jump:nt 0x11000