summaryrefslogtreecommitdiff
path: root/src/runtime/asm_amd64.s
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2017-10-09 11:31:20 -0700
committerIan Lance Taylor <iant@golang.org>2017-10-11 20:07:31 +0000
commitcf3f771203c46d73a84d86e5ef7865d19e983150 (patch)
tree2c430aa36b095ac9b8c149cdeb45ca878c9df03f /src/runtime/asm_amd64.s
parente29efbcbcbcd7dde56ac0b4880ff8c13fdb6a89d (diff)
downloadgo-git-cf3f771203c46d73a84d86e5ef7865d19e983150.tar.gz
runtime: unify amd64 -buildmode=exe entry point code
All of the amd64 entry point code is the same except for Plan 9. Unify it all into asm_amd64.s. Change-Id: Id47ce3a7bb2bb0fd48f326a2d88ed18b17dee456 Reviewed-on: https://go-review.googlesource.com/69292 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/asm_amd64.s')
-rw-r--r--src/runtime/asm_amd64.s15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s
index d87f454e03..838a1681da 100644
--- a/src/runtime/asm_amd64.s
+++ b/src/runtime/asm_amd64.s
@@ -7,6 +7,21 @@
#include "funcdata.h"
#include "textflag.h"
+// _rt0_amd64 is common startup code for most amd64 systems when using
+// internal linking. This is the entry point for the program from the
+// kernel for an ordinary -buildmode=exe program. The stack holds the
+// number of arguments and the C-style argv.
+TEXT _rt0_amd64(SB),NOSPLIT,$-8
+ MOVQ 0(SP), DI // argc
+ LEAQ 8(SP), SI // argv
+ JMP runtime·rt0_go(SB)
+
+// main is common startup code for most amd64 systems when using
+// external linking. The C startup code will call the symbol "main"
+// passing argc and argv in the usual C ABI registers DI and SI.
+TEXT main(SB),NOSPLIT,$-8
+ JMP runtime·rt0_go(SB)
+
TEXT runtime·rt0_go(SB),NOSPLIT,$0
// copy arguments forward on an even stack
MOVQ DI, AX // argc