diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index c5c38d4b47..a612bfadec 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -2692,49 +2692,6 @@ func Entryvalue(ctxt *Link) int64 { return s.Value } -func undefsym(ctxt *Link, s *sym.Symbol) { - var r *sym.Reloc - - for i := 0; i < len(s.R); i++ { - r = &s.R[i] - if r.Sym == nil { // happens for some external ARM relocs - continue - } - // TODO(mwhudson): the test of VisibilityHidden here probably doesn't make - // sense and should be removed when someone has thought about it properly. - if (r.Sym.Type == sym.Sxxx || r.Sym.Type == sym.SXREF) && !r.Sym.Attr.VisibilityHidden() { - Errorf(s, "undefined: %q", r.Sym.Name) - } - if !r.Sym.Attr.Reachable() && r.Type != objabi.R_WEAKADDROFF { - Errorf(s, "relocation target %q", r.Sym.Name) - } - } -} - -func (ctxt *Link) undef() { - // undefsym performs checks (almost) identical to checks - // that report undefined relocations in relocsym. - // Both undefsym and relocsym can report same symbol as undefined, - // which results in error message duplication (see #10978). - // - // The undef is run after Arch.Asmb and could detect some - // programming errors there, but if object being linked is already - // failed with errors, it is better to avoid duplicated errors. - if nerrors > 0 { - return - } - - for _, s := range ctxt.Textp { - undefsym(ctxt, s) - } - for _, s := range ctxt.datap { - undefsym(ctxt, s) - } - if nerrors > 0 { - errorexit() - } -} - func (ctxt *Link) callgraph() { if !*FlagC { return diff --git a/src/cmd/link/internal/ld/main.go b/src/cmd/link/internal/ld/main.go index 80be4d95be..7d3f25540d 100644 --- a/src/cmd/link/internal/ld/main.go +++ b/src/cmd/link/internal/ld/main.go @@ -343,8 +343,6 @@ func Main(arch *sys.Arch, theArch Arch) { bench.Start("Munmap") ctxt.Out.Close() // Close handles Munmapping if necessary. - bench.Start("undef") - ctxt.undef() bench.Start("hostlink") ctxt.hostlink() if ctxt.Debugvlog != 0 {