]> Cypherpunks repositories - gostls13.git/commitdiff
liblink: don't search for an import file with an absolute path
authorIan Lance Taylor <iant@golang.org>
Wed, 18 Dec 2013 18:33:47 +0000 (10:33 -0800)
committerIan Lance Taylor <iant@golang.org>
Wed, 18 Dec 2013 18:33:47 +0000 (10:33 -0800)
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://golang.org/cl/43710043

src/liblink/ld.c

index 1d06f809a4fb559e469623904f7c632c4668421f..9ea0e9a732267f9397ead22e1142640973f06149 100644 (file)
@@ -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);