1 # RUN: rm -rf %t && mkdir -p %t
2 # RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o %t/test_x86-64.o %s
3 # RUN: llvm-rtdyld -triple=x86_64-apple-macosx10.9 -dummy-extern ds1=0xfffffffffffffffe -dummy-extern ds2=0xffffffffffffffff -verify -check=%s %t/test_x86-64.o
5 .section __TEXT,__text,regular,pure_instructions
15 # rtdyld-check: decode_operand(insn1, 0) = foo - next_pc(insn1)
20 # rtdyld-check: decode_operand(insn2, 4) = x - next_pc(insn2)
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] = 0
28 # rtdyld-check: *{8}(stub_addr(test_x86-64.o/__text, y)) = y
29 # rtdyld-check: decode_operand(insn3, 4) = stub_addr(test_x86-64.o/__text, y) - next_pc(insn3)
31 movq y@GOTPCREL
(%rip
), %rax
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)
45 .section __DATA,__data
51 # Test dummy-extern relocation.
52 # rtdyld-check: *{8}z1 = ds1
56 # Test external-symbol relocation bypass: symbols with addr 0xffffffffffffffff
57 # don't have their relocations applied.
58 # rtdyld-check: *{8}z2 = 0
62 # Test absolute symbols.
63 # rtdyld-check: abssym = 0xdeadbeef
67 # Test subtractor relocations between named symbols.
68 # rtdyld-check: *{8}z3a = z4 - z5 + 4
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)) + 8
75 .quad Lanondiff_1 - Lanondiff_2 + 8
77 # Test subtractor relocations between named and anonymous symbols.
78 # rtdyld-check: *{8}z3c = z4 - (section_addr(test_x86-64.o, _tmp4)) + 12
80 .quad z4 - Lanondiff_2 + 12
82 # Test subtractor relocations between anonymous and named symbols.
83 # rtdyld-check: *{8}z3d = (section_addr(test_x86-64.o, _tmp3) + 4) - z4 + 16
85 .quad Lanondiff_1 - z4 + 16
96 .long 1 # padding to make sure we handle non-zero offsets.
100 .section __DATA,_tmp4
104 .subsections_via_symbols