68 lines · plain
1# RUN: rm -rf %t && mkdir -p %t2# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj \3# RUN: -o %t/file_to_test.o %S/Inputs/MachO_test_harness_test.s4# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj \5# RUN: -o %t/test_harness.o %s6# RUN: not llvm-jitlink -noexec -check %s %t/file_to_test.o \7# RUN: -harness %t/test_harness.o8# RUN: llvm-jitlink -noexec -phony-externals -check %s %t/file_to_test.o \9# RUN: -harness %t/test_harness.o10#11# Check that we12# (1) Can call global symbols in the test object.13# (2) Can call private symbols in the test object.14# (3) Can interpose global symbols in the test object.15# (4) Can interpose private symbols in the test object.16# (5) Don't need to resolve unused externals in the test object.17 18.section __TEXT,__text,regular,pure_instructions19 20 .globl _public_func_to_interpose21 .p2align 4, 0x9022_public_func_to_interpose:23 retq24 25 .globl _private_func_to_interpose26 .p2align 4, 0x9027_private_func_to_interpose:28 retq29 30 .globl _main31 .p2align 4, 0x9032_main:33 callq _public_func_to_test34 callq _private_func_to_test35 xorl %eax, %eax36 retq37 38 .section __DATA,__data39 40# Check that the harness and test file agree on the address of the addresses41# of the interposes:42 43# jitlink-check: *{8}_public_func_to_interpose_as_seen_by_harness = \44# jitlink-check: *{8}_public_func_to_interpose_as_seen_by_test45 46# jitlink-check: *{8}_private_func_to_interpose_as_seen_by_harness = \47# jitlink-check: *{8}_private_func_to_interpose_as_seen_by_test48 49 .globl _public_func_to_interpose_as_seen_by_harness50 .p2align 351_public_func_to_interpose_as_seen_by_harness:52 .quad _public_func_to_interpose53 54 .globl _private_func_to_interpose_as_seen_by_harness55 .p2align 356_private_func_to_interpose_as_seen_by_harness:57 .quad _private_func_to_interpose58 59# We need to reference the *_as_seen_by_test pointers used above to ensure60# that they're not dead-stripped as unused.61 .globl _anchor_test_case_pointers62 .p2align 363_anchor_test_case_pointers:64 .quad _public_func_to_interpose_as_seen_by_test65 .quad _private_func_to_interpose_as_seen_by_test66 67.subsections_via_symbols68