summaryrefslogtreecommitdiff
path: root/src/cmd/gc/lex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/gc/lex.c')
-rw-r--r--src/cmd/gc/lex.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cmd/gc/lex.c b/src/cmd/gc/lex.c
index 51e6534e1..8e4f3504e 100644
--- a/src/cmd/gc/lex.c
+++ b/src/cmd/gc/lex.c
@@ -212,11 +212,13 @@ addidir(char* dir)
int
findpkg(Strlit *name)
{
- static char* goroot;
- Idir* p;
+ static char *goroot, *goos, *goarch;
+ Idir *p;
if(goroot == nil) {
goroot = getenv("GOROOT");
+ goos = getenv("GOOS");
+ goarch = getenv("GOARCH");
}
// try .a before .6. important for building libraries:
@@ -238,10 +240,10 @@ findpkg(Strlit *name)
if(access(namebuf, 0) >= 0)
return 1;
if(goroot != nil) {
- snprint(namebuf, sizeof(namebuf), "%s/pkg/%Z.a", goroot, name);
+ snprint(namebuf, sizeof(namebuf), "%s/pkg/%s_%s/%Z.a", goroot, goos, goarch, name);
if(access(namebuf, 0) >= 0)
return 1;
- snprint(namebuf, sizeof(namebuf), "%s/pkg/%Z.%c", goroot, name, thechar);
+ snprint(namebuf, sizeof(namebuf), "%s/pkg/%s_%s/%Z.%c", goroot, goos, goarch, name, thechar);
if(access(namebuf, 0) >= 0)
return 1;
}