Commit 5a210b58 authored by Cherry Zhang's avatar Cherry Zhang

[dev.link] cmd/link: keep DWARF constant DIE symbols live

DWARF constant DIE symbols are not referenced by any other symbol,
but are needed by the DWARF pass, where they get linked to the
compilation unit.

Reenable gdb constant test.

Change-Id: If77a0d379d9a6f1591939345bc31b027c2567f22
Reviewed-on: https://go-review.googlesource.com/c/go/+/204397
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarThan McIntosh <thanm@google.com>
parent 43d25a61
......@@ -6,6 +6,7 @@ package ld
import (
"bytes"
"cmd/internal/dwarf"
"cmd/internal/objabi"
"cmd/internal/sys"
"cmd/link/internal/loader"
......@@ -95,6 +96,14 @@ func (d *deadcodePass2) init() {
names = append(names, exp)
}
// DWARF constant DIE symbols are not referenced, but needed by
// the dwarf pass.
if !*FlagW {
for _, lib := range d.ctxt.Library {
names = append(names, dwarf.ConstInfoPrefix+lib.Pkg)
}
}
for _, name := range names {
// Mark symbol as an data/ABI0 symbol.
d.mark(d.ldr.Lookup(name, 0))
......
......@@ -489,8 +489,6 @@ func main() {
`
func TestGdbConst(t *testing.T) {
t.Skip("TODO: newobj") // XXX the constant DIEs are not referenced, so they are not pulled in. Maybe it'll be fine if we rewrite linker's dwarf pass to index?
checkGdbEnvironment(t)
t.Parallel()
checkGdbVersion(t)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment