var head, tail loader.Sym
ldr := ctxt.loader
sl := make([]symNameSize, len(syms))
+
+ // For ppc64, we want to interleave the .got and .toc sections
+ // from input files. Both are type sym.SELFGOT, so in that case
+ // we skip size comparison and do the name comparison instead
+ // (conveniently, .got sorts before .toc).
+ checkSize := symn != sym.SELFGOT
+
for k, s := range syms {
ss := ldr.SymSize(s)
- sl[k] = symNameSize{name: ldr.SymName(s), sz: ss, sym: s}
+ sl[k] = symNameSize{sz: ss, sym: s}
+ if !checkSize {
+ sl[k].name = ldr.SymName(s)
+ }
ds := int64(len(ldr.Data(s)))
switch {
case ss < ds:
}
}
- // For ppc64, we want to interleave the .got and .toc sections
- // from input files. Both are type sym.SELFGOT, so in that case
- // we skip size comparison and fall through to the name
- // comparison (conveniently, .got sorts before .toc).
- checkSize := symn != sym.SELFGOT
-
// Perform the sort.
if symn != sym.SPCLNTAB {
sort.Slice(sl, func(i, j int) bool {
if isz != jsz {
return isz < jsz
}
- }
- iname := sl[i].name
- jname := sl[j].name
- if iname != jname {
- return iname < jname
+ } else {
+ iname := sl[i].name
+ jname := sl[j].name
+ if iname != jname {
+ return iname < jname
+ }
}
return si < sj
})