golang/go · error

%s: invalid symbol binding %d

Error message

%s: invalid symbol binding %d

What it means

Error "%s: invalid symbol binding %d" thrown in golang/go.

Source

Thrown at src/cmd/link/internal/loadelf/ldelf.go:984

				s = l.CreateStaticSym(elfsym.name)
				l.SetAttrVisibilityHidden(s, true)
			}

		case elf.STB_WEAK:
			if needSym != 0 {
				s = l.LookupOrCreateCgoExport(elfsym.name, 0)
				if elfsym.other == 2 {
					l.SetAttrVisibilityHidden(s, true)
				}

				// Allow weak symbols to be duplicated when already defined.
				if l.OuterSym(s) != 0 {
					l.SetAttrDuplicateOK(s, true)
				}
			}

		default:
			err = fmt.Errorf("%s: invalid symbol binding %d", elfsym.name, elfsym.bind)
			return err
		}
	}

	if s != 0 && l.SymType(s) == 0 && elfsym.type_ != elf.STT_SECTION {
		sb := l.MakeSymbolUpdater(s)
		sb.SetType(sym.SXREF)
	}
	elfsym.sym = s

	return nil
}

// Return the size of the relocated field, and the size of the addend as the first
// and second values. Note, the addend may be larger than the relocation field in
// some cases when a relocated value is split across multiple relocations.
func relSize(arch *sys.Arch, pn string, elftype uint32) (uint8, uint8, error) {
	// TODO(mdempsky): Replace this with a struct-valued switch statement

View on GitHub (pinned to b6b368adc5)

When it happens

Trigger: Thrown at src/cmd/link/internal/loadelf/ldelf.go:984 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/45f262014ab41220. Report an issue: GitHub.