const SARMAG … const SAR_HDR … const ARMAG … type ArHdr … // pruneUndefsForWindows trims the list "undefs" of currently // outstanding unresolved symbols to remove references to DLL import // symbols (e.g. "__imp_XXX"). In older versions of the linker, we // would just immediately forward references from the import sym // (__imp_XXX) to the DLL sym (XXX), but with newer compilers this // strategy falls down in certain cases. We instead now do this // forwarding later on as a post-processing step, and meaning that // during the middle part of host object loading we can see a lot of // unresolved (SXREF) import symbols. We do not, however, want to // trigger the inclusion of an object from a host archive if the // reference is going to be eventually forwarded to the corresponding // SDYNIMPORT symbol, so here we strip out such refs from the undefs // list. func pruneUndefsForWindows(ldr *loader.Loader, undefs, froms []loader.Sym) ([]loader.Sym, []loader.Sym) { … } // hostArchive reads an archive file holding host objects and links in // required objects. The general format is the same as a Go archive // file, but it has an armap listing symbols and the objects that // define them. This is used for the compiler support library // libgcc.a. func hostArchive(ctxt *Link, name string) { … } type archiveMap … // readArmap reads the archive symbol map. func readArmap(filename string, f *bio.Reader, arhdr ArHdr) archiveMap { … }