summaryrefslogtreecommitdiff
path: root/rt
diff options
context:
space:
mode:
authorOri Bernstein <ori@markovcorp.com>2019-02-26 13:03:14 -0800
committerOri Bernstein <ori@markovcorp.com>2019-02-26 13:03:14 -0800
commit02201160614e5f25a7a73d86ed26a1f90fa4f5bb (patch)
treece958c6982673794612cf2ea91ab8b353bf4c243 /rt
parent16a7bb8f8cc86b22ce157e0944f66f60a556590f (diff)
downloadmc-02201160614e5f25a7a73d86ed26a1f90fa4f5bb.tar.gz
Add support for `__fini__` functions.
Diffstat (limited to 'rt')
-rw-r--r--rt/start-freebsd.s6
-rw-r--r--rt/start-linux.s4
-rw-r--r--rt/start-netbsd.s5
-rw-r--r--rt/start-openbsd.s5
-rw-r--r--rt/start-osx.s4
5 files changed, 14 insertions, 10 deletions
diff --git a/rt/start-freebsd.s b/rt/start-freebsd.s
index 399fac0..b995559 100644
--- a/rt/start-freebsd.s
+++ b/rt/start-freebsd.s
@@ -51,11 +51,11 @@ _start:
addq $0x10,%rsp
xorq %rbp,%rbp
- /* call pre-main initializers */
- call __init__
- /* enter the main program */
+ call __init__
call main
+ call __fini__
+
/* exit(0) */
xorq %rdi,%rdi
movq $1,%rax
diff --git a/rt/start-linux.s b/rt/start-linux.s
index a0cbfb6..e671fec 100644
--- a/rt/start-linux.s
+++ b/rt/start-linux.s
@@ -48,10 +48,10 @@ _start:
syscall
xorq %rbp,%rbp
- /* call pre-main initializers */
call __init__
- /* enter the main program */
call main
+ call __fini__
+
/* exit(0) */
xorq %rdi,%rdi
movq $60,%rax
diff --git a/rt/start-netbsd.s b/rt/start-netbsd.s
index 3a6cfc7..7765afe 100644
--- a/rt/start-netbsd.s
+++ b/rt/start-netbsd.s
@@ -60,10 +60,11 @@ _start:
addq $0x10,%rsp
xorq %rbp,%rbp
- /* call pre-main initializers */
+
call __init__
- /* enter the main program */
call main
+ call __fini__
+
/* exit(0) */
xorq %rdi,%rdi
movq $1,%rax
diff --git a/rt/start-openbsd.s b/rt/start-openbsd.s
index eef7b45..7c9c67a 100644
--- a/rt/start-openbsd.s
+++ b/rt/start-openbsd.s
@@ -61,10 +61,11 @@ _start:
to call kbind here, but this breaks
when we dynamically link in libc.
*/
- /* call pre-main initializers */
+
call __init__
- /* enter the main program */
call main
+ call __init__
+
/* exit(0) */
xorq %rdi,%rdi
movq $1,%rax
diff --git a/rt/start-osx.s b/rt/start-osx.s
index a1e1856..53820d4 100644
--- a/rt/start-osx.s
+++ b/rt/start-osx.s
@@ -48,9 +48,11 @@ start:
syscall
xorq %rbp,%rbp
+
call ___init__
- /* enter the main program */
call _main
+ call ___fini__
+
/* exit */
xorq %rdi,%rdi
movq $0x2000001,%rax