golang/go · error

unable to read aux info for section def symbol %d %s: pe.COF

Error message

unable to read aux info for section def symbol %d %s: pe.COFFSymbolReadComdatInfo returns %v

What it means

The Go linker failed to read the auxiliary symbol record for a COMDAT section definition symbol in a PE/COFF object file. COMDAT sections allow multiple object files to define the same section with rules for how duplicates are merged; the selection strategy is stored in an auxiliary symbol record (IMAGE_AUX_SYMBOL_EX) attached to the section-definition symbol. When `xcoff.COFFSymbolReadSectionDefAux` (actually `pe.COFFSymbolReadSectionDefAux`) fails, the linker cannot determine how to resolve the COMDAT group.

Source

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

		numaux = int(pesym.NumberOfAuxSymbols)
		if pesym.SectionNumber == 0 { // extern
			continue
		}
		symname, err := pesym.FullName(state.f.StringTable)
		if err != nil {
			return err
		}
		if _, isc := state.comdats[uint16(pesym.SectionNumber-1)]; !isc {
			continue
		}
		if pesym.StorageClass != uint8(IMAGE_SYM_CLASS_STATIC) {
			continue
		}
		// This symbol corresponds to a COMDAT section. Read the
		// aux data for it.
		auxsymp, err := state.f.COFFSymbolReadSectionDefAux(i)
		if err != nil {
			return fmt.Errorf("unable to read aux info for section def symbol %d %s: pe.COFFSymbolReadComdatInfo returns %v", i, symname, err)
		}
		if auxsymp.Selection == pe.IMAGE_COMDAT_SELECT_SAME_SIZE {
			// This is supported.
		} else if auxsymp.Selection == pe.IMAGE_COMDAT_SELECT_ANY {
			// Also supported.
			state.comdats[uint16(pesym.SectionNumber-1)] = int64(-1)
		} else {
			// We don't support any of the other strategies at the
			// moment. I suspect that we may need to also support
			// "associative", we'll see.
			return fmt.Errorf("internal error: unsupported COMDAT selection strategy found in path=%s sec=%d strategy=%d idx=%d, please file a bug", state.pn, auxsymp.SecNum, auxsymp.Selection, i)
		}
	}
	return nil
}

// LookupBaseFromImport examines the symbol "s" to see if it
// corresponds to an import symbol (name of the form "__imp_XYZ") and

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Clean and rebuild the C object files: delete all .obj/.o files and run the full cgo build again to eliminate truncated or corrupt intermediates.
  2. Verify the object file integrity by inspecting it with `dumpbin /symbols file.obj` (MSVC) or `objdump -t file.obj` to check that NumberOfAuxSymbols matches the actual aux records present.
  3. Update your C compiler to the latest patch version — older compilers may emit malformed COMDAT auxiliary records that newer versions fix.
  4. If the issue persists, isolate which object file triggers the error by linking incrementally or with `-v` to trace the load order, then inspect that specific file.
  5. File a Go bug with the object file attached if the file appears valid under standard COFF inspection tools.

Example fix

# Clean and rebuild to eliminate corrupt object files
go clean -cache
# Remove any manually-built .obj/.o files
rm -f *.obj *.o
go build ./...
Defensive patterns

Strategy: validation

Validate before calling

// Validate COMDAT auxiliary records before linking (external inspection)
// Run on each .obj file before the build:
//   dumpbin /symbols file.obj | grep -i comdat
// Verify each COMDAT section symbol has proper auxiliary records with no parse errors.

Prevention

When it happens

Trigger: Fires in `preprocessSymbols` at ldpe.go:793-795 when iterating COFF symbols that belong to COMDAT sections (sections with IMAGE_SCN_LNK_COMDAT characteristic). The symbol must have StorageClass == IMAGE_SYM_CLASS_STATIC and its SectionNumber must correspond to a section marked as COMDAT. The auxiliary record read fails if the object file is malformed, truncated, or declares `NumberOfAuxSymbols` inconsistently with the actual data available.

Common situations: Corrupt or partially-written .obj files from a crashed or interrupted C compiler build. Using an experimental or very old C compiler that produces non-standard auxiliary record layouts. Mismatched object file formats when mixing 32-bit and 64-bit object files. File system corruption or incomplete git checkout leaving a truncated object file. cgo linking on Windows with third-party C libraries built by unconventional toolchains.

Related errors


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