mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
Re-apply "[JITLink][ELF] Add support for ELF::R_X86_64_REX_GOTPCRELX relocation"
This re-applies e2fceec2fd1 with fixes. Apparently we already *do* support relaxation for ELF, so we need to make sure the test case allocates a slab at a fixed address, and that the R_X86_64_REX_GOTPCRELX test references an external that is guaranteed to be out of range.
This commit is contained in:
parent
f5744161af
commit
a156cf61cb
@ -232,6 +232,7 @@ private:
|
|||||||
case ELF::R_X86_64_64:
|
case ELF::R_X86_64_64:
|
||||||
return ELF_x86_64_Edges::ELFX86RelocationKind::Pointer64;
|
return ELF_x86_64_Edges::ELFX86RelocationKind::Pointer64;
|
||||||
case ELF::R_X86_64_GOTPCREL:
|
case ELF::R_X86_64_GOTPCREL:
|
||||||
|
case ELF::R_X86_64_REX_GOTPCRELX:
|
||||||
return ELF_x86_64_Edges::ELFX86RelocationKind::PCRel32GOTLoad;
|
return ELF_x86_64_Edges::ELFX86RelocationKind::PCRel32GOTLoad;
|
||||||
}
|
}
|
||||||
return make_error<JITLinkError>("Unsupported x86-64 relocation:" +
|
return make_error<JITLinkError>("Unsupported x86-64 relocation:" +
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# RUN: rm -rf %t && mkdir -p %t
|
# RUN: rm -rf %t && mkdir -p %t
|
||||||
# RUN: llvm-mc -triple=x86_64-unknown-linux -position-independent -filetype=obj -o %t/elf_reloc.o %s
|
# RUN: llvm-mc -triple=x86_64-unknown-linux -position-independent -filetype=obj -o %t/elf_reloc.o %s
|
||||||
# RUN: llvm-jitlink -noexec -check %s %t/elf_reloc.o
|
# RUN: llvm-jitlink -noexec -slab-allocate 100Kb -slab-address 0xfff00000 \
|
||||||
|
# RUN: -define-abs external_data=0x1 -check %s %t/elf_reloc.o
|
||||||
#
|
#
|
||||||
# Test standard ELF relocations.
|
# Test standard ELF relocations.
|
||||||
|
|
||||||
@ -39,12 +40,25 @@ test_gotpcrel:
|
|||||||
.Lend_test_gotpcrel:
|
.Lend_test_gotpcrel:
|
||||||
.size test_gotpcrel, .Lend_test_gotpcrel-test_gotpcrel
|
.size test_gotpcrel, .Lend_test_gotpcrel-test_gotpcrel
|
||||||
|
|
||||||
|
# Test REX_GOTPCRELX handling. We want to check both the offset to the GOT entry and its
|
||||||
|
# contents.
|
||||||
|
# jitlink-check: decode_operand(test_rex_gotpcrelx, 4) = \
|
||||||
|
# jitlink-check: got_addr(elf_reloc.o, external_data) - next_pc(test_rex_gotpcrelx)
|
||||||
|
|
||||||
|
.globl test_rex_gotpcrelx
|
||||||
|
.p2align 4, 0x90
|
||||||
|
.type test_rex_gotpcrelx,@function
|
||||||
|
test_rex_gotpcrelx:
|
||||||
|
movq external_data@GOTPCREL(%rip), %rax
|
||||||
|
.Lend_test_rex_gotpcrelx:
|
||||||
|
.size test_rex_gotpcrelx, .Lend_test_rex_gotpcrelx-test_rex_gotpcrelx
|
||||||
|
|
||||||
.type named_data,@object
|
.type named_data,@object
|
||||||
.data
|
.data
|
||||||
.p2align 2
|
.p2align 3
|
||||||
named_data:
|
named_data:
|
||||||
.long 42
|
.quad 42
|
||||||
.size named_data, 4
|
.size named_data, 8
|
||||||
|
|
||||||
# Test BSS / zero-fill section handling.
|
# Test BSS / zero-fill section handling.
|
||||||
# llvm-jitlink: *{4}bss_variable = 0
|
# llvm-jitlink: *{4}bss_variable = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user