RuntimeDyldELF: add R_AARCH64_ADD_ABS_LO12_NC reloc

Differential revision: https://reviews.llvm.org/D28115

llvm-svn: 290598
This commit is contained in:
Eugene Leviant 2016-12-27 09:51:38 +00:00
parent 57321df98a
commit 647a39b28b
2 changed files with 16 additions and 0 deletions

View File

@ -453,6 +453,15 @@ void RuntimeDyldELF::resolveAArch64Relocation(const SectionEntry &Section,
support::ulittle32_t::ref{TargetPtr} = TargetValue;
break;
}
case ELF::R_AARCH64_ADD_ABS_LO12_NC: {
// Operation: S + A
uint64_t Result = Value + Addend;
// Immediate goes in bits 21:10 of LD/ST instruction, taken
// from bits 11:0 of X
*TargetPtr |= ((Result & 0xfff) << 10);
break;
}
case ELF::R_AARCH64_LDST32_ABS_LO12_NC: {
// Operation: S + A
uint64_t Result = Value + Addend;

View File

@ -14,6 +14,9 @@ g:
movk x0, #:abs_g1_nc:f
# R_AARCH64_MOVW_UABS_G0_NC
movk x0, #:abs_g0_nc:f
a:
# R_AARCH64_ADD_ABS_LO12_NC
add x0, x0, :lo12:f
ret
.Lfunc_end0:
.size g, .Lfunc_end0-g
@ -31,3 +34,7 @@ k:
# rtdyld-check: *{4}(g + 8) = 0xf2b13560
# rtdyld-check: *{4}(g + 12) = 0xf299bde0
# rtdyld-check: *{8}k = f
## f & 0xFFF = 0xdef (bits 11:0 of f)
## 0xdef << 10 = 0x37bc00
# rtdyld-check: *{4}(a) = 0x9137bc00