aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2010-01-13 14:39:16 +1100
committerRob Pike <r@golang.org>2010-01-13 14:39:16 +1100
commitccbcefe2b63382eb7771de9054cb5eb774d8dac8 (patch)
tree14bbb7be6b2ffb80d6841f90951653feda9d70a5
parentea1a36efcda31c159655be5e8258bb88fb600a1a (diff)
downloadgo-ccbcefe2b63382eb7771de9054cb5eb774d8dac8.tar.gz
go-ccbcefe2b63382eb7771de9054cb5eb774d8dac8.zip
ignore $GOARCH inside the compiler and linker.
by definition, they know what they are building for. makes it easier to switch architectures when testing. % 6g x.go % 6l x.6 % 6.out "Wed Jan 13 10:57:46 EST 2010" % 8g x.go % 8l x.8 % 8.out "Wed Jan 13 10:57:46 EST 2010" % echo $GOARCH % R=rsc CC=golang-dev https://golang.org/cl/186116
-rw-r--r--src/cmd/gc/lex.c2
-rw-r--r--src/cmd/ld/lib.c5
-rw-r--r--src/cmd/ld/lib.h1
3 files changed, 3 insertions, 5 deletions
diff --git a/src/cmd/gc/lex.c b/src/cmd/gc/lex.c
index 75d6d2200a..d74cb096ad 100644
--- a/src/cmd/gc/lex.c
+++ b/src/cmd/gc/lex.c
@@ -225,7 +225,7 @@ findpkg(Strlit *name)
if(goroot == nil) {
goroot = getenv("GOROOT");
goos = getenv("GOOS");
- goarch = getenv("GOARCH");
+ goarch = thestring;
}
if(islocalname(name)) {
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c
index 232916845e..f702bae237 100644
--- a/src/cmd/ld/lib.c
+++ b/src/cmd/ld/lib.c
@@ -721,7 +721,6 @@ mywhatsys(void)
char *s;
goroot = getenv("GOROOT");
- goarch = getenv("GOARCH");
goos = getenv("GOOS");
if(goroot == nil) {
@@ -732,9 +731,7 @@ mywhatsys(void)
strcpy(goroot, s);
strcat(goroot, "/go");
}
- if(goarch == nil) {
- goarch = "amd64";
- }
+ goarch = thestring; // ignore $GOARCH - we know who we are
if(goos == nil) {
goos = "linux";
}
diff --git a/src/cmd/ld/lib.h b/src/cmd/ld/lib.h
index 4a300ac4e9..bf26ae87d8 100644
--- a/src/cmd/ld/lib.h
+++ b/src/cmd/ld/lib.h
@@ -52,6 +52,7 @@ EXTERN uchar inuxi4[4];
EXTERN uchar inuxi8[8];
EXTERN char* outfile;
EXTERN int32 nsymbol;
+EXTERN char* thestring;
void addlib(char *src, char *obj);
void copyhistfrog(char *buf, int nbuf);