//
// Any unreached text symbols are removed from ctxt.Textp.
func deadcode(ctxt *Link) {
- ctxt.Logf("%5.2f deadcode\n", Cputime())
+ if ctxt.Debugvlog != 0 {
++ ctxt.Logf("deadcode\n")
+ }
+
+ if *flagNewobj {
+ deadcode2(ctxt)
+ return
+ }
+
d := &deadcodepass{
ctxt: ctxt,
ifaceMethod: make(map[methodsig]bool),
}
}
- if ctxt.LinkMode == LinkInternal {
+ for _, lib := range ctxt.Library {
+ if lib.Shlib != "" {
+ if ctxt.Debugvlog > 1 {
- ctxt.Logf("%5.2f autolib: %s (from %s)\n", Cputime(), lib.Shlib, lib.Objref)
++ ctxt.Logf("autolib: %s (from %s)\n", lib.Shlib, lib.Objref)
+ }
+ ldshlibsyms(ctxt, lib.Shlib)
+ }
+ }
+
+ if ctxt.LinkMode == LinkInternal && len(hostobj) != 0 {
// Drop all the cgo_import_static declarations.
// Turns out we won't be needing them.
for _, s := range ctxt.Syms.Allsym {
}
put(ctxt, s, s.Name, BSSSym, Symaddr(s), s.Gotype)
+ case sym.SUNDEFEXT:
+ if ctxt.HeadType == objabi.Hwindows || ctxt.HeadType == objabi.Haix || ctxt.IsELF {
+ put(ctxt, s, s.Name, UndefinedSym, s.Value, nil)
+ }
+
case sym.SHOSTOBJ:
+ if !s.Attr.Reachable() {
+ continue
+ }
if ctxt.HeadType == objabi.Hwindows || ctxt.IsELF {
put(ctxt, s, s.Name, UndefinedSym, s.Value, nil)
}