From 183d25d9963107e6e4e86c49018ddd8871109d61 Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Mon, 27 Apr 2020 14:02:06 -0400 Subject: [PATCH] [dev.link] cmd/link/internal/sym: remove SortSub Remove SortSub; this function no longer referenced. Change-Id: Ie0c78f5cd048a8f465f84ceeab30db57be5c05a7 Reviewed-on: https://go-review.googlesource.com/c/go/+/230457 Run-TryBot: Than McIntosh TryBot-Result: Gobot Gobot Reviewed-by: Jeremy Faller Reviewed-by: Cherry Zhang --- src/cmd/link/internal/sym/symbol.go | 74 ----------------------------- 1 file changed, 74 deletions(-) diff --git a/src/cmd/link/internal/sym/symbol.go b/src/cmd/link/internal/sym/symbol.go index 5bb1d438b0a..90c6d4c5f3b 100644 --- a/src/cmd/link/internal/sym/symbol.go +++ b/src/cmd/link/internal/sym/symbol.go @@ -443,80 +443,6 @@ func (s *Symbol) SetElfType(val elf.SymType) { s.auxinfo.elftype = val } -// SortSub sorts a linked-list (by Sub) of *Symbol by Value. -// Used for sub-symbols when loading host objects (see e.g. ldelf.go). -func SortSub(l *Symbol) *Symbol { - if l == nil || l.Sub == nil { - return l - } - - l1 := l - l2 := l - for { - l2 = l2.Sub - if l2 == nil { - break - } - l2 = l2.Sub - if l2 == nil { - break - } - l1 = l1.Sub - } - - l2 = l1.Sub - l1.Sub = nil - l1 = SortSub(l) - l2 = SortSub(l2) - - /* set up lead element */ - if l1.Value < l2.Value { - l = l1 - l1 = l1.Sub - } else { - l = l2 - l2 = l2.Sub - } - - le := l - - for { - if l1 == nil { - for l2 != nil { - le.Sub = l2 - le = l2 - l2 = l2.Sub - } - - le.Sub = nil - break - } - - if l2 == nil { - for l1 != nil { - le.Sub = l1 - le = l1 - l1 = l1.Sub - } - - break - } - - if l1.Value < l2.Value { - le.Sub = l1 - le = l1 - l1 = l1.Sub - } else { - le.Sub = l2 - le = l2 - l2 = l2.Sub - } - } - - le.Sub = nil - return l -} - type Pcdata struct { P []byte }