]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: use type. prefix on importpath symbol
authorDavid Crawshaw <crawshaw@golang.org>
Thu, 14 Apr 2016 12:54:15 +0000 (08:54 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Thu, 14 Apr 2016 19:59:15 +0000 (19:59 +0000)
This ensures that importpath symbols are treated like other type data
and end up in the same section under all build modes.

Fixes: go test -buildmode=pie reflect
Change-Id: Ibb8348648e8dcc850f2424d206990a06090ce4c6
Reviewed-on: https://go-review.googlesource.com/22081
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/gc/reflect.go

index df68f46d4cb9c978a9f6102073e6742d245c7589..b8b9369f3786da68f0d3f8bd1dca735833a711d1 100644 (file)
@@ -432,7 +432,7 @@ func dimportpath(p *Pkg) {
                str = p.Path
        }
 
-       s := obj.Linklookup(Ctxt, "go.importpath."+p.Prefix+".", 0)
+       s := obj.Linklookup(Ctxt, "type..importpath."+p.Prefix+".", 0)
        ot := dnameData(s, 0, str, "", nil, false)
        ggloblLSym(s, int32(ot), obj.DUPOK|obj.RODATA)
        p.Pathsym = s
@@ -450,10 +450,10 @@ func dgopkgpathLSym(s *obj.LSym, ot int, pkg *Pkg) int {
        if pkg == localpkg && myimportpath == "" {
                // If we don't know the full import path of the package being compiled
                // (i.e. -p was not passed on the compiler command line), emit a reference to
-               // go.importpath.""., which the linker will rewrite using the correct import path.
+               // type..importpath.""., which the linker will rewrite using the correct import path.
                // Every package that imports this one directly defines the symbol.
                // See also https://groups.google.com/forum/#!topic/golang-dev/myb9s53HxGQ.
-               ns := obj.Linklookup(Ctxt, `go.importpath."".`, 0)
+               ns := obj.Linklookup(Ctxt, `type..importpath."".`, 0)
                return dsymptrLSym(s, ot, ns, 0)
        }
 
@@ -466,10 +466,10 @@ func dgopkgpathOffLSym(s *obj.LSym, ot int, pkg *Pkg) int {
        if pkg == localpkg && myimportpath == "" {
                // If we don't know the full import path of the package being compiled
                // (i.e. -p was not passed on the compiler command line), emit a reference to
-               // go.importpath.""., which the linker will rewrite using the correct import path.
+               // type..importpath.""., which the linker will rewrite using the correct import path.
                // Every package that imports this one directly defines the symbol.
                // See also https://groups.google.com/forum/#!topic/golang-dev/myb9s53HxGQ.
-               ns := obj.Linklookup(Ctxt, `go.importpath."".`, 0)
+               ns := obj.Linklookup(Ctxt, `type..importpath."".`, 0)
                return dsymptrOffLSym(s, ot, ns, 0)
        }