clarify the purpose of this project
[nyanglibc.git] / dlfcn / sdlopen.s
blob83cb86209b8f7425386a4ea3bdd90ae850ed6155
1 .text
2 .section .rodata.str1.1,"aMS",@progbits,1
3 .LC0:
4 .string ""
5 .LC1:
6 .string "invalid mode parameter"
7 .text
8 .p2align 4,,15
9 .type dlopen_doit, @function
10 dlopen_doit:
11 pushq %rbx
12 movl 8(%rdi), %esi
13 testl $-1073746192, %esi
14 jne .L6
15 movq 24(%rdi), %rdx
16 movq %rdi, %rbx
17 movq (%rdi), %rdi
18 leaq .LC0(%rip), %rax
19 orl $-2147483648, %esi
20 movq __libc_argv(%rip), %r9
21 movl __libc_argc(%rip), %r8d
22 testq %rdi, %rdi
23 cmove %rax, %rdi
24 subq $8, %rsp
25 pushq __environ(%rip)
26 xorl %ecx, %ecx
27 call _dl_open
28 movq %rax, 16(%rbx)
29 popq %rax
30 popq %rdx
31 popq %rbx
32 ret
33 .L6:
34 leaq .LC1(%rip), %rsi
35 leaq _libc_intl_domainname(%rip), %rdi
36 movl $5, %edx
37 call __dcgettext
38 xorl %edx, %edx
39 movq %rax, %rcx
40 xorl %esi, %esi
41 xorl %edi, %edi
42 call _dl_signal_error
43 .size dlopen_doit, .-dlopen_doit
44 .p2align 4,,15
45 .globl __dlopen
46 .hidden __dlopen
47 .type __dlopen, @function
48 __dlopen:
49 subq $40, %rsp
50 movq %rdi, (%rsp)
51 leaq dlopen_doit(%rip), %rdi
52 movl %esi, 8(%rsp)
53 movq %rsp, %rsi
54 movq %rdx, 24(%rsp)
55 call _dlerror_run
56 testl %eax, %eax
57 jne .L9
58 movq 16(%rsp), %rdi
59 call __libc_register_dl_open_hook
60 movq 16(%rsp), %rdi
61 call __libc_register_dlfcn_hook
62 movq 16(%rsp), %rax
63 addq $40, %rsp
64 ret
65 .p2align 4,,10
66 .p2align 3
67 .L9:
68 xorl %eax, %eax
69 addq $40, %rsp
70 ret
71 .size __dlopen, .-__dlopen
72 .hidden __libc_register_dlfcn_hook
73 .hidden __libc_register_dl_open_hook
74 .hidden _dlerror_run
75 .hidden _dl_signal_error
76 .hidden __dcgettext
77 .hidden _libc_intl_domainname
78 .hidden _dl_open
79 .hidden __libc_argc
80 .hidden __libc_argv