From: David Crawshaw Date: Thu, 14 Apr 2016 12:54:15 +0000 (-0400) Subject: cmd/compile: use type. prefix on importpath symbol X-Git-Tag: go1.7beta1~676 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c9638810df5c0ab7e15a0856f0ddddf4b3afbba6;p=gostls13.git cmd/compile: use type. prefix on importpath symbol 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go index df68f46d4c..b8b9369f37 100644 --- a/src/cmd/compile/internal/gc/reflect.go +++ b/src/cmd/compile/internal/gc/reflect.go @@ -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) }