File: dlopen-dlclose-x2.S

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (90 lines) | stat: -rw-r--r-- 1,673 bytes parent folder | download | duplicates (20)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Runs a sequence of dlopen, dlclose, dlopen, dlclose on a library "inits".
// This is intended as a standard harness for testing constructor / destructor
// behavior in the context of a full dlclose and then re-dlopen'ing of the
// inits library.
//
// Compiled from:
//
// int main(int argc, char *argv[]) {
//  printf("entering main\n");
//  void *H = dlopen("inits", 0);
//  if (!H) {
//    printf("failed\n");
//    return -1;
//  }
//  if (dlclose(H) == -1) {
//    printf("failed\n");
//    return -1;
//  }
//  H = dlopen("inits", 0);
//  if (!H) {
//    printf("failed\n");
//    return -1;
//  }
//  if (dlclose(H) == -1) {
//    printf("failed\n");
//    return -1;
//  }
//  printf("leaving main\n");
//  return 0;
//}

        .section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 0
	.globl	_main
	.p2align	4, 0x90
_main:

	pushq	%r14
	pushq	%rbx
	pushq	%rax
	leaq	L_str(%rip), %rdi
	callq	_puts
	leaq	L_.str.1(%rip), %rdi
	xorl	%esi, %esi
	callq	_dlopen
	movl	$-1, %ebx
	leaq	L_str.8(%rip), %r14
	testq	%rax, %rax
	je	LBB0_4

	movq	%rax, %rdi
	callq	_dlclose
	cmpl	$-1, %eax
	je	LBB0_4

	leaq	L_.str.1(%rip), %rdi
	xorl	%esi, %esi
	callq	_dlopen
	testq	%rax, %rax
	je	LBB0_4

	movq	%rax, %rdi
	callq	_dlclose
	xorl	%ebx, %ebx
	cmpl	$-1, %eax
	sete	%bl
	leaq	L_str.8(%rip), %rax
	leaq	L_str.6(%rip), %r14
	cmoveq	%rax, %r14
	negl	%ebx
LBB0_4:
	movq	%r14, %rdi
	callq	_puts
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	retq

	.section	__TEXT,__cstring,cstring_literals
L_.str.1:
	.asciz	"inits"
L_str:
	.asciz	"entering main"
L_str.6:
	.asciz	"leaving main"
L_str.8:
	.asciz	"failed"

.subsections_via_symbols