// Trampoline don't have a FILE so there are considered
// in the current file.
// Same goes for runtime.text.X symbols.
- } else if x.File == "" { // Undefined global symbol
+ } else if symPkg(ctxt, x) == "" { // Undefined global symbol
// If this happens, the algorithm must be redone.
if currSymSrcFile.name != "" {
Exitf("undefined global symbol found inside another file")
}
} else {
// Current file has changed. New C_FILE, C_DWARF, etc must be generated.
- if currSymSrcFile.name != x.File {
+ if currSymSrcFile.name != symPkg(ctxt, x) {
if ctxt.LinkMode == LinkInternal {
// update previous file values
xfile.updatePreviousFile(ctxt, false)
- currSymSrcFile.name = x.File
- f.writeSymbolNewFile(ctxt, x.File, uint64(x.Value), xfile.getXCOFFscnum(x.Sect))
+ currSymSrcFile.name = symPkg(ctxt, x)
+ f.writeSymbolNewFile(ctxt, symPkg(ctxt, x), uint64(x.Value), xfile.getXCOFFscnum(x.Sect))
} else {
// With external linking, ld will crash if there is several
// .FILE and DWARF debugging enable, somewhere during
// TODO(aix); remove once ld has been fixed or the triggering
// relocation has been found and fixed.
if currSymSrcFile.name == "" {
- currSymSrcFile.name = x.File
+ currSymSrcFile.name = symPkg(ctxt, x)
f.writeSymbolNewFile(ctxt, "go_functions", uint64(x.Value), xfile.getXCOFFscnum(x.Sect))
}
}
return
case TextSym:
- if x.File != "" || strings.Contains(x.Name, "-tramp") || strings.HasPrefix(x.Name, "runtime.text.") {
+ if symPkg(ctxt, x) != "" || strings.Contains(x.Name, "-tramp") || strings.HasPrefix(x.Name, "runtime.text.") {
// Function within a file
syms = xfile.writeSymbolFunc(ctxt, x)
} else {
s.Version = int16(pp.ver)
s.Type = pp.kind
s.Size = pp.size
- if pp.gotype != 0 {
- s.Gotype = l.Syms[pp.gotype]
- }
- if f, ok := l.symPkg[i]; ok {
- s.File = f
- } else if pp.objidx != 0 {
- s.File = l.objs[pp.objidx].r.unit.Lib.Pkg
- }
// Copy relocations
batch := l.relocBatch
relfix = true
}
- // For 'new' symbols, copy other content (such as Gotype,
- // sym file, relocations, etc).
- if isnew {
- if gt := l.SymGoType(cand); gt != 0 {
- s.Gotype = l.Syms[gt]
- }
- if f, ok := l.symPkg[cand]; ok {
- s.File = f
- } else {
- r, _ := l.toLocal(cand)
- if r != nil && r != l.extReader {
- s.File = l.SymPkg(cand)
- }
- }
- }
-
+ // For 'new' symbols, copy other content.
if relfix {
relocfixup = append(relocfixup, cand)
}
panic("sym already present in installSym")
}
l.Syms[i] = s
+ s.SymIdx = sym.LoaderSym(i)
}
// addNewSym adds a new sym.Symbol to the i-th index in the list of symbols.
}
func loadObjFull(l *Loader, r *oReader) {
- resolveSymRef := func(s goobj2.SymRef) *sym.Symbol {
- i := l.resolve(r, s)
- return l.Syms[i]
- }
-
for i, n := 0, r.NSym()+r.NNonpkgdef(); i < n; i++ {
// A symbol may be a dup or overwritten. In this case, its
// content will actually be provided by a different object
for j := range auxs {
a := &auxs[j]
switch a.Type() {
- case goobj2.AuxGotype:
- typ := resolveSymRef(a.Sym())
- if typ != nil {
- s.Gotype = typ
- }
- case goobj2.AuxFuncInfo, goobj2.AuxFuncdata:
+ case goobj2.AuxFuncInfo, goobj2.AuxFuncdata, goobj2.AuxGotype:
// already handled
case goobj2.AuxDwarfInfo, goobj2.AuxDwarfLoc, goobj2.AuxDwarfRanges, goobj2.AuxDwarfLines:
// ignored for now
}
}
- s.File = r.pkgprefix[:len(r.pkgprefix)-1]
if s.Size < int64(size) {
s.Size = int64(size)
}