]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/ld: make a few more symbols local
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Sat, 11 Apr 2015 02:04:17 +0000 (14:04 +1200)
committerIan Lance Taylor <iant@golang.org>
Sat, 11 Apr 2015 17:37:18 +0000 (17:37 +0000)
The symbols for the actual data in a constant string or bytes literal should
be local.

Change-Id: Idafcfba9a638eaa4e460e5103d96843960559b35
Reviewed-on: https://go-review.googlesource.com/8772
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

src/cmd/internal/ld/symtab.go

index 2b2ed9675cc0a2179b03f9fd8761647b0976b817..c31f70abd12aff21ee0f253f7907703115aa254b 100644 (file)
@@ -367,9 +367,18 @@ func symtab() {
        // just defined above will be first.
        // hide the specific symbols.
        for s := Ctxt.Allsym; s != nil; s = s.Allsym {
-               if !s.Reachable || s.Special != 0 || s.Type != SRODATA {
+               if !s.Reachable || s.Special != 0 {
                        continue
                }
+
+               if strings.Contains(s.Name, "..gostring.") || strings.Contains(s.Name, "..gobytes.") {
+                       s.Local = true
+               }
+
+               if s.Type != SRODATA {
+                       continue
+               }
+
                if strings.HasPrefix(s.Name, "type.") && !DynlinkingGo() {
                        s.Type = STYPE
                        s.Hide = 1