commit f492138612f18127dc3845b7bcf077a55a6f876c
parent 715a99ee9949a9472cdf9e3d8fb79e3cfa1c230f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 23 Dec 2018 07:50:58 +0000
[libcrt] Add crt files for darwin
Diffstat:
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/src/libcrt/crt-amd64-darwin.s b/src/libcrt/crt-amd64-darwin.s
@@ -0,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
diff --git a/src/libcrt/crt-darwin.s b/src/libcrt/crt-darwin.s
@@ -0,0 +1 @@
+ .file "crt-darwin.s"