// to Data.
constSyms []*LSym
+ // Windows SEH symbols are also data symbols that can be created
+ // concurrently.
+ SEHSyms []*LSym
+
// pkgIdx maps package path to index. The index is used for
// symbol reference in the object file.
pkgIdx map[string]int32
fn.FuncInfoSym = isym
b.Reset()
- auxsyms := []*LSym{fn.dwarfRangesSym, fn.dwarfLocSym, fn.dwarfDebugLinesSym, fn.dwarfInfoSym, fn.WasmImportSym, fn.sehUnwindInfoSym}
+ auxsyms := []*LSym{fn.dwarfRangesSym, fn.dwarfLocSym, fn.dwarfDebugLinesSym, fn.dwarfInfoSym, fn.WasmImportSym}
for _, s := range auxsyms {
if s == nil || s.Size == 0 {
continue
}
+ if s.OnList() {
+ panic("a symbol is added to defs multiple times")
+ }
s.PkgIdx = goobj.PkgIdxSelf
s.SymIdx = symidx
s.Set(AttrIndexed, true)
+ s.Set(AttrOnList, true)
symidx++
infosyms = append(infosyms, s)
}
ctxt.Data = append(ctxt.Data, ctxt.constSyms...)
ctxt.constSyms = nil
+ // So are SEH symbols.
+ sort.Slice(ctxt.SEHSyms, func(i, j int) bool {
+ return ctxt.SEHSyms[i].Name < ctxt.SEHSyms[j].Name
+ })
+ ctxt.Data = append(ctxt.Data, ctxt.SEHSyms...)
+ ctxt.SEHSyms = nil
+
ctxt.pkgIdx = make(map[string]int32)
ctxt.defs = []*LSym{}
ctxt.hashed64defs = []*LSym{}
s.Type = objabi.SSEHUNWINDINFO
s.Set(obj.AttrDuplicateOK, true)
s.Set(obj.AttrLocal, true)
+ s.Set(obj.AttrContentAddressable, true)
if exceptionHandler != nil {
r := obj.Addrel(s)
r.Off = int32(len(buf.data) - 4)
r.Sym = exceptionHandler
r.Type = objabi.R_PEIMAGEOFF
}
- // Note: AttrContentAddressable cannot be set here,
- // because the content-addressable-handling code
- // does not know about aux symbols.
+ ctxt.SEHSyms = append(ctxt.SEHSyms, s)
})
}