mirror of
https://github.com/golang/go
synced 2024-11-26 17:56:55 -07:00
init filename vs pkgname
SVN=128117
This commit is contained in:
parent
fb3af53f4e
commit
90da636c15
@ -914,11 +914,13 @@ fninit(Node *n)
|
|||||||
maxarg = 0;
|
maxarg = 0;
|
||||||
stksize = 0;
|
stksize = 0;
|
||||||
|
|
||||||
vargen++;
|
snprint(namebuf, sizeof(namebuf), "init_%s_function", filename);
|
||||||
h = vargen;
|
|
||||||
|
// this is a botch since we need a known name to
|
||||||
|
// call the top level init function out of rt0
|
||||||
if(strcmp(package, "main") == 0)
|
if(strcmp(package, "main") == 0)
|
||||||
h = 999;
|
snprint(namebuf, sizeof(namebuf), "init_function");
|
||||||
snprint(namebuf, sizeof(namebuf), "init_%.3ld_function", h);
|
|
||||||
b = nod(ODCLFUNC, N, N);
|
b = nod(ODCLFUNC, N, N);
|
||||||
b->nname = newname(lookup(namebuf));
|
b->nname = newname(lookup(namebuf));
|
||||||
b->type = functype(N, N, N);
|
b->type = functype(N, N, N);
|
||||||
|
@ -33,7 +33,7 @@ TEXT _rt0_amd64(SB),7,$-8
|
|||||||
MOVQ 24(SP), AX // copy argv
|
MOVQ 24(SP), AX // copy argv
|
||||||
MOVQ AX, 8(SP)
|
MOVQ AX, 8(SP)
|
||||||
CALL args(SB)
|
CALL args(SB)
|
||||||
CALL main·init_999_function(SB) // initialization
|
CALL main·init_function(SB) // initialization
|
||||||
|
|
||||||
// create a new goroutine to start program
|
// create a new goroutine to start program
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user