diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp --- a/llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp @@ -54,6 +54,7 @@ ELFLdSt32Abs12, ELFLdSt64Abs12, ELFLdSt128Abs12, + ELFAbs64, }; static Expected @@ -76,6 +77,8 @@ return ELFLdSt64Abs12; case ELF::R_AARCH64_LDST128_ABS_LO12_NC: return ELFLdSt128Abs12; + case ELF::R_AARCH64_ABS64: + return ELFAbs64; } return make_error("Unsupported aarch64 relocation:" + @@ -199,6 +202,10 @@ Kind = aarch64::PageOffset12; break; } + case ELFAbs64: { + Kind = aarch64::Pointer64; + break; + } }; Edge GE(Kind, Offset, *GraphSymbol, Addend); @@ -231,6 +238,8 @@ return "ELFLdSt64Abs12"; case ELFLdSt128Abs12: return "ELFLdSt128Abs12"; + case ELFAbs64: + return "ELFAbs64"; default: return getGenericEdgeKindName(static_cast(R)); } diff --git a/llvm/test/ExecutionEngine/JITLink/AArch64/ELF_aarch64_relocations.s b/llvm/test/ExecutionEngine/JITLink/AArch64/ELF_aarch64_relocations.s --- a/llvm/test/ExecutionEngine/JITLink/AArch64/ELF_aarch64_relocations.s +++ b/llvm/test/ExecutionEngine/JITLink/AArch64/ELF_aarch64_relocations.s @@ -1,5 +1,6 @@ # RUN: rm -rf %t && mkdir -p %t -# RUN: llvm-mc -triple=aarch64-unknown-linux-gnu -relax-relocations=false -position-independent -filetype=obj -o %t/elf_reloc.o %s +# RUN: llvm-mc -triple=aarch64-unknown-linux-gnu -relax-relocations=false \ +# RUN: -position-independent -filetype=obj -o %t/elf_reloc.o %s # RUN: llvm-jitlink -noexec -check %s %t/elf_reloc.o .text @@ -113,6 +114,15 @@ str x0, [x1, :lo12:named_data] .size test_str_64bit, .-test_str_64bit +# Check R_AARCH64_ABS64 relocation of a function pointer to local symbol +# +# jitlink-check: *{8}local_func_addr_quad = named_func + .globl local_func_addr_quad + .p2align 3 +local_func_addr_quad: + .xword named_func + .size local_func_addr_quad, 8 + .globl named_data .p2align 4 .type named_data,@object @@ -120,3 +130,10 @@ .quad 0x2222222222222222 .quad 0x3333333333333333 .size named_data, .-named_data + + .globl named_func + .p2align 2 + .type named_func,@function +named_func: + ret + .size named_func, .-named_func