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/cc | |
| 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/cc')
| -rw-r--r-- | src/cmd/cc/lex.c | 9 | ||||
| -rw-r--r-- | src/cmd/cc/lexbody | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/cmd/cc/lex.c b/src/cmd/cc/lex.c index 5a5651852..857b15206 100644 --- a/src/cmd/cc/lex.c +++ b/src/cmd/cc/lex.c @@ -405,6 +405,13 @@ lookup(void) int c, n; char *r, *w; + if(symb[0] == 0xc2 && symb[1] == 0xb7) { + // turn leading · into ""· + memmove(symb+2, symb, w-symb); + symb[0] = '"'; + symb[1] = '"'; + } + // turn · into . for(r=w=symb; *r; r++) { if((uchar)*r == 0xc2 && (uchar)*(r+1) == 0xb7) { @@ -413,7 +420,7 @@ lookup(void) }else *w++ = *r; } - *w = '\0'; + *w++ = '\0'; h = 0; for(p=symb; *p;) { diff --git a/src/cmd/cc/lexbody b/src/cmd/cc/lexbody index c3b2d4529..7c726b3f5 100644 --- a/src/cmd/cc/lexbody +++ b/src/cmd/cc/lexbody @@ -231,7 +231,13 @@ lookup(void) }else *w++ = *r; } - *w = '\0'; + *w++ = '\0'; + if(symb[0] == '.') { + // turn leading . into "". + memmove(symb+2, symb, w-symb); + symb[0] = '"'; + symb[1] = '"'; + } h = 0; for(p=symb; c = *p; p++) |
