diff options
| author | Ian Lance Taylor <iant@golang.org> | 2017-10-10 15:11:05 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2017-10-11 21:12:51 +0000 |
| commit | 30cb30e596759279b487b835440269989bd08b04 (patch) | |
| tree | 0b314f5e15529e197cd18f8172e014631550b31b /src/runtime/rt0_linux_amd64.s | |
| parent | c15c44ec48fa278330b5d205cf7b4508250496fe (diff) | |
| download | go-30cb30e596759279b487b835440269989bd08b04.tar.xz | |
runtime: unify amd64 -buildmode=c-archive/c-shared entry point code
This adds the _lib entry point to various GOOS_amd64.s files.
A future CL will enable c-archive/c-shared mode for those targets.
As far as I can tell, the newosproc0 function in os_darwin.go was
passing the wrong arguments to bsdthread_create. The newosproc0
function is never called in the current testsuite.
Change-Id: Ie7c1c2e326cec87013e0fea84f751091b0ea7f51
Reviewed-on: https://go-review.googlesource.com/69711
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/rt0_linux_amd64.s')
| -rw-r--r-- | src/runtime/rt0_linux_amd64.s | 60 |
1 files changed, 2 insertions, 58 deletions
diff --git a/src/runtime/rt0_linux_amd64.s b/src/runtime/rt0_linux_amd64.s index 4faa1f24d3..94ff7094d6 100644 --- a/src/runtime/rt0_linux_amd64.s +++ b/src/runtime/rt0_linux_amd64.s @@ -7,61 +7,5 @@ TEXT _rt0_amd64_linux(SB),NOSPLIT,$-8 JMP _rt0_amd64(SB) -// When building with -buildmode=c-shared, this symbol is called when the shared -// library is loaded. -// Note: This function calls external C code, which might required 16-byte stack -// alignment after cmd/internal/obj applies its transformations. -TEXT _rt0_amd64_linux_lib(SB),NOSPLIT,$0x50 - MOVQ SP, AX - ANDQ $-16, SP - MOVQ BX, 0x10(SP) - MOVQ BP, 0x18(SP) - MOVQ R12, 0x20(SP) - MOVQ R13, 0x28(SP) - MOVQ R14, 0x30(SP) - MOVQ R15, 0x38(SP) - MOVQ AX, 0x40(SP) - - MOVQ DI, _rt0_amd64_linux_lib_argc<>(SB) - MOVQ SI, _rt0_amd64_linux_lib_argv<>(SB) - - // Synchronous initialization. - MOVQ $runtime·libpreinit(SB), AX - CALL AX - - // Create a new thread to do the runtime initialization and return. - MOVQ _cgo_sys_thread_create(SB), AX - TESTQ AX, AX - JZ nocgo - MOVQ $_rt0_amd64_linux_lib_go(SB), DI - MOVQ $0, SI - CALL AX - JMP restore - -nocgo: - MOVQ $8388608, 0(SP) // stacksize - MOVQ $_rt0_amd64_linux_lib_go(SB), AX - MOVQ AX, 8(SP) // fn - MOVQ $runtime·newosproc0(SB), AX - CALL AX - -restore: - MOVQ 0x10(SP), BX - MOVQ 0x18(SP), BP - MOVQ 0x20(SP), R12 - MOVQ 0x28(SP), R13 - MOVQ 0x30(SP), R14 - MOVQ 0x38(SP), R15 - MOVQ 0x40(SP), SP - RET - -TEXT _rt0_amd64_linux_lib_go(SB),NOSPLIT,$0 - MOVQ _rt0_amd64_linux_lib_argc<>(SB), DI - MOVQ _rt0_amd64_linux_lib_argv<>(SB), SI - MOVQ $runtime·rt0_go(SB), AX - JMP AX - -DATA _rt0_amd64_linux_lib_argc<>(SB)/8, $0 -GLOBL _rt0_amd64_linux_lib_argc<>(SB),NOPTR, $8 -DATA _rt0_amd64_linux_lib_argv<>(SB)/8, $0 -GLOBL _rt0_amd64_linux_lib_argv<>(SB),NOPTR, $8 +TEXT _rt0_amd64_linux_lib(SB),NOSPLIT,$0 + JMP _rt0_amd64_lib(SB) |
