1
0
mirror of https://github.com/golang/go synced 2024-11-26 16:36:49 -07:00

implement spec: when main.main returns, the program exits

R=r
DELTA=9  (7 added, 2 deleted, 0 changed)
OCL=15628
CL=15643
This commit is contained in:
Russ Cox 2008-09-22 13:47:59 -07:00
parent fb40f88c40
commit ebd1eef41e

View File

@ -37,13 +37,14 @@ TEXT _rt0_amd64(SB),7,$-8
CALL schedinit(SB)
// create a new goroutine to start program
PUSHQ $mainstart(SB) // entry
PUSHQ $16 // arg size
CALL sys·newproc(SB)
POPQ AX
POPQ AX
// start this M
CALL mstart(SB)
POPQ AX
POPQ AX
CALL notok(SB) // never returns
RET
@ -52,6 +53,10 @@ TEXT mainstart(SB),7,$0
CALL main·init_function(SB)
CALL initdone(SB)
CALL main·main(SB)
PUSHQ $0
CALL sys·exit(SB)
POPQ AX
CALL notok(SB)
RET
TEXT sys·breakpoint(SB),7,$0