mirror of
https://github.com/golang/go
synced 2024-11-22 21:20:03 -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;
|
||||
stksize = 0;
|
||||
|
||||
vargen++;
|
||||
h = vargen;
|
||||
snprint(namebuf, sizeof(namebuf), "init_%s_function", filename);
|
||||
|
||||
// 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)
|
||||
h = 999;
|
||||
snprint(namebuf, sizeof(namebuf), "init_%.3ld_function", h);
|
||||
snprint(namebuf, sizeof(namebuf), "init_function");
|
||||
|
||||
b = nod(ODCLFUNC, N, N);
|
||||
b->nname = newname(lookup(namebuf));
|
||||
b->type = functype(N, N, N);
|
||||
|
@ -33,7 +33,7 @@ TEXT _rt0_amd64(SB),7,$-8
|
||||
MOVQ 24(SP), AX // copy argv
|
||||
MOVQ AX, 8(SP)
|
||||
CALL args(SB)
|
||||
CALL main·init_999_function(SB) // initialization
|
||||
CALL main·init_function(SB) // initialization
|
||||
|
||||
// create a new goroutine to start program
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user