diff options
author | Russ Cox <rsc@golang.org> | 2010-01-22 17:06:20 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-01-22 17:06:20 -0800 |
commit | a5b02d4bb66ff7269bdaca033382498c2a64eee9 (patch) | |
tree | c53ac65c567f463be044834b10f08f7f77dd405e /src/cmd/gc/init.c | |
parent | ca3ec49f2cbf333bb7acb104778ec18693cf7038 (diff) | |
download | golang-a5b02d4bb66ff7269bdaca033382498c2a64eee9.tar.gz |
eliminate the package global name space assumption in object files
5g/6g/8g: add import statements to export metadata, mapping package path to package name.
recognize "" as the path of the package in export metadata.
use "" as the path of the package in object symbol names.
5c/6c/8c, 5a/6a/8a: rewrite leading . to "". so that ·Sin means Sin in this package.
5l/6l/8l: rewrite "" in symbol names as object files are read.
gotest: handle new symbol names.
gopack: handle new import lines in export metadata.
Collectively, these changes eliminate the assumption of a global
name space in the object file formats. Higher level pieces such as
reflect and the computation of type hashes still depend on the
assumption; we're not done yet.
R=ken2, r, ken3
CC=golang-dev
http://codereview.appspot.com/186263
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/gc/init.c')
-rw-r--r-- | src/cmd/gc/init.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/gc/init.c b/src/cmd/gc/init.c index ef97459eb..3c2ecf27f 100644 --- a/src/cmd/gc/init.c +++ b/src/cmd/gc/init.c @@ -70,7 +70,7 @@ anyinit(NodeList *n) } // is this main - if(strcmp(package, "main") == 0) + if(strcmp(localpkg->name, "main") == 0) return 1; // is there an explicit init function @@ -103,7 +103,7 @@ fninit(NodeList *n) uint32 h; Sym *s, *initsym; - if(strcmp(package, "PACKAGE") == 0) { + if(debug['A']) { // sys.go or unsafe.go during compiler build return; } @@ -126,7 +126,7 @@ fninit(NodeList *n) // 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(localpkg->name, "main") == 0) snprint(namebuf, sizeof(namebuf), "init"); fn = nod(ODCLFUNC, N, N); |