golang/go · error

%s: duplicate symbol reference: %s in both %s and %s

Error message

%s: duplicate symbol reference: %s in both %s and %s

What it means

Error "%s: duplicate symbol reference: %s in both %s and %s" thrown in golang/go.

Source

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

		}

		// 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) {
				continue
			}
			outerName := l.SymName(l.OuterSym(s))
			sectName := l.SymName(state.sectsyms[sect])
			return nil, fmt.Errorf("%s: duplicate symbol reference: %s in both %s and %s", pn, l.SymName(s), outerName, sectName)
		}

		bld = makeUpdater(l, bld, s)
		sectsym := state.sectsyms[sect]
		bld.SetType(l.SymType(sectsym))
		l.AddInteriorSym(sectsym, s)
		bld.SetValue(int64(pesym.Value))
		bld.SetSize(4)
		if l.SymType(sectsym).IsText() {
			if bld.External() && !bld.DuplicateOK() {
				return nil, fmt.Errorf("%s: duplicate symbol definition", l.SymName(s))
			}
			bld.SetExternal(true)
		}
		if sz, ok := state.comdats[uint16(pesym.SectionNumber-1)]; ok {
			// This is a COMDAT definition. Record that we're picking
			// this instance so that we can ignore future defs.
			if _, ok := comdatDefinitions[l.SymName(s)]; ok {

View on GitHub (pinned to b6b368adc5)

When it happens

Trigger: Thrown at src/cmd/link/internal/loadpe/ldpe.go:557 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/3df9ca7a3ea704cf. Report an issue: GitHub.