golang/go · error

%s: %v: sectnum < 0!

Error message

%s: %v: sectnum < 0!

What it means

Error "%s: %v: sectnum < 0!" thrown in golang/go.

Source

Thrown at src/cmd/link/internal/loadpe/ldpe.go:534

		if err != nil {
			return nil, err
		}

		if pesym.SectionNumber == 0 { // extern
			if l.SymType(s) == sym.SXREF && pesym.Value > 0 { // global data
				bld = makeUpdater(l, bld, s)
				bld.SetType(sym.SNOPTRDATA)
				bld.SetSize(int64(pesym.Value))
			}

			continue
		} else if pesym.SectionNumber > 0 && int(pesym.SectionNumber) <= len(f.Sections) {
			sect = f.Sections[pesym.SectionNumber-1]
			if _, found := state.sectsyms[sect]; !found {
				return nil, fmt.Errorf("%s: %v: missing sect.sym", pn, s)
			}
		} else {
			return nil, fmt.Errorf("%s: %v: sectnum < 0!", pn, s)
		}

		if sect == nil {
			return nil, nil
		}

		// Check for COMDAT symbol.
		if sz, ok1 := state.comdats[uint16(pesym.SectionNumber-1)]; ok1 {
			if psz, ok2 := comdatDefinitions[l.SymName(s)]; ok2 {
				if sz == psz {
					//  OK to discard, we've seen an instance
					// already.
					continue
				}
			}
		}
		if l.OuterSym(s) != 0 {
			if l.AttrDuplicateOK(s) {

View on GitHub (pinned to b6b368adc5)

When it happens

Trigger: Thrown at src/cmd/link/internal/loadpe/ldpe.go:534 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/0466d59c5bf5b635. Report an issue: GitHub.