mirror of
https://github.com/golang/go
synced 2024-11-18 16:04:44 -07:00
runtime: add -buildmode=c-archive/c-shared support for linux/386
Change-Id: I87147ca6bb53e3121cc4245449c519509f107638 Reviewed-on: https://go-review.googlesource.com/9009 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
17228f44b2
commit
9c1868d06d
2
src/cmd/dist/test.go
vendored
2
src/cmd/dist/test.go
vendored
@ -378,7 +378,7 @@ func (t *tester) buildmode(mode string) bool {
|
||||
case t.goos == "darwin" && t.goarch == "amd64":
|
||||
// TODO(crawshaw): add darwin/arm{,64}
|
||||
return true
|
||||
case t.goos == "linux" && t.goarch == "amd64":
|
||||
case t.goos == "linux" && (t.goarch == "amd64" || t.goarch == "386"):
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
|
@ -12,6 +12,47 @@ TEXT _rt0_386_linux(SB),NOSPLIT,$8
|
||||
CALL main(SB)
|
||||
INT $3
|
||||
|
||||
// When building with -buildmode=c-shared, this symbol is called when the shared
|
||||
// library is loaded.
|
||||
TEXT _rt0_386_linux_lib(SB),NOSPLIT,$12
|
||||
MOVL 16(SP), AX
|
||||
MOVL AX, _rt0_386_linux_lib_argc<>(SB)
|
||||
MOVL 20(SP), AX
|
||||
MOVL AX, _rt0_386_linux_lib_argv<>(SB)
|
||||
|
||||
// Create a new thread to do the runtime initialization.
|
||||
MOVL _cgo_sys_thread_create(SB), AX
|
||||
TESTL AX, AX
|
||||
JZ nocgo
|
||||
MOVL $_rt0_386_linux_lib_go(SB), BX
|
||||
MOVL BX, 0(SP)
|
||||
MOVL $0, 4(SP)
|
||||
CALL AX
|
||||
RET
|
||||
|
||||
nocgo:
|
||||
MOVL $0x800000, 0(SP) // stacksize = 8192KB
|
||||
MOVL $_rt0_386_linux_lib_go(SB), AX
|
||||
MOVL AX, 4(SP) // fn
|
||||
MOVL $0, 8(SP) // fnarg
|
||||
MOVL $runtime·newosproc0(SB), AX
|
||||
CALL AX
|
||||
RET
|
||||
|
||||
TEXT _rt0_386_linux_lib_go(SB),NOSPLIT,$12
|
||||
MOVL _rt0_386_linux_lib_argc<>(SB), AX
|
||||
MOVL AX, 0(SP)
|
||||
MOVL _rt0_386_linux_lib_argv<>(SB), AX
|
||||
MOVL AX, 4(SP)
|
||||
MOVL $runtime·rt0_go(SB), AX
|
||||
CALL AX
|
||||
RET
|
||||
|
||||
DATA _rt0_386_linux_lib_argc<>(SB)/4, $0
|
||||
GLOBL _rt0_386_linux_lib_argc<>(SB),NOPTR, $4
|
||||
DATA _rt0_386_linux_lib_argv<>(SB)/4, $0
|
||||
GLOBL _rt0_386_linux_lib_argv<>(SB),NOPTR, $4
|
||||
|
||||
TEXT main(SB),NOSPLIT,$0
|
||||
JMP runtime·rt0_go(SB)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user