diff options
| author | Ian Lance Taylor <iant@golang.org> | 2010-04-09 14:15:15 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2010-04-09 14:15:15 -0700 |
| commit | a4f8d36ba5f69e03073fa9f3bf79c04d4234fc85 (patch) | |
| tree | 969c98763059cf3553455bd6a7037b5213f2897b /src/pkg/runtime/amd64 | |
| parent | f833a8d39269e4df1e843842fd855e8c019927a8 (diff) | |
| download | go-a4f8d36ba5f69e03073fa9f3bf79c04d4234fc85.tar.xz | |
Run initcgo for all amd64 targets, not just GNU/Linux.
This is required to make cgo export work on Darwin. Note that
this corrects the stack alignment when calling initcgo to that
required by gcc on amd64.
R=rsc
CC=golang-dev
https://golang.org/cl/907041
Diffstat (limited to 'src/pkg/runtime/amd64')
| -rw-r--r-- | src/pkg/runtime/amd64/asm.s | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pkg/runtime/amd64/asm.s b/src/pkg/runtime/amd64/asm.s index 627af66320..52b0a89bcb 100644 --- a/src/pkg/runtime/amd64/asm.s +++ b/src/pkg/runtime/amd64/asm.s @@ -9,10 +9,16 @@ TEXT _rt0_amd64(SB),7,$-8 MOVQ 0(DI), AX // argc LEAQ 8(DI), BX // argv SUBQ $(4*8+7), SP // 2args 2auto - ANDQ $~7, SP + ANDQ $~15, SP MOVQ AX, 16(SP) MOVQ BX, 24(SP) + // if there is an initcgo, call it. + MOVQ initcgo(SB), AX + TESTQ AX, AX + JZ 2(PC) + CALL AX + // set the per-goroutine and per-mach registers LEAQ m0(SB), m LEAQ g0(SB), g @@ -372,4 +378,5 @@ TEXT getcallersp(SB),7,$0 MOVQ sp+0(FP), AX RET +GLOBL initcgo(SB), $8 GLOBL libcgo_set_scheduler(SB), $8 |
