diff options
author | Ian Lance Taylor <iant@golang.org> | 2013-12-18 10:33:47 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2013-12-18 10:33:47 -0800 |
commit | 6c9b9401b2d41f102acb2d2480f5494409373470 (patch) | |
tree | 05489cccf5c7da2a34bc6f4ec5ef10cded43e2f2 /src/liblink/ld.c | |
parent | 81f797c1d034554943dc9c72ee52b59a9626e815 (diff) | |
download | go-6c9b9401b2d41f102acb2d2480f5494409373470.tar.gz |
liblink: don't search for an import file with an absolute path
This restores the old behaviour, and makes it possible to
continue to use 6g and 6l directly, rather than the go tool,
with dot imports.
R=rsc
CC=golang-dev
https://codereview.appspot.com/43710043
Diffstat (limited to 'src/liblink/ld.c')
-rw-r--r-- | src/liblink/ld.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/liblink/ld.c b/src/liblink/ld.c index 1d06f809a..9ea0e9a73 100644 --- a/src/liblink/ld.c +++ b/src/liblink/ld.c @@ -61,11 +61,15 @@ addlib(Link *ctxt, char *src, char *obj, char *pathname) if(p != nil) *p = '.'; - // try dot, -L "libdir", and then goroot. - for(i=0; i<ctxt->nlibdir; i++) { - snprint(pname, sizeof pname, "%s/%s", ctxt->libdir[i], name); - if(access(pname, AEXIST) >= 0) - break; + if((!ctxt->windows && name[0] == '/') || (ctxt->windows && name[1] == ':')) + snprint(pname, sizeof pname, "%s", name); + else { + // try dot, -L "libdir", and then goroot. + for(i=0; i<ctxt->nlibdir; i++) { + snprint(pname, sizeof pname, "%s/%s", ctxt->libdir[i], name); + if(access(pname, AEXIST) >= 0) + break; + } } cleanname(pname); |