[RuntimeDyld] Skip relocations for external symbols with 64-bit address ~0ULL.
[oota-llvm.git] / test / ExecutionEngine / RuntimeDyld / X86 / MachO_x86-64_PIC_relocations.s
index cbaadacbce52d95758164ee5d1a31b9e37430263..2ef8cc439df115e82b94e6c56f168dc60fffa32a 100644 (file)
@@ -1,5 +1,5 @@
-# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -relocation-model=pic -filetype=obj -o %T/foo.o %s
-# RUN: llvm-rtdyld -triple=x86_64-apple-macosx10.9 -verify -check=%s %/T/foo.o
+# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -relocation-model=pic -filetype=obj -o %T/test_x86-64.o %s
+# 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
 
         .section       __TEXT,__text,regular,pure_instructions
        .globl  foo
@@ -23,14 +23,21 @@ insn2:
 # Test PC-rel GOT relocation.
 # Verify both the contents of the GOT entry for y, and that the movq instruction
 # references the correct GOT entry address:
-# rtdyld-check: *{8}(stub_addr(foo.o, __text, y)) = y
-# rtdyld-check: decode_operand(insn3, 4) = stub_addr(foo.o, __text, y) - next_pc(insn3)
+# rtdyld-check: *{8}(stub_addr(test_x86-64.o, __text, y)) = y
+# rtdyld-check: decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)
 insn3:
         movq   y@GOTPCREL(%rip), %rax
 
         movl   $0, %eax
        retq
 
+# Test processing of the __eh_frame section.
+# rtdyld-check: *{8}(section_addr(test_x86-64.o, __eh_frame) + 0x20) = eh_frame_test - (section_addr(test_x86-64.o, __eh_frame) + 0x20)
+eh_frame_test:
+        .cfi_startproc
+        retq
+        .cfi_endproc
+
         .comm   y,4,2
 
         .section       __DATA,__data
@@ -39,4 +46,15 @@ insn3:
 x:
         .long   5
 
+# Test dummy-extern relocation.
+# rtdyld-check: *{8}z1 = ds1
+z1:
+        .quad   ds1
+
+# Test external-symbol relocation bypass: symbols with addr 0xffffffffffffffff
+# don't have their relocations applied.
+# rtdyld-check: *{8}z2 = 0
+z2:
+        .quad   ds2
+
 .subsections_via_symbols