crt0.s 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. .file "crt0.c"
  2. .globl __progname
  3. .section .rodata
  4. .LC0:
  5. .string ""
  6. .section .data.rel.local,"aw",@progbits
  7. .align 8
  8. .type __progname, @object
  9. .size __progname, 8
  10. __progname:
  11. .quad .LC0
  12. #APP
  13. .text ; .align 8 ; .globl __start ; .globl _start ;_start: ;__start: ; movq %rbx,%r9 ; movq %rcx,%r8 ; movq %rdx,%rcx ; movq (%rsp),%rdi ; leaq 16(%rsp,%rdi,8),%rdx ; leaq 8(%rsp),%rsi ; subq $8,%rsp ; andq $~15,%rsp ; addq $8,%rsp ; jmp ___start ;
  14. #NO_APP
  15. .text
  16. .globl ___start
  17. .type ___start, @function
  18. ___start:
  19. .LFB9:
  20. pushq %rbp
  21. .LCFI0:
  22. movq %rsp, %rbp
  23. .LCFI1:
  24. subq $64, %rsp
  25. .LCFI2:
  26. movl %edi, -20(%rbp)
  27. movq %rsi, -32(%rbp)
  28. movq %rdx, -40(%rbp)
  29. movq %rcx, -48(%rbp)
  30. movq %r8, -56(%rbp)
  31. movq %r9, -64(%rbp)
  32. movq environ@GOTPCREL(%rip), %rdx
  33. movq -40(%rbp), %rax
  34. movq %rax, (%rdx)
  35. movq operatingsystem_parameter_envp@GOTPCREL(%rip), %rdx
  36. movq -40(%rbp), %rax
  37. movq %rax, (%rdx)
  38. movl -20(%rbp), %eax
  39. movslq %eax,%rdx
  40. movq operatingsystem_parameter_argc@GOTPCREL(%rip), %rax
  41. movq %rdx, (%rax)
  42. movq operatingsystem_parameter_argv@GOTPCREL(%rip), %rdx
  43. movq -32(%rbp), %rax
  44. movq %rax, (%rdx)
  45. movq -32(%rbp), %rax
  46. movq (%rax), %rax
  47. movq %rax, -8(%rbp)
  48. cmpq $0, -8(%rbp)
  49. je .L2
  50. movq -8(%rbp), %rdi
  51. movl $47, %esi
  52. call _strrchr
  53. movq %rax, %rdx
  54. movq __progname@GOTPCREL(%rip), %rax
  55. movq %rdx, (%rax)
  56. movq __progname@GOTPCREL(%rip), %rax
  57. movq (%rax), %rax
  58. testq %rax, %rax
  59. jne .L4
  60. movq __progname@GOTPCREL(%rip), %rdx
  61. movq -8(%rbp), %rax
  62. movq %rax, (%rdx)
  63. jmp .L6
  64. .L4:
  65. movq __progname@GOTPCREL(%rip), %rax
  66. movq (%rax), %rax
  67. leaq 1(%rax), %rdx
  68. movq __progname@GOTPCREL(%rip), %rax
  69. movq %rdx, (%rax)
  70. .L6:
  71. movq __progname_storage@GOTPCREL(%rip), %rax
  72. movq %rax, -16(%rbp)
  73. jmp .L7
  74. .L8:
  75. movq __progname@GOTPCREL(%rip), %rax
  76. movq (%rax), %rcx
  77. movzbl (%rcx), %edx
  78. movq -16(%rbp), %rax
  79. movb %dl, (%rax)
  80. addq $1, -16(%rbp)
  81. leaq 1(%rcx), %rdx
  82. movq __progname@GOTPCREL(%rip), %rax
  83. movq %rdx, (%rax)
  84. .L7:
  85. movq __progname@GOTPCREL(%rip), %rax
  86. movq (%rax), %rax
  87. movzbl (%rax), %eax
  88. testb %al, %al
  89. je .L9
  90. movq __progname_storage@GOTPCREL(%rip), %rax
  91. leaq 255(%rax), %rax
  92. cmpq %rax, -16(%rbp)
  93. jb .L8
  94. .L9:
  95. movq -16(%rbp), %rax
  96. movb $0, (%rax)
  97. movq __progname@GOTPCREL(%rip), %rdx
  98. movq __progname_storage@GOTPCREL(%rip), %rax
  99. movq %rax, (%rdx)
  100. .L2:
  101. movl $0, %eax
  102. call __init@PLT
  103. movq environ@GOTPCREL(%rip), %rax
  104. movq (%rax), %rdx
  105. movq -32(%rbp), %rsi
  106. movl -20(%rbp), %edi
  107. movl $0, %eax
  108. call main@PLT
  109. movl %eax, %edi
  110. call exit@PLT
  111. .LFE9:
  112. .size ___start, .-___start
  113. .type _strrchr, @function
  114. _strrchr:
  115. .LFB10:
  116. pushq %rbp
  117. .LCFI3:
  118. movq %rsp, %rbp
  119. .LCFI4:
  120. movq %rdi, -24(%rbp)
  121. movb %sil, -25(%rbp)
  122. movq $0, -8(%rbp)
  123. .L13:
  124. movq -24(%rbp), %rdx
  125. movzbl (%rdx), %eax
  126. cmpb -25(%rbp), %al
  127. jne .L14
  128. movq -24(%rbp), %rax
  129. movq %rax, -8(%rbp)
  130. .L14:
  131. movq -24(%rbp), %rdx
  132. movzbl (%rdx), %eax
  133. testb %al, %al
  134. jne .L16
  135. movq -8(%rbp), %rax
  136. movq %rax, -16(%rbp)
  137. jmp .L12
  138. .L16:
  139. addq $1, -24(%rbp)
  140. jmp .L13
  141. .L12:
  142. movq -16(%rbp), %rax
  143. leave
  144. ret
  145. .LFE10:
  146. .size _strrchr, .-_strrchr
  147. .comm environ,8,8
  148. .comm operatingsystem_parameter_envp,8,8
  149. .comm operatingsystem_parameter_argc,8,8
  150. .comm operatingsystem_parameter_argv,8,8
  151. .comm __progname_storage,256,32
  152. .section .eh_frame,"a",@progbits
  153. .Lframe1:
  154. .long .LECIE1-.LSCIE1
  155. .LSCIE1:
  156. .long 0x0
  157. .byte 0x1
  158. .string "zR"
  159. .uleb128 0x1
  160. .sleb128 -8
  161. .byte 0x10
  162. .uleb128 0x1
  163. .byte 0x1b
  164. .byte 0xc
  165. .uleb128 0x7
  166. .uleb128 0x8
  167. .byte 0x90
  168. .uleb128 0x1
  169. .align 8
  170. .LECIE1:
  171. .LSFDE1:
  172. .long .LEFDE1-.LASFDE1
  173. .LASFDE1:
  174. .long .LASFDE1-.Lframe1
  175. .long .LFB9-.
  176. .long .LFE9-.LFB9
  177. .uleb128 0x0
  178. .byte 0x4
  179. .long .LCFI0-.LFB9
  180. .byte 0xe
  181. .uleb128 0x10
  182. .byte 0x86
  183. .uleb128 0x2
  184. .byte 0x4
  185. .long .LCFI1-.LCFI0
  186. .byte 0xd
  187. .uleb128 0x6
  188. .align 8
  189. .LEFDE1:
  190. .LSFDE3:
  191. .long .LEFDE3-.LASFDE3
  192. .LASFDE3:
  193. .long .LASFDE3-.Lframe1
  194. .long .LFB10-.
  195. .long .LFE10-.LFB10
  196. .uleb128 0x0
  197. .byte 0x4
  198. .long .LCFI3-.LFB10
  199. .byte 0xe
  200. .uleb128 0x10
  201. .byte 0x86
  202. .uleb128 0x2
  203. .byte 0x4
  204. .long .LCFI4-.LCFI3
  205. .byte 0xd
  206. .uleb128 0x6
  207. .align 8
  208. .LEFDE3:
  209. .ident "GCC: (GNU) 4.2.1 20070719 "