mirror of
https://github.com/golang/go
synced 2024-11-20 00:44:45 -07:00
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
This commit is contained in:
parent
f833a8d392
commit
a4f8d36ba5
@ -9,10 +9,16 @@ TEXT _rt0_amd64(SB),7,$-8
|
|||||||
MOVQ 0(DI), AX // argc
|
MOVQ 0(DI), AX // argc
|
||||||
LEAQ 8(DI), BX // argv
|
LEAQ 8(DI), BX // argv
|
||||||
SUBQ $(4*8+7), SP // 2args 2auto
|
SUBQ $(4*8+7), SP // 2args 2auto
|
||||||
ANDQ $~7, SP
|
ANDQ $~15, SP
|
||||||
MOVQ AX, 16(SP)
|
MOVQ AX, 16(SP)
|
||||||
MOVQ BX, 24(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
|
// set the per-goroutine and per-mach registers
|
||||||
LEAQ m0(SB), m
|
LEAQ m0(SB), m
|
||||||
LEAQ g0(SB), g
|
LEAQ g0(SB), g
|
||||||
@ -372,4 +378,5 @@ TEXT getcallersp(SB),7,$0
|
|||||||
MOVQ sp+0(FP), AX
|
MOVQ sp+0(FP), AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
|
GLOBL initcgo(SB), $8
|
||||||
GLOBL libcgo_set_scheduler(SB), $8
|
GLOBL libcgo_set_scheduler(SB), $8
|
||||||
|
@ -5,13 +5,6 @@
|
|||||||
// Darwin and Linux use the same linkage to main
|
// Darwin and Linux use the same linkage to main
|
||||||
|
|
||||||
TEXT _rt0_amd64_linux(SB),7,$-8
|
TEXT _rt0_amd64_linux(SB),7,$-8
|
||||||
MOVQ initcgo(SB), AX
|
|
||||||
TESTQ AX, AX
|
|
||||||
JZ 2(PC)
|
|
||||||
CALL AX
|
|
||||||
|
|
||||||
MOVQ $_rt0_amd64(SB), AX
|
MOVQ $_rt0_amd64(SB), AX
|
||||||
MOVQ SP, DI
|
MOVQ SP, DI
|
||||||
JMP AX
|
JMP AX
|
||||||
|
|
||||||
GLOBL initcgo(SB), $8
|
|
||||||
|
Loading…
Reference in New Issue
Block a user