aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/rt0_linux_amd64.s
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2013-03-06 15:03:04 -0500
committerRuss Cox <rsc@golang.org>2013-03-06 15:03:04 -0500
commit36b414f6397cadffab1a945eed645a3213f39d8a (patch)
tree2a92db3349a329b963f4b776bf9e82dc77bcea98 /src/pkg/runtime/rt0_linux_amd64.s
parentcf8434fa3119d14abbc7f1ecec61f0cc947dfac4 (diff)
downloadgo-36b414f6397cadffab1a945eed645a3213f39d8a.tar.xz
runtime: change amd64 startup convention
Now the default startup is that the program begins at _rt0_amd64_$GOOS, which sets DI = argc, SI = argv and jumps to _rt0_amd64. This makes the _rt0_amd64 entry match the expected semantics for the standard C "main" function, which we can now provide for use when linking against a standard C library. R=golang-dev, devon.odell, minux.ma CC=golang-dev https://golang.org/cl/7525043
Diffstat (limited to 'src/pkg/runtime/rt0_linux_amd64.s')
-rw-r--r--src/pkg/runtime/rt0_linux_amd64.s9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pkg/runtime/rt0_linux_amd64.s b/src/pkg/runtime/rt0_linux_amd64.s
index dac9ae181b..dfc9c0421b 100644
--- a/src/pkg/runtime/rt0_linux_amd64.s
+++ b/src/pkg/runtime/rt0_linux_amd64.s
@@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Darwin and Linux use the same linkage to main
-
TEXT _rt0_amd64_linux(SB),7,$-8
+ LEAQ 8(SP), SI // argv
+ MOVQ 0(SP), DI // argc
+ MOVQ $main(SB), AX
+ JMP AX
+
+TEXT main(SB),7,$-8
MOVQ $_rt0_amd64(SB), AX
- MOVQ SP, DI
JMP AX