aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/link/internal/ld/deadcode.go6
-rw-r--r--src/cmd/link/internal/ld/lib.go7
2 files changed, 7 insertions, 6 deletions
diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go
index d2604b27a9..7f14aa3d27 100644
--- a/src/cmd/link/internal/ld/deadcode.go
+++ b/src/cmd/link/internal/ld/deadcode.go
@@ -174,13 +174,9 @@ func (d *deadcodePass) flood() {
naux := d.ldr.NAux(symIdx)
for i := 0; i < naux; i++ {
a := d.ldr.Aux(symIdx, i)
- if a.Type() == goobj.AuxGotype && !d.ctxt.linkShared {
+ if a.Type() == goobj.AuxGotype {
// A symbol being reachable doesn't imply we need its
// type descriptor. Don't mark it.
- // TODO: when -linkshared, the GCProg generation code
- // seems to need it. I'm not sure why. I think it could
- // just reach to the type descriptor's data without
- // requiring to mark it reachable.
continue
}
d.mark(a.Sym(), symIdx)
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index 4295b2a660..b2ca658c3c 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -831,7 +831,12 @@ func (ctxt *Link) mangleTypeSym() {
ldr := ctxt.loader
for s := loader.Sym(1); s < loader.Sym(ldr.NSym()); s++ {
- if !ldr.AttrReachable(s) {
+ if !ldr.AttrReachable(s) && !ctxt.linkShared {
+ // If -linkshared, the GCProg generation code may need to reach
+ // out to the shared library for the type descriptor's data, even
+ // the type descriptor itself is not actually needed at run time
+ // (therefore not reachable). We still need to mangle its name,
+ // so it is consistent with the one stored in the shared library.
continue
}
name := ldr.SymName(s)