prt0.as 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. .file "crt1.c"
  2. .section .note.ABI-tag,"a",@progbits
  3. .p2align 2
  4. .type abitag, @object
  5. .size abitag, 28
  6. abitag:
  7. .long 10
  8. .long 4
  9. .long 1
  10. .string "DragonFly"
  11. .align 4
  12. .long 400000
  13. .section .rodata
  14. .LC0:
  15. .string ""
  16. .globl __progname
  17. .data
  18. .p2align 3
  19. .type __progname, @object
  20. .size __progname, 8
  21. __progname:
  22. .quad .LC0
  23. .text
  24. .p2align 2,,3
  25. .globl _start
  26. .type _start, @function
  27. _start:
  28. .LFB9:
  29. pushq %rbp
  30. .LCFI0:
  31. movq %rsp, %rbp
  32. .LCFI1:
  33. subq $48, %rsp
  34. .LCFI2:
  35. movq %rdi, -8(%rbp)
  36. movq %rsi, -16(%rbp)
  37. movq -8(%rbp), %rax
  38. movl (%rax), %eax
  39. movl %eax, -20(%rbp)
  40. movl %eax, operatingsystem_parameter_argc(%rip)
  41. movq -8(%rbp), %rax
  42. addq $8, %rax
  43. movq %rax, -32(%rbp)
  44. movq %rax, operatingsystem_parameter_argv(%rip)
  45. movl -20(%rbp), %eax
  46. cltq
  47. salq $3, %rax
  48. addq -8(%rbp), %rax
  49. addq $16, %rax
  50. movq %rax, -40(%rbp)
  51. movq %rax, operatingsystem_parameter_envp(%rip)
  52. movq -40(%rbp), %rax
  53. movq %rax, environ(%rip)
  54. cmpl $0, -20(%rbp)
  55. jle .L5
  56. movq -32(%rbp), %rax
  57. cmpq $0, (%rax)
  58. je .L5
  59. movq -32(%rbp), %rax
  60. movq (%rax), %rax
  61. movq %rax, __progname(%rip)
  62. movq __progname(%rip), %rax
  63. movq %rax, -48(%rbp)
  64. .L6:
  65. movq -48(%rbp), %rax
  66. cmpb $0, (%rax)
  67. jne .L9
  68. jmp .L5
  69. .L9:
  70. movq -48(%rbp), %rax
  71. cmpb $47, (%rax)
  72. jne .L8
  73. movq -48(%rbp), %rax
  74. incq %rax
  75. movq %rax, __progname(%rip)
  76. .L8:
  77. leaq -48(%rbp), %rax
  78. incq (%rax)
  79. jmp .L6
  80. .L5:
  81. # movl $_DYNAMIC, %eax
  82. # testq %rax, %rax
  83. # je .L11
  84. # movq -16(%rbp), %rdi
  85. # call atexit
  86. .L11:
  87. # movl $_fini, %edi
  88. # call atexit
  89. # call _init
  90. # movq -40(%rbp), %rdx #env
  91. # movq -32(%rbp), %rsi #argv
  92. # movl -20(%rbp), %edi # argc
  93. xorq %rbp,%rbp
  94. call main
  95. movl %eax, %edi
  96. # call exit
  97. .LFE9:
  98. .size _start, .-_start
  99. .bss
  100. .type __stkptr,@object
  101. .size __stkptr,8
  102. .global __stkptr
  103. __stkptr:
  104. .skip 8
  105. .type operatingsystem_parameters,@object
  106. .size operatingsystem_parameters,24
  107. operatingsystem_parameters:
  108. .skip 3*8
  109. .global operatingsystem_parameter_envp
  110. .global operatingsystem_parameter_argc
  111. .global operatingsystem_parameter_argv
  112. .set operatingsystem_parameter_envp,operatingsystem_parameters+0
  113. .set operatingsystem_parameter_argc,operatingsystem_parameters+8
  114. .set operatingsystem_parameter_argv,operatingsystem_parameters+16
  115. .comm environ,8,8
  116. .weak _DYNAMIC
  117. .section .eh_frame,"a",@progbits
  118. .Lframe1:
  119. .long .LECIE1-.LSCIE1
  120. .LSCIE1:
  121. .long 0x0
  122. .byte 0x1
  123. .string ""
  124. .uleb128 0x1
  125. .sleb128 -8
  126. .byte 0x10
  127. .byte 0xc
  128. .uleb128 0x7
  129. .uleb128 0x8
  130. .byte 0x90
  131. .uleb128 0x1
  132. .p2align 3
  133. .LECIE1:
  134. .LSFDE1:
  135. .long .LEFDE1-.LASFDE1
  136. .LASFDE1:
  137. .long .LASFDE1-.Lframe1
  138. .quad .LFB9
  139. .quad .LFE9-.LFB9
  140. .byte 0x4
  141. .long .LCFI0-.LFB9
  142. .byte 0xe
  143. .uleb128 0x10
  144. .byte 0x86
  145. .uleb128 0x2
  146. .byte 0x4
  147. .long .LCFI1-.LCFI0
  148. .byte 0xd
  149. .uleb128 0x6
  150. .p2align 3
  151. .LEFDE1:
  152. .ident "[DragonFly]"