diff options
| author | Lang Hames <lhames@gmail.com> | 2019-11-27 22:25:59 -0800 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2019-11-27 22:46:07 -0800 |
| commit | c33598d5e547cddcd0b2a8e647570a759e01e02b (patch) | |
| tree | 45b93d9816575560eceea5ba8e28f019e08dbe85 /llvm/test/ExecutionEngine | |
| parent | 825debe847d15a5670eff54745a6691145ddfae1 (diff) | |
| download | bcm5719-llvm-c33598d5e547cddcd0b2a8e647570a759e01e02b.tar.gz bcm5719-llvm-c33598d5e547cddcd0b2a8e647570a759e01e02b.zip | |
[JITLink] Make sure MachO/x86-64 handles 32-bit signed addends correctly.
These need to be sign extended when loading into Edge addends.
Diffstat (limited to 'llvm/test/ExecutionEngine')
| -rw-r--r-- | llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s b/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s index c97b1ecce6d..5fabc6db121 100644 --- a/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s +++ b/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s @@ -40,6 +40,17 @@ test_gotld: movq external_data@GOTPCREL(%rip), %rax retq + +# Check X86_64_RELOC_GOTPCREL handling with cmp instructions, which have +# negative addends. +# +# jitlink-check: decode_operand(test_gotcmpq, 3) = got_addr(macho_reloc.o, external_data) - next_pc(test_gotcmpq) + .globl test_gotcmpq + .align 4, 0x90 +test_gotcmpq: + cmpq $0, external_data@GOTPCREL(%rip) + retq + # Check that calls to external functions trigger the generation of stubs and GOT # entries. # @@ -118,16 +129,16 @@ Lanon_data: # anonymous. # # Note: +8 offset in expression below to accounts for sizeof(Lanon_data). -# jitlink-check: *{8}(section_addr(macho_reloc.o, __data) + 8) = (section_addr(macho_reloc.o, __data) + 8) - named_data + 2 +# jitlink-check: *{8}(section_addr(macho_reloc.o, __data) + 8) = (section_addr(macho_reloc.o, __data) + 8) - named_data - 2 .p2align 3 Lanon_minuend_quad: - .quad Lanon_minuend_quad - named_data + 2 + .quad Lanon_minuend_quad - named_data - 2 # Note: +16 offset in expression below to accounts for sizeof(Lanon_data) + sizeof(Lanon_minuend_long). -# jitlink-check: *{4}(section_addr(macho_reloc.o, __data) + 16) = ((section_addr(macho_reloc.o, __data) + 16) - named_data + 2)[31:0] +# jitlink-check: *{4}(section_addr(macho_reloc.o, __data) + 16) = ((section_addr(macho_reloc.o, __data) + 16) - named_data - 2)[31:0] .p2align 2 Lanon_minuend_long: - .long Lanon_minuend_long - named_data + 2 + .long Lanon_minuend_long - named_data - 2 # Named quad storage target (first named atom in __data). .globl named_data @@ -221,11 +232,11 @@ minuend_long3: # (i.e. is part of an alt_entry chain that includes 'A'). # # Check "A: .long B - C + D" where 'B' is an alt_entry for 'A'. -# jitlink-check: *{4}subtractor_with_alt_entry_minuend_long = (subtractor_with_alt_entry_minuend_long_B - named_data + 2)[31:0] +# jitlink-check: *{4}subtractor_with_alt_entry_minuend_long = (subtractor_with_alt_entry_minuend_long_B - named_data - 2)[31:0] .globl subtractor_with_alt_entry_minuend_long .p2align 2 subtractor_with_alt_entry_minuend_long: - .long subtractor_with_alt_entry_minuend_long_B - named_data + 2 + .long subtractor_with_alt_entry_minuend_long_B - named_data - 2 .globl subtractor_with_alt_entry_minuend_long_B .p2align 2 @@ -234,11 +245,11 @@ subtractor_with_alt_entry_minuend_long_B: .long 0 # Check "A: .quad B - C + D" where 'B' is an alt_entry for 'A'. -# jitlink-check: *{8}subtractor_with_alt_entry_minuend_quad = (subtractor_with_alt_entry_minuend_quad_B - named_data + 2) +# jitlink-check: *{8}subtractor_with_alt_entry_minuend_quad = (subtractor_with_alt_entry_minuend_quad_B - named_data - 2) .globl subtractor_with_alt_entry_minuend_quad .p2align 3 subtractor_with_alt_entry_minuend_quad: - .quad subtractor_with_alt_entry_minuend_quad_B - named_data + 2 + .quad subtractor_with_alt_entry_minuend_quad_B - named_data - 2 .globl subtractor_with_alt_entry_minuend_quad_B .p2align 3 @@ -247,11 +258,11 @@ subtractor_with_alt_entry_minuend_quad_B: .quad 0 # Check "A: .long B - C + D" where 'C' is an alt_entry for 'A'. -# jitlink-check: *{4}subtractor_with_alt_entry_subtrahend_long = (named_data - subtractor_with_alt_entry_subtrahend_long_B + 2)[31:0] +# jitlink-check: *{4}subtractor_with_alt_entry_subtrahend_long = (named_data - subtractor_with_alt_entry_subtrahend_long_B - 2)[31:0] .globl subtractor_with_alt_entry_subtrahend_long .p2align 2 subtractor_with_alt_entry_subtrahend_long: - .long named_data - subtractor_with_alt_entry_subtrahend_long_B + 2 + .long named_data - subtractor_with_alt_entry_subtrahend_long_B - 2 .globl subtractor_with_alt_entry_subtrahend_long_B .p2align 2 @@ -260,11 +271,11 @@ subtractor_with_alt_entry_subtrahend_long_B: .long 0 # Check "A: .quad B - C + D" where 'B' is an alt_entry for 'A'. -# jitlink-check: *{8}subtractor_with_alt_entry_subtrahend_quad = (named_data - subtractor_with_alt_entry_subtrahend_quad_B + 2) +# jitlink-check: *{8}subtractor_with_alt_entry_subtrahend_quad = (named_data - subtractor_with_alt_entry_subtrahend_quad_B - 2) .globl subtractor_with_alt_entry_subtrahend_quad .p2align 3 subtractor_with_alt_entry_subtrahend_quad: - .quad named_data - subtractor_with_alt_entry_subtrahend_quad_B + 2 + .quad named_data - subtractor_with_alt_entry_subtrahend_quad_B - 2 .globl subtractor_with_alt_entry_subtrahend_quad_B .p2align 3 |

