ref: 547837256d36eb84c1be8eccfdc6dd2353d49f3d
parent: 067ad8f10c4ad0c03cd2a564faa909408ee86738
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Dec 23 02:50:58 EST 2018
[libcrt] Add crt files for darwin
--- /dev/null
+++ b/src/libcrt/crt-amd64-darwin.s
@@ -1,0 +1,19 @@
+ .bss
+ .globl __environ
+__environ:
+ .quad 0
+
+ .text
+ .global start
+start:
+ movq %rsp,%rbp
+
+ /* load argc, argv, envp from stack */
+ movq (%rbp),%rdi /* argc */
+ leaq 8(%rbp),%rsi /* argv */
+ leaq 16(%rbp,%rdi,8),%rdx /* envp = argv + 8*argc + 8 */
+ movq %rdx,__environ(%rip)
+
+ call _main
+ movl %eax,%edi
+ jmp _exit
--- /dev/null
+++ b/src/libcrt/crt-darwin.s
@@ -1,0 +1,1 @@
+ .file "crt-darwin.s"