105 lines · plain
1# RUN: rm -rf %t && mkdir -p %t2# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o %t/test_x86-64.o %s3# RUN: llvm-rtdyld -triple=x86_64-apple-macosx10.9 -dummy-extern ds1=0xfffffffffffffffe -dummy-extern ds2=0xffffffffffffffff -verify -check=%s %t/test_x86-64.o4 5 .section __TEXT,__text,regular,pure_instructions6 .globl foo7 .align 4, 0x908foo:9 retq10 11 .globl main12 .align 4, 0x9013main:14# Test PC-rel branch.15# rtdyld-check: decode_operand(insn1, 0) = foo - next_pc(insn1)16insn1:17 callq foo18 19# Test PC-rel signed.20# rtdyld-check: decode_operand(insn2, 4) = x - next_pc(insn2)21insn2:22 movl x(%rip), %eax23 24# Test PC-rel GOT relocation.25# Verify the alignment of the GOT entry, the contents of the GOT entry for y,26# and that the movq instruction references the correct GOT entry address:27# rtdyld-check: stub_addr(test_x86-64.o/__text, y)[2:0] = 028# rtdyld-check: *{8}(stub_addr(test_x86-64.o/__text, y)) = y29# rtdyld-check: decode_operand(insn3, 4) = stub_addr(test_x86-64.o/__text, y) - next_pc(insn3)30insn3:31 movq y@GOTPCREL(%rip), %rax32 33 movl $0, %eax34 retq35 36# Test processing of the __eh_frame section.37# rtdyld-check: *{8}(section_addr(test_x86-64.o, __eh_frame) + 0x20) = eh_frame_test - (section_addr(test_x86-64.o, __eh_frame) + 0x20)38eh_frame_test:39 .cfi_startproc40 retq41 .cfi_endproc42 43 .comm y,4,244 45 .section __DATA,__data46 .globl x47 .align 248x:49 .long 550 51# Test dummy-extern relocation.52# rtdyld-check: *{8}z1 = ds153z1:54 .quad ds155 56# Test external-symbol relocation bypass: symbols with addr 0xffffffffffffffff57# don't have their relocations applied.58# rtdyld-check: *{8}z2 = 059z2:60 .quad ds261 62# Test absolute symbols.63# rtdyld-check: abssym = 0xdeadbeef64 .globl abssym65abssym = 0xdeadbeef66 67# Test subtractor relocations between named symbols.68# rtdyld-check: *{8}z3a = z4 - z5 + 469z3a:70 .quad z4 - z5 + 471 72# Test subtractor relocations between anonymous symbols.73# rtdyld-check: *{8}z3b = (section_addr(test_x86-64.o, _tmp3) + 4) - (section_addr(test_x86-64.o, _tmp4)) + 874z3b:75 .quad Lanondiff_1 - Lanondiff_2 + 876 77# Test subtractor relocations between named and anonymous symbols.78# rtdyld-check: *{8}z3c = z4 - (section_addr(test_x86-64.o, _tmp4)) + 1279z3c:80 .quad z4 - Lanondiff_2 + 1281 82# Test subtractor relocations between anonymous and named symbols.83# rtdyld-check: *{8}z3d = (section_addr(test_x86-64.o, _tmp3) + 4) - z4 + 1684z3d:85 .quad Lanondiff_1 - z4 + 1686 87 .section __DATA,_tmp188z4:89 .byte 190 91 .section __DATA,_tmp292z5:93 .byte 194 95 .section __DATA,_tmp396 .long 1 # padding to make sure we handle non-zero offsets.97Lanondiff_1:98 .byte 199 100 .section __DATA,_tmp4101Lanondiff_2:102 .byte 1103 104.subsections_via_symbols105