clarify the purpose of this project
[nyanglibc.git] / dlfcn / sdlerror.s
blob5ed2c6398e06bc392f81d0a84830b75c58d65041
1 .text
2 .p2align 4,,15
3 .type init, @function
4 init:
5 cmpq $0, __pthread_key_create@GOTPCREL(%rip)
6 je .L9
7 leaq free_key_mem(%rip), %rsi
8 leaq key(%rip), %rdi
9 subq $8, %rsp
10 call __pthread_key_create@PLT
11 testl %eax, %eax
12 je .L1
13 leaq last_result(%rip), %rax
14 movq %rax, static_buf(%rip)
15 .L1:
16 addq $8, %rsp
17 ret
18 .p2align 4,,10
19 .p2align 3
20 .L9:
21 leaq last_result(%rip), %rax
22 movq %rax, static_buf(%rip)
23 ret
24 .size init, .-init
25 .section .rodata.str1.1,"aMS",@progbits,1
26 .LC0:
27 .string ""
28 .LC1:
29 .string ": "
30 .LC2:
31 .string "out of memory"
32 .LC3:
33 .string "%s%s%s"
34 .LC4:
35 .string "%s%s%s: %s"
36 .text
37 .p2align 4,,15
38 .globl __dlerror
39 .hidden __dlerror
40 .type __dlerror, @function
41 __dlerror:
42 pushq %rbp
43 pushq %rbx
44 subq $24, %rsp
45 cmpq $0, __pthread_once@GOTPCREL(%rip)
46 movq $0, 8(%rsp)
47 je .L11
48 leaq init(%rip), %rsi
49 leaq once(%rip), %rdi
50 call __pthread_once@PLT
51 movq static_buf(%rip), %rbx
52 .L12:
53 testq %rbx, %rbx
54 je .L51
55 .L17:
56 movl 4(%rbx), %edx
57 movq 24(%rbx), %rax
58 testl %edx, %edx
59 je .L20
60 testq %rax, %rax
61 je .L50
62 leaq .LC2(%rip), %rdi
63 movl $14, %ecx
64 movq %rax, %rsi
65 repz cmpsb
66 je .L23
67 movq %rax, %rdi
68 call free@PLT
69 .L23:
70 movq $0, 24(%rbx)
71 .L50:
72 movq 8(%rsp), %rax
73 addq $24, %rsp
74 popq %rbx
75 popq %rbp
76 ret
77 .p2align 4,,10
78 .p2align 3
79 .L20:
80 testq %rax, %rax
81 je .L50
82 movl (%rbx), %edi
83 movq %rax, 8(%rsp)
84 testl %edi, %edi
85 je .L52
86 call strerror@PLT
87 movq 24(%rbx), %rsi
88 leaq _libc_intl_domainname(%rip), %rdi
89 movl $5, %edx
90 movq %rax, %rbp
91 call __dcgettext
92 movq 16(%rbx), %rdx
93 movq %rax, %r8
94 leaq .LC1(%rip), %rcx
95 leaq .LC0(%rip), %rax
96 leaq 8(%rsp), %rdi
97 leaq .LC4(%rip), %rsi
98 movq %rbp, %r9
99 cmpb $0, (%rdx)
100 cmove %rax, %rcx
101 xorl %eax, %eax
102 call __asprintf
103 cmpl $-1, %eax
104 je .L53
105 .L29:
106 movq 24(%rbx), %rax
107 leaq .LC2(%rip), %rdi
108 movl $14, %ecx
109 movq %rax, %rsi
110 repz cmpsb
111 jne .L54
112 .L31:
113 movq 8(%rsp), %rax
114 movq %rax, 24(%rbx)
115 .L30:
116 movl $1, 4(%rbx)
117 addq $24, %rsp
118 popq %rbx
119 popq %rbp
121 .p2align 4,,10
122 .p2align 3
123 .L11:
124 movl once(%rip), %eax
125 movq static_buf(%rip), %rbx
126 testl %eax, %eax
127 jne .L12
128 cmpq $0, __pthread_key_create@GOTPCREL(%rip)
129 je .L14
130 leaq free_key_mem(%rip), %rsi
131 leaq key(%rip), %rdi
132 call __pthread_key_create@PLT
133 testl %eax, %eax
134 jne .L15
135 movq static_buf(%rip), %rbx
136 movl once(%rip), %eax
137 .L16:
138 orl $2, %eax
139 testq %rbx, %rbx
140 movl %eax, once(%rip)
141 jne .L17
142 .L51:
143 cmpq $0, __pthread_getspecific@GOTPCREL(%rip)
144 je .L19
145 movl key(%rip), %edi
146 call __pthread_getspecific@PLT
147 testq %rax, %rax
148 movq %rax, %rbx
149 jne .L17
150 .L19:
151 leaq last_result(%rip), %rbx
152 jmp .L17
153 .p2align 4,,10
154 .p2align 3
155 .L52:
156 leaq _libc_intl_domainname(%rip), %rdi
157 movl $5, %edx
158 movq %rax, %rsi
159 call __dcgettext
160 movq 16(%rbx), %rdx
161 movq %rax, %r8
162 leaq .LC1(%rip), %rcx
163 leaq .LC0(%rip), %rax
164 leaq 8(%rsp), %rdi
165 leaq .LC3(%rip), %rsi
166 cmpb $0, (%rdx)
167 cmove %rax, %rcx
168 xorl %eax, %eax
169 call __asprintf
170 cmpl $-1, %eax
171 jne .L29
172 .L53:
173 movq 8(%rsp), %rax
174 jmp .L30
175 .p2align 4,,10
176 .p2align 3
177 .L15:
178 movl once(%rip), %eax
179 .L14:
180 leaq last_result(%rip), %rbx
181 movq %rbx, static_buf(%rip)
182 jmp .L16
183 .p2align 4,,10
184 .p2align 3
185 .L54:
186 movq %rax, %rdi
187 call free@PLT
188 jmp .L31
189 .size __dlerror, .-__dlerror
190 .p2align 4,,15
191 .type check_free.isra.0, @function
192 check_free.isra.0:
193 movq (%rdi), %rax
194 testq %rax, %rax
195 je .L64
196 pushq %rbx
197 movq %rdi, %rbx
198 leaq .LC2(%rip), %rdi
199 movl $14, %ecx
200 movq %rax, %rsi
201 repz cmpsb
202 jne .L67
203 popq %rbx
205 .p2align 4,,10
206 .p2align 3
207 .L67:
208 movq %rax, %rdi
209 call free@PLT
210 movq $0, (%rbx)
211 popq %rbx
213 .p2align 4,,10
214 .p2align 3
215 .L64:
216 rep ret
217 .size check_free.isra.0, .-check_free.isra.0
218 .p2align 4,,15
219 .type free_key_mem, @function
220 free_key_mem:
221 pushq %rbx
222 movq %rdi, %rbx
223 addq $24, %rdi
224 call check_free.isra.0
225 movq %rbx, %rdi
226 call free@PLT
227 cmpq $0, __pthread_setspecific@GOTPCREL(%rip)
228 je .L68
229 popq %rbx
230 movl key(%rip), %edi
231 xorl %esi, %esi
232 jmp __pthread_setspecific@PLT
233 .p2align 4,,10
234 .p2align 3
235 .L68:
236 popq %rbx
238 .size free_key_mem, .-free_key_mem
239 .p2align 4,,15
240 .globl _dlerror_run
241 .hidden _dlerror_run
242 .type _dlerror_run, @function
243 _dlerror_run:
244 cmpq $0, __pthread_once@GOTPCREL(%rip)
245 pushq %r12
246 movq %rsi, %r12
247 pushq %rbp
248 movq %rdi, %rbp
249 pushq %rbx
250 je .L72
251 leaq init(%rip), %rsi
252 leaq once(%rip), %rdi
253 call __pthread_once@PLT
254 movq static_buf(%rip), %rbx
255 .L73:
256 testq %rbx, %rbx
257 je .L99
258 .L78:
259 movq 24(%rbx), %rdi
260 testq %rdi, %rdi
261 je .L82
262 cmpb $0, 8(%rbx)
263 jne .L100
264 .L83:
265 movq $0, 24(%rbx)
266 .L82:
267 leaq 8(%rbx), %rdx
268 leaq 24(%rbx), %rsi
269 leaq 16(%rbx), %rdi
270 movq %r12, %r8
271 movq %rbp, %rcx
272 call _dl_catch_error
273 movl %eax, (%rbx)
274 movq 24(%rbx), %rax
275 xorl %edx, %edx
276 testq %rax, %rax
277 sete %dl
278 setne %al
279 movl %edx, 4(%rbx)
280 movzbl %al, %eax
281 popq %rbx
282 popq %rbp
283 popq %r12
285 .p2align 4,,10
286 .p2align 3
287 .L100:
288 call free@PLT
289 jmp .L83
290 .p2align 4,,10
291 .p2align 3
292 .L72:
293 movl once(%rip), %eax
294 movq static_buf(%rip), %rbx
295 testl %eax, %eax
296 jne .L73
297 cmpq $0, __pthread_key_create@GOTPCREL(%rip)
298 je .L75
299 leaq free_key_mem(%rip), %rsi
300 leaq key(%rip), %rdi
301 call __pthread_key_create@PLT
302 testl %eax, %eax
303 jne .L76
304 movq static_buf(%rip), %rbx
305 movl once(%rip), %eax
306 .L77:
307 orl $2, %eax
308 testq %rbx, %rbx
309 movl %eax, once(%rip)
310 jne .L78
311 .L99:
312 cmpq $0, __pthread_getspecific@GOTPCREL(%rip)
313 je .L81
314 movl key(%rip), %edi
315 call __pthread_getspecific@PLT
316 testq %rax, %rax
317 movq %rax, %rbx
318 jne .L78
319 .L81:
320 movl $32, %esi
321 movl $1, %edi
322 call calloc@PLT
323 testq %rax, %rax
324 movq %rax, %rbx
325 je .L101
326 cmpq $0, __pthread_setspecific@GOTPCREL(%rip)
327 je .L78
328 movl key(%rip), %edi
329 movq %rax, %rsi
330 call __pthread_setspecific@PLT
331 jmp .L78
332 .p2align 4,,10
333 .p2align 3
334 .L76:
335 movl once(%rip), %eax
336 .L75:
337 leaq last_result(%rip), %rbx
338 movq %rbx, static_buf(%rip)
339 jmp .L77
340 .p2align 4,,10
341 .p2align 3
342 .L101:
343 leaq last_result(%rip), %rbx
344 jmp .L78
345 .size _dlerror_run, .-_dlerror_run
346 .section .text.exit,"ax",@progbits
347 .p2align 4,,15
348 .type fini, @function
349 fini:
350 leaq 24+last_result(%rip), %rdi
351 jmp check_free.isra.0
352 .size fini, .-fini
353 .section .dtors,"aw",@progbits
354 .align 8
355 .quad fini
356 .section .rodata.str1.1
357 .LC5:
358 .string "_dlfcn_hook"
359 .text
360 .p2align 4,,15
361 .globl __libc_register_dlfcn_hook
362 .hidden __libc_register_dlfcn_hook
363 .type __libc_register_dlfcn_hook, @function
364 __libc_register_dlfcn_hook:
365 leaq .LC5(%rip), %rsi
366 subq $8, %rsp
367 call __libc_dlsym_private
368 testq %rax, %rax
369 je .L103
370 leaq _dlfcn_hooks(%rip), %rdx
371 movq %rdx, (%rax)
372 .L103:
373 addq $8, %rsp
375 .size __libc_register_dlfcn_hook, .-__libc_register_dlfcn_hook
376 .section .data.rel.local,"aw",@progbits
377 .align 32
378 .type _dlfcn_hooks, @object
379 .size _dlfcn_hooks, 104
380 _dlfcn_hooks:
381 .quad __dlopen
382 .quad __dlclose
383 .quad __dlsym
384 .quad __dlvsym
385 .quad __dlerror
386 .quad __dladdr
387 .quad __dladdr1
388 .quad __dlinfo
389 .quad __dlmopen
390 .zero 32
391 .local once
392 .comm once,4,4
393 .local key
394 .comm key,4,4
395 .local static_buf
396 .comm static_buf,8,8
397 .local last_result
398 .comm last_result,32,32
399 .weak __pthread_setspecific
400 .weak __pthread_getspecific
401 .weak __pthread_once
402 .weak __pthread_key_create
403 .hidden __dlmopen
404 .hidden __dlinfo
405 .hidden __dladdr1
406 .hidden __dladdr
407 .hidden __dlvsym
408 .hidden __dlsym
409 .hidden __dlclose
410 .hidden __dlopen
411 .hidden __libc_dlsym_private
412 .hidden _dl_catch_error
413 .hidden __asprintf
414 .hidden __dcgettext
415 .hidden _libc_intl_domainname