• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: rm -rf %t && mkdir -p %t
2# 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.s
4# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj \
5# RUN:   -o %t/test_harness.o %s
6# RUN: not llvm-jitlink -noexec -check %s %t/file_to_test.o \
7# RUN:    -harness %t/test_harness.o
8# RUN: llvm-jitlink -noexec -phony-externals -check %s %t/file_to_test.o \
9# RUN:    -harness %t/test_harness.o
10#
11# Check that we
12#   (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_instructions
19
20  .globl	_public_func_to_interpose
21	.p2align	4, 0x90
22_public_func_to_interpose:
23	retq
24
25	.globl	_private_func_to_interpose
26	.p2align	4, 0x90
27_private_func_to_interpose:
28	retq
29
30	.globl	_main
31	.p2align	4, 0x90
32_main:
33	callq	_public_func_to_test
34	callq	_private_func_to_test
35  xorl  %eax, %eax
36	retq
37
38	.section	__DATA,__data
39
40# Check that the harness and test file agree on the address of the addresses
41# 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_test
45
46# jitlink-check: *{8}_private_func_to_interpose_as_seen_by_harness = \
47# jitlink-check:   *{8}_private_func_to_interpose_as_seen_by_test
48
49  .globl	_public_func_to_interpose_as_seen_by_harness
50	.p2align	3
51_public_func_to_interpose_as_seen_by_harness:
52	.quad	_public_func_to_interpose
53
54	.globl	_private_func_to_interpose_as_seen_by_harness
55	.p2align	3
56_private_func_to_interpose_as_seen_by_harness:
57	.quad	_private_func_to_interpose
58
59# We need to reference the *_as_seen_by_test pointers used above to ensure
60# that they're not dead-stripped as unused.
61  .globl  _anchor_test_case_pointers
62  .p2align  3
63_anchor_test_case_pointers:
64  .quad _public_func_to_interpose_as_seen_by_test
65  .quad _private_func_to_interpose_as_seen_by_test
66
67.subsections_via_symbols
68