clarify the purpose of this project
[nyanglibc.git] / grp / initgroups.s
blob3706bd617b4a0a3285737188572c5dbc3b5ff21f
1 .text
2 #APP
3 .section .gnu.warning.getgrouplist
4 .previous
5 .section .gnu.warning.initgroups
6 .previous
7 .section .rodata.str1.1,"aMS",@progbits,1
8 .LC0:
9 .string "getgrent_r"
10 .LC1:
11 .string "setgrent"
12 .LC2:
13 .string "endgrent"
14 #NO_APP
15 .text
16 .p2align 4,,15
17 .type compat_call.constprop.1, @function
18 compat_call.constprop.1:
19 .LFB86:
20 pushq %r15
21 pushq %r14
22 movq %rdi, %r15
23 pushq %r13
24 pushq %r12
25 pushq %rbp
26 pushq %rbx
27 movq %rsi, %rbp
28 leaq .LC0(%rip), %rsi
29 subq $1144, %rsp
30 movq (%r9), %r13
31 movl %edx, 20(%rsp)
32 movq %rcx, 24(%rsp)
33 movq %r8, 32(%rsp)
34 movq %r9, 56(%rsp)
35 call __nss_lookup_function
36 testq %rax, %rax
37 je .L22
38 leaq .LC1(%rip), %rsi
39 movq %r15, %rdi
40 movq %rax, %r12
41 call __nss_lookup_function
42 testq %rax, %rax
43 movq %rax, %r14
44 je .L5
45 movq %rax, %rdi
46 call _dl_mcount_wrapper_check
47 call *%r14
48 cmpl $1, %eax
49 movl %eax, %ebx
50 je .L5
51 .L1:
52 addq $1144, %rsp
53 movl %ebx, %eax
54 popq %rbx
55 popq %rbp
56 popq %r12
57 popq %r13
58 popq %r14
59 popq %r15
60 ret
61 .p2align 4,,10
62 .p2align 3
63 .L5:
64 leaq .LC2(%rip), %rsi
65 movq %r15, %rdi
66 call __nss_lookup_function
67 movq %rax, 48(%rsp)
68 leaq 96(%rsp), %rax
69 movq __libc_errno@gottpoff(%rip), %r14
70 addq %fs:0, %r14
71 movq $1024, 104(%rsp)
72 movq %rax, 40(%rsp)
73 leaq 112(%rsp), %rax
74 movq %rax, 96(%rsp)
75 leaq 64(%rsp), %rax
76 movq %rax, 8(%rsp)
77 .p2align 4,,10
78 .p2align 3
79 .L4:
80 movq %r12, %rdi
81 call _dl_mcount_wrapper_check
82 movq %r14, %rcx
83 movq 104(%rsp), %rdx
84 movq 96(%rsp), %rsi
85 movq 8(%rsp), %rdi
86 call *%r12
87 cmpl $-2, %eax
88 movl %eax, %ebx
89 je .L41
90 cmpl $1, %eax
91 jne .L9
92 movl 80(%rsp), %ebx
93 cmpl 20(%rsp), %ebx
94 je .L4
95 movq 88(%rsp), %r15
96 movq (%r15), %rdi
97 testq %rdi, %rdi
98 jne .L20
99 jmp .L4
100 .p2align 4,,10
101 .p2align 3
102 .L11:
103 addq $8, %r15
104 movq (%r15), %rdi
105 testq %rdi, %rdi
106 je .L4
107 .L20:
108 movq %rbp, %rsi
109 call strcmp
110 testl %eax, %eax
111 jne .L11
112 movq 24(%rsp), %rax
113 movq (%rax), %rdx
114 cmpq $0, %rdx
115 jle .L12
116 cmpl 0(%r13), %ebx
117 je .L4
118 xorl %eax, %eax
119 jmp .L13
120 .p2align 4,,10
121 .p2align 3
122 .L14:
123 cmpl 0(%r13,%rax,4), %ebx
124 je .L4
125 .L13:
126 addq $1, %rax
127 cmpq %rdx, %rax
128 jne .L14
129 .L15:
130 movq 32(%rsp), %rax
131 cmpq (%rax), %rdx
132 je .L42
133 .L16:
134 movq 24(%rsp), %rax
135 movl %ebx, 0(%r13,%rdx,4)
136 addq $1, %rdx
137 movq %rdx, (%rax)
138 jmp .L4
139 .p2align 4,,10
140 .p2align 3
141 .L41:
142 movq __libc_errno@gottpoff(%rip), %rax
143 cmpl $34, %fs:(%rax)
144 je .L8
145 .L9:
146 movl $1, %ebx
147 .L6:
148 movq 40(%rsp), %rax
149 movq 96(%rsp), %rdi
150 addq $16, %rax
151 cmpq %rax, %rdi
152 je .L21
153 call free@PLT
154 .L21:
155 movq 48(%rsp), %r14
156 testq %r14, %r14
157 je .L1
158 movq %r14, %rdi
159 call _dl_mcount_wrapper_check
160 movq %r14, %rax
161 call *%rax
162 jmp .L1
163 .p2align 4,,10
164 .p2align 3
165 .L8:
166 movq 40(%rsp), %rdi
167 call __libc_scratch_buffer_grow
168 testb %al, %al
169 jne .L4
170 jmp .L6
171 .L12:
172 jne .L4
173 jmp .L15
174 .p2align 4,,10
175 .p2align 3
176 .L42:
177 cmpq $0, 1200(%rsp)
178 jle .L17
179 cmpq 1200(%rsp), %rdx
180 je .L9
181 addq %rdx, %rdx
182 cmpq 1200(%rsp), %rdx
183 cmovg 1200(%rsp), %rdx
184 movq %rdx, %rbx
185 .L19:
186 leaq 0(,%rbx,4), %rsi
187 movq %r13, %rdi
188 call realloc@PLT
189 testq %rax, %rax
190 movq %rax, %r13
191 je .L9
192 movq 56(%rsp), %rax
193 movq %r13, (%rax)
194 movq 32(%rsp), %rax
195 movq %rbx, (%rax)
196 movq 24(%rsp), %rax
197 movl 80(%rsp), %ebx
198 movq (%rax), %rdx
199 jmp .L16
200 .L17:
201 leaq (%rdx,%rdx), %rbx
202 jmp .L19
203 .L22:
204 movl $-1, %ebx
205 jmp .L1
206 .LFE86:
207 .size compat_call.constprop.1, .-compat_call.constprop.1
208 .section .rodata.str1.1
209 .LC3:
210 .string "initgroups.c"
211 .LC4:
212 .string "*size > 0"
213 .LC5:
214 .string "files"
215 .LC6:
216 .string "initgroups_dyn"
217 .section .rodata.str1.8,"aMS",@progbits,1
218 .align 8
219 .LC7:
220 .string "Illegal status in internal_getgrouplist.\n"
221 .text
222 .p2align 4,,15
223 .type internal_getgrouplist, @function
224 internal_getgrouplist:
225 .LFB82:
226 pushq %r15
227 pushq %r14
228 pushq %r13
229 pushq %r12
230 pushq %rbp
231 pushq %rbx
232 subq $40, %rsp
233 cmpq $0, (%rdx)
234 movq %rdi, 8(%rsp)
235 jle .L94
236 movq (%rcx), %rax
237 leaq 24(%rsp), %r14
238 movl %esi, %ebx
239 movl $5, %edi
240 movq %rdx, %rbp
241 movq %rcx, %r12
242 movq %r8, %r13
243 movl %esi, (%rax)
244 movq %r14, %rsi
245 movq $1, 16(%rsp)
246 call __nss_database_get
247 testb %al, %al
248 je .L45
249 movq 24(%rsp), %rdi
250 testq %rdi, %rdi
251 je .L45
252 movb $1, use_initgroups_entry(%rip)
253 .L50:
254 cmpq $0, (%rdi)
255 leaq 16(%rsp), %r14
256 je .L48
257 .p2align 4,,10
258 .p2align 3
259 .L47:
260 leaq .LC6(%rip), %rsi
261 movq 16(%rsp), %r15
262 call __nss_lookup_function
263 testq %rax, %rax
264 je .L95
265 movq %rax, %rdi
266 movq %rax, (%rsp)
267 call _dl_mcount_wrapper_check
268 movq __libc_errno@gottpoff(%rip), %rdx
269 addq %fs:0, %rdx
270 subq $8, %rsp
271 movq %rbp, %rcx
272 movq %r13, %r9
273 movq %r12, %r8
274 movl %ebx, %esi
275 pushq %rdx
276 movq %r14, %rdx
277 movq 24(%rsp), %rdi
278 movq 16(%rsp), %rax
279 call *%rax
280 popq %rdx
281 popq %rcx
282 .L52:
283 movq 16(%rsp), %r8
284 movq %r15, %rdi
285 xorl %r11d, %r11d
286 .L53:
287 cmpq %r8, %rdi
288 jge .L57
289 .L96:
290 testq %r15, %r15
291 jle .L56
292 movq (%r12), %rcx
293 leaq (%rcx,%rdi,4), %r9
294 movl (%r9), %esi
295 cmpl (%rcx), %esi
296 je .L54
297 xorl %edx, %edx
298 jmp .L58
299 .p2align 4,,10
300 .p2align 3
301 .L55:
302 cmpl %esi, (%rcx,%rdx,4)
303 je .L54
304 .L58:
305 addq $1, %rdx
306 cmpq %rdx, %r15
307 jne .L55
308 .L56:
309 addq $1, %rdi
310 cmpq %r8, %rdi
311 jl .L96
312 .L57:
313 testb %r11b, %r11b
314 jne .L97
315 .L59:
316 leal 2(%rax), %ecx
317 cmpl $4, %ecx
318 ja .L98
319 cmpb $0, use_initgroups_entry(%rip)
320 movq 24(%rsp), %rdx
321 jne .L64
322 cmpl $1, %eax
323 je .L61
324 .L64:
325 movl 8(%rdx), %eax
326 addl %ecx, %ecx
327 shrl %cl, %eax
328 andl $3, %eax
329 cmpl $1, %eax
330 je .L48
331 .L61:
332 leaq 16(%rdx), %rdi
333 testq %rdi, %rdi
334 movq %rdi, 24(%rsp)
335 je .L48
336 cmpq $0, 16(%rdx)
337 jne .L47
338 .L48:
339 movq 16(%rsp), %rax
340 addq $40, %rsp
341 popq %rbx
342 popq %rbp
343 popq %r12
344 popq %r13
345 popq %r14
346 popq %r15
348 .L45:
349 movq %r14, %rsi
350 movl $2, %edi
351 call __nss_database_get
352 testb %al, %al
353 je .L49
354 movq 24(%rsp), %rdi
355 testq %rdi, %rdi
356 je .L49
357 movb $0, use_initgroups_entry(%rip)
358 jmp .L50
359 .L49:
360 leaq .LC5(%rip), %rdi
361 call __nss_action_parse@PLT
362 testq %rax, %rax
363 movq %rax, %rdi
364 movq %rax, 24(%rsp)
365 movb $0, use_initgroups_entry(%rip)
366 jne .L50
367 jmp .L48
368 .p2align 4,,10
369 .p2align 3
370 .L54:
371 subq $1, %r8
372 movl $1, %r11d
373 movl (%rcx,%r8,4), %edx
374 movl %edx, (%r9)
375 jmp .L53
376 .L95:
377 subq $8, %rsp
378 movq %r12, %r9
379 movq %rbp, %r8
380 pushq %r13
381 movq 24(%rsp), %rsi
382 movq %r14, %rcx
383 movq 40(%rsp), %rdi
384 movl %ebx, %edx
385 call compat_call.constprop.1
386 popq %rsi
387 popq %rdi
388 jmp .L52
389 .L97:
390 movq %r8, 16(%rsp)
391 jmp .L59
392 .L98:
393 leaq .LC7(%rip), %rdi
394 call __libc_fatal
395 .L94:
396 leaq __PRETTY_FUNCTION__.13359(%rip), %rcx
397 leaq .LC3(%rip), %rsi
398 leaq .LC4(%rip), %rdi
399 movl $68, %edx
400 call __assert_fail
401 .LFE82:
402 .size internal_getgrouplist, .-internal_getgrouplist
403 .p2align 4,,15
404 .globl getgrouplist
405 .type getgrouplist, @function
406 getgrouplist:
407 .LFB83:
408 pushq %r14
409 pushq %r13
410 movq %rcx, %r13
411 pushq %r12
412 pushq %rbp
413 movq %rdi, %rbp
414 pushq %rbx
415 movl $1, %edi
416 movl %esi, %r12d
417 movq %rdx, %rbx
418 movl $-1, %r14d
419 subq $16, %rsp
420 movl (%rcx), %eax
421 testl %eax, %eax
422 cmovg (%rcx), %edi
423 movslq %edi, %rdi
424 movq %rdi, (%rsp)
425 salq $2, %rdi
426 call malloc@PLT
427 testq %rax, %rax
428 movq %rax, 8(%rsp)
429 je .L99
430 leaq 8(%rsp), %rcx
431 movq $-1, %r8
432 movl %r12d, %esi
433 movq %rbp, %rdi
434 movq %rsp, %rdx
435 call internal_getgrouplist
436 cmpl %eax, 0(%r13)
437 movl %eax, %edx
438 movq 8(%rsp), %r12
439 cmovle 0(%r13), %edx
440 movq %rbx, %rdi
441 movl %eax, %ebp
442 movq %r12, %rsi
443 movslq %edx, %rdx
444 salq $2, %rdx
445 call memcpy@PLT
446 movq %r12, %rdi
447 call free@PLT
448 cmpl %ebp, 0(%r13)
449 movl %ebp, 0(%r13)
450 cmovge %ebp, %r14d
451 .L99:
452 addq $16, %rsp
453 movl %r14d, %eax
454 popq %rbx
455 popq %rbp
456 popq %r12
457 popq %r13
458 popq %r14
460 .LFE83:
461 .size getgrouplist, .-getgrouplist
462 .p2align 4,,15
463 .globl initgroups
464 .type initgroups, @function
465 initgroups:
466 .LFB84:
467 pushq %r12
468 pushq %rbp
469 movl %esi, %ebp
470 pushq %rbx
471 movq %rdi, %rbx
472 movl $3, %edi
473 subq $32, %rsp
474 call __sysconf
475 testq %rax, %rax
476 movq %rax, %r12
477 jle .L107
478 cmpq $64, %rax
479 movl $64, %edi
480 cmovle %rax, %rdi
481 movq %rdi, 16(%rsp)
482 salq $2, %rdi
483 .L108:
484 call malloc@PLT
485 movq %rax, %rdx
486 movq %rax, 24(%rsp)
487 movl $-1, %eax
488 testq %rdx, %rdx
489 je .L106
490 leaq 24(%rsp), %rcx
491 leaq 16(%rsp), %rdx
492 movl %ebp, %esi
493 movq %rbx, %rdi
494 movq %r12, %r8
495 call internal_getgrouplist
496 movslq %eax, %rbp
497 movq %rbp, %rbx
498 jmp .L111
499 .p2align 4,,10
500 .p2align 3
501 .L116:
502 movq __libc_errno@gottpoff(%rip), %rdx
503 cmpl $22, %fs:(%rdx)
504 jne .L110
505 subl $1, %ebx
506 subq $1, %rbp
507 testl %ebx, %ebx
508 jle .L110
509 .L111:
510 movq 24(%rsp), %rsi
511 movq %rbp, %rdi
512 call setgroups
513 cmpl $-1, %eax
514 je .L116
515 .L110:
516 movq 24(%rsp), %rdi
517 movl %eax, 12(%rsp)
518 call free@PLT
519 movl 12(%rsp), %eax
520 .L106:
521 addq $32, %rsp
522 popq %rbx
523 popq %rbp
524 popq %r12
526 .p2align 4,,10
527 .p2align 3
528 .L107:
529 movq $16, 16(%rsp)
530 movl $64, %edi
531 jmp .L108
532 .LFE84:
533 .size initgroups, .-initgroups
534 .section .rodata.str1.16,"aMS",@progbits,1
535 .align 16
536 .type __PRETTY_FUNCTION__.13359, @object
537 .size __PRETTY_FUNCTION__.13359, 22
538 __PRETTY_FUNCTION__.13359:
539 .string "internal_getgrouplist"
540 .section .gnu.warning.initgroups
541 #,"a",@progbits
542 .align 32
543 .type __evoke_link_warning_initgroups, @object
544 .size __evoke_link_warning_initgroups, 134
545 __evoke_link_warning_initgroups:
546 .string "Using 'initgroups' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking"
547 .section .gnu.warning.getgrouplist
548 #,"a",@progbits
549 .align 32
550 .type __evoke_link_warning_getgrouplist, @object
551 .size __evoke_link_warning_getgrouplist, 136
552 __evoke_link_warning_getgrouplist:
553 .string "Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking"
554 .local use_initgroups_entry
555 .comm use_initgroups_entry,1,1
556 .hidden setgroups
557 .hidden __sysconf
558 .hidden __assert_fail
559 .hidden __libc_fatal
560 .hidden __nss_database_get
561 .hidden __libc_scratch_buffer_grow
562 .hidden strcmp
563 .hidden _dl_mcount_wrapper_check
564 .hidden __nss_lookup_function