Commit 90da636c authored by Ken Thompson's avatar Ken Thompson

init filename vs pkgname

SVN=128117
parent fb3af53f
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment