const UnlinkablePkg … // Entry point of writing new object file. func WriteObjFile(ctxt *Link, b *bio.Writer) { … } type writer … // prepare package index list func (w *writer) init() { … } func (w *writer) writeFile(ctxt *Link, file *FileInfo) { … } func (w *writer) StringTable() { … } const cutoff … func (w *writer) Sym(s *LSym) { … } func (w *writer) Hash64(s *LSym) { … } func (w *writer) Hash(s *LSym) { … } // contentHashSection returns a mnemonic for s's section. // The goal is to prevent content-addressability from moving symbols between sections. // contentHashSection only distinguishes between sets of sections for which this matters. // Allowing flexibility increases the effectiveness of content-addressability. // But in some cases, such as doing addressing based on a base symbol, // we need to ensure that a symbol is always in a particular section. // Some of these conditions are duplicated in cmd/link/internal/ld.(*Link).symtab. // TODO: instead of duplicating them, have the compiler decide where symbols go. func contentHashSection(s *LSym) byte { … } func contentHash64(s *LSym) goobj.Hash64Type { … } // Compute the content hash for a content-addressable symbol. // We build a content hash based on its content and relocations. // Depending on the category of the referenced symbol, we choose // different hash algorithms such that the hash is globally // consistent. // - For referenced content-addressable symbol, its content hash // is globally consistent. // - For package symbol and builtin symbol, its local index is // globally consistent. // - For non-package symbol, its fully-expanded name is globally // consistent. For now, we require we know the current package // path so we can always expand symbol names. (Otherwise, // symbols with relocations are not considered hashable.) // // For now, we assume there is no circular dependencies among // hashed symbols. func (w *writer) contentHash(s *LSym) goobj.HashType { … } func makeSymRef(s *LSym) goobj.SymRef { … } func (w *writer) Reloc(r *Reloc) { … } func (w *writer) aux1(typ uint8, rs *LSym) { … } func (w *writer) Aux(s *LSym) { … } // Emits flags of referenced indexed symbols. func (w *writer) refFlags() { … } // Emits names of referenced indexed symbols, used by tools (objdump, nm) // only. func (w *writer) refNames() { … } // return the number of aux symbols s have. func nAuxSym(s *LSym) int { … } // generate symbols for FuncInfo. func genFuncInfoSyms(ctxt *Link) { … } func writeAuxSymDebug(ctxt *Link, par *LSym, aux *LSym) { … } func debugAsmEmit(ctxt *Link) { … } func (ctxt *Link) writeSymDebug(s *LSym) { … } func (ctxt *Link) writeSymDebugNamed(s *LSym, name string) { … } // relocByOffCmp compare relocations by their offsets. func relocByOffCmp(x, y Reloc) int { … }