97 lines · plain
1# REQUIRES: system-linux2# RUN: rm -rf %t && mkdir -p %t3# RUN: llvm-mc -triple=systemz-unknown-linux -position-independent \4# RUN: -filetype=obj -o %t/elf_pic_reloc.o %s 5#6# RUN: llvm-jitlink -noexec \ 7# RUN: -slab-allocate 100Kb -slab-address 0xfff00000 -slab-page-size 4096 \8# RUN: -abs external_data=0x1 \9# RUN: -abs extern_out_of_range32=0x7fff00000000 \10# RUN: -abs extern_in_range32=0xffe00000 \11# RUN: -check %s %t/elf_pic_reloc.o12 13 .text14 .section .text.main15 .globl main16 .p2align 417 .type main,@function18main:19 br %r1420 .size main, .-main21 22 .globl named_func23 .p2align 424 .type named_func,@function25named_func:26 br %r1427 .size named_func, .-named_func28 29# Check R_390_PC32DBL handling with a call to a local function in the text30# section. This produces a Delta32dbl edge that is resolved like a regular31# direct relative branches(no PLT entry created).32#33# jitlink-check: decode_operand(test_call_local, 1) = \34# jitlink-check: named_func - test_call_local35 .globl test_call_local36 .p2align 437 .type test_call_local,@function38test_call_local:39 brasl %r14, named_func@PLT 40 41 .size test_call_local, .-test_call_local42 43# Check R_390_PLT32dbl(DeltaPLT32dbl) handling with a call to an 44# external via PLT. This produces a Delta32dbl edge, because externals are 45# not defined locally. As the target is out-of-range from the callsite, 46# the edge keeps using its PLT entry.47#48# jitlink-check: decode_operand(test_call_extern_plt, 1) = \49# jitlink-check: stub_addr(elf_pic_reloc.o, extern_out_of_range32) - \50# jitlink-check: test_call_extern_plt51# jitlink-check: *{8}(got_addr(elf_pic_reloc.o, extern_out_of_range32)) = \52# jitlink-check: extern_out_of_range3253 .globl test_call_extern_plt54 .p2align 455 .type test_call_extern_plt,@function56test_call_extern_plt:57 brasl %r14, extern_out_of_range32@plt58 59 .size test_call_extern_plt, .-test_call_extern_plt60 61# Check PLT stub relocation for lgrl(Delta32dbl). 62#63# jitlink-check: *{4}(stub_addr(elf_pic_reloc.o, extern_out_of_range32) + 2) = \64# jitlink-check: ((got_addr(elf_pic_reloc.o, extern_out_of_range32) - \65# jitlink-check: stub_addr(elf_pic_reloc.o, extern_out_of_range32)) >> 1) \66# jitlink-check: & 0xffffffff67 .globl test_call_extern_plt_stub68 .p2align 469 .type test_call_extern_plt_stub,@function70test_call_extern_plt_stub:71 brasl %r14, extern_out_of_range32@plt72 73 .size test_call_extern_plt_stub, .-test_call_extern_plt_stub74 75# Check R_390_PLT32(DeltaPLT32dbl) handling with a call to an external. 76# This produces a Delta32dbl edge, because externals are not defined 77# locally. During resolution, the target turns out to be in-range from the 78# callsite.79### TODO: edge can be relaxed in post-allocation optimization, it will then80### require:81### jitlink-check: decode_operand(test_call_extern, 1) = \82### jitlink-check: extern_in_range32 - test_call_extern83#84# Same as test_call_extern_plt(no-optimization)85# jitlink-check: decode_operand(test_call_extern, 1) = \86# jitlink-check: stub_addr(elf_pic_reloc.o, extern_in_range32) - \87# jitlink-check: test_call_extern88# jitlink-check: *{8}(got_addr(elf_pic_reloc.o, extern_in_range32)) = \89# jitlink-check: extern_in_range3290 .globl test_call_extern91 .p2align 492 .type test_call_extern,@function93test_call_extern:94 brasl %r14, extern_in_range32@plt95 .size test_call_extern, .-test_call_extern96 97