summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKen Thompson <ken@golang.org>2008-07-19 14:20:46 -0700
committerKen Thompson <ken@golang.org>2008-07-19 14:20:46 -0700
commit616e0e3809f98c5dcda1fb02f57dbae7c7579846 (patch)
tree85ba26ad6fb9262e899de2231e556c1129fac917 /src
parent7dd0885cb35bf091ed7e88ba3e6cd88d5567b5b2 (diff)
downloadgolang-616e0e3809f98c5dcda1fb02f57dbae7c7579846.tar.gz
init filename vs pkgname
SVN=128117
Diffstat (limited to 'src')
-rw-r--r--src/cmd/gc/dcl.c10
-rw-r--r--src/runtime/rt0_amd64.s2
2 files changed, 7 insertions, 5 deletions
diff --git a/src/cmd/gc/dcl.c b/src/cmd/gc/dcl.c
index 601acf5e7..1c9f23309 100644
--- a/src/cmd/gc/dcl.c
+++ b/src/cmd/gc/dcl.c
@@ -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);
diff --git a/src/runtime/rt0_amd64.s b/src/runtime/rt0_amd64.s
index 5544833e4..20761464f 100644
--- a/src/runtime/rt0_amd64.s
+++ b/src/runtime/rt0_amd64.s
@@ -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