{"record":{"id":"86bbe555c8db5749","repo":"golang/go","slug":"unable-to-read-aux-info-for-section-def-symbol-d","errorCode":null,"errorMessage":"unable to read aux info for section def symbol %d %s: pe.COFFSymbolReadComdatInfo returns %v","messagePattern":"unable to read aux info for section def symbol (.+?) (.+?): pe\\.COFFSymbolReadComdatInfo returns (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/link/internal/loadpe/ldpe.go","lineNumber":795,"sourceCode":"\t\tnumaux = int(pesym.NumberOfAuxSymbols)\n\t\tif pesym.SectionNumber == 0 { // extern\n\t\t\tcontinue\n\t\t}\n\t\tsymname, err := pesym.FullName(state.f.StringTable)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, isc := state.comdats[uint16(pesym.SectionNumber-1)]; !isc {\n\t\t\tcontinue\n\t\t}\n\t\tif pesym.StorageClass != uint8(IMAGE_SYM_CLASS_STATIC) {\n\t\t\tcontinue\n\t\t}\n\t\t// This symbol corresponds to a COMDAT section. Read the\n\t\t// aux data for it.\n\t\tauxsymp, err := state.f.COFFSymbolReadSectionDefAux(i)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to read aux info for section def symbol %d %s: pe.COFFSymbolReadComdatInfo returns %v\", i, symname, err)\n\t\t}\n\t\tif auxsymp.Selection == pe.IMAGE_COMDAT_SELECT_SAME_SIZE {\n\t\t\t// This is supported.\n\t\t} else if auxsymp.Selection == pe.IMAGE_COMDAT_SELECT_ANY {\n\t\t\t// Also supported.\n\t\t\tstate.comdats[uint16(pesym.SectionNumber-1)] = int64(-1)\n\t\t} else {\n\t\t\t// We don't support any of the other strategies at the\n\t\t\t// moment. I suspect that we may need to also support\n\t\t\t// \"associative\", we'll see.\n\t\t\treturn 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)\n\t\t}\n\t}\n\treturn nil\n}\n\n// LookupBaseFromImport examines the symbol \"s\" to see if it\n// corresponds to an import symbol (name of the form \"__imp_XYZ\") and","sourceCodeStart":777,"sourceCodeEnd":813,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/link/internal/loadpe/ldpe.go#L777-L813","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","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.","Update your C compiler to the latest patch version — older compilers may emit malformed COMDAT auxiliary records that newer versions fix.","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.","File a Go bug with the object file attached if the file appears valid under standard COFF inspection tools."],"exampleFix":"# Clean and rebuild to eliminate corrupt object files\ngo clean -cache\n# Remove any manually-built .obj/.o files\nrm -f *.obj *.o\ngo build ./...","handlingStrategy":"validation","validationCode":"// Validate COMDAT auxiliary records before linking (external inspection)\n// Run on each .obj file before the build:\n//   dumpbin /symbols file.obj | grep -i comdat\n// Verify each COMDAT section symbol has proper auxiliary records with no parse errors.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run `go clean -cache` before rebuilding after compiler updates to eliminate stale object files.","Use checksums or a build system that detects corrupt object files before linking.","Keep your C compiler toolchain consistent across all object files in a single build."],"tags":["linker","pe","coff","comdat","windows","cgo","object-file"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}