aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt/test/orc/TestCases/Darwin/x86-64/jit-re-dlopen-data-reset.S
blob: 6b8e17ded7af6de9ccbb928e19d6e0653105f2cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Test that __orc_rt_macho_jit_dlopen resets the state of the data sections.
//
// RUN: %clang -c -o %t.main.o %p/Inputs/dlopen-dlclose-x2.S
// RUN: %clang -c -o %t.inits.o %s
// RUN: %llvm_jitlink \
// RUN:   -alias Platform:_dlopen=___orc_rt_macho_jit_dlopen \
// RUN:   -alias Platform:_dlclose=___orc_rt_macho_jit_dlclose \
// RUN:   %t.main.o -jd inits %t.inits.o -lmain | FileCheck %s

// CHECK: entering main
// CHECK-NEXT: X = 1, Y = 2
// CHECK-NEXT: X = 1, Y = 2
// CHECK-NEXT: leaving main

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 0
	.section	__TEXT,__StaticInit,regular,pure_instructions
	.p2align	4, 0x90
_initializer:
	movq	_X(%rip), %rsi
	addq	$1, %rsi
	movq	%rsi, _X(%rip)
	movq	_Y(%rip), %rdx
	addq	$1, %rdx
	movq	%rdx, _Y(%rip)
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	jmp	_printf

	.section	__TEXT,__cstring,cstring_literals
L_.str:
	.asciz	"X = %zu, Y = %zu\n"

	.globl	_X                              ## @X
.zerofill __DATA,__common,_X,8,3
	.section	__DATA,__data
	.globl	_Y                              ## @Y
	.p2align	3
_Y:
	.quad	1                               ## 0x1

	.section	__DATA,__mod_init_func,mod_init_funcs
	.p2align	3
	.quad	_initializer

.subsections_via_symbols