diff options
author | Ian Lance Taylor <iant@golang.org> | 2017-10-12 19:46:42 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2017-10-17 04:03:16 +0000 |
commit | 378de1ae43c6406ae5159f235f834da73403a541 (patch) | |
tree | eec430c0572070482cb70e678fd48d54a77fe3c6 /src/runtime/rt0_windows_386.s | |
parent | 151c66b59fb657c90d2cad4c72b2059319806a9c (diff) | |
download | go-378de1ae43c6406ae5159f235f834da73403a541.tar.gz go-378de1ae43c6406ae5159f235f834da73403a541.zip |
runtime: unify 386 entry point code
Unify the 386 entry point code as much as possible.
The main function could not be unified because on Windows 386 it is
called _main. Putting main in asm_386.s caused multiple definition
errors when using the external linker.
Add the _lib entry point to various operating systems. A future CL
will enable c-archive/c-shared mode for those targets.
Fix _rt0_386_windows_lib_go--it was passing arguments as though it
were amd64.
Change-Id: Ic73f1c95cdbcbea87f633f4a29bbc218a5db4f58
Reviewed-on: https://go-review.googlesource.com/70530
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/rt0_windows_386.s')
-rw-r--r-- | src/runtime/rt0_windows_386.s | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/runtime/rt0_windows_386.s b/src/runtime/rt0_windows_386.s index b9407a9879..fa39edd787 100644 --- a/src/runtime/rt0_windows_386.s +++ b/src/runtime/rt0_windows_386.s @@ -4,13 +4,8 @@ #include "textflag.h" -TEXT _rt0_386_windows(SB),NOSPLIT,$12 - MOVL 12(SP), AX - LEAL 16(SP), BX - MOVL AX, 4(SP) - MOVL BX, 8(SP) - MOVL $-1, 0(SP) // return PC for main - JMP _main(SB) +TEXT _rt0_386_windows(SB),NOSPLIT,$0 + JMP _rt0_386(SB) // When building with -buildmode=(c-shared or c-archive), this // symbol is called. For dynamic libraries it is called when the @@ -41,10 +36,12 @@ TEXT _rt0_386_windows_lib(SB),NOSPLIT,$0x1C RET TEXT _rt0_386_windows_lib_go(SB),NOSPLIT,$0 - MOVL $0, DI - MOVL $0, SI - MOVL $runtime·rt0_go(SB), AX - JMP AX + PUSHL $0 + PUSHL $0 + JMP runtime·rt0_go(SB) TEXT _main(SB),NOSPLIT,$0 + // Remove the return address from the stack. + // rt0_go doesn't expect it to be there. + ADDL $4, SP JMP runtime·rt0_go(SB) |