golang/go · error

%s: %v: unknown relocation type %v

Error message

%s: %v: unknown relocation type %v

What it means

Error "%s: %v: unknown relocation type %v" thrown in golang/go.

Source

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

			case sys.ARM64:
				switch r.Type {
				case IMAGE_REL_ARM64_ADDR32:
					rType = objabi.R_ADDR
				case IMAGE_REL_ARM64_ADDR64:
					rType = objabi.R_ADDR
					rSize = 8
				case IMAGE_REL_ARM64_ADDR32NB:
					rType = objabi.R_PEIMAGEOFF
				case IMAGE_REL_ARM64_BRANCH26:
					rType = objabi.R_CALLARM64
				case IMAGE_REL_ARM64_PAGEBASE_REL21,
					IMAGE_REL_ARM64_PAGEOFFSET_12A,
					IMAGE_REL_ARM64_PAGEOFFSET_12L:
					rType = objabi.R_ARM64_PCREL
				}
			}
			if rType == 0 {
				return nil, fmt.Errorf("%s: %v: unknown relocation type %v", pn, state.sectsyms[rsect], r.Type)
			}
			var val int64
			switch rSize {
			default:
				panic("unexpected relocation size " + strconv.Itoa(int(rSize)))
			case 4:
				val = int64(int32(binary.LittleEndian.Uint32(state.sectdata[rsect][rOff:])))
			case 8:
				val = int64(binary.LittleEndian.Uint64(state.sectdata[rsect][rOff:]))
			}
			var rAdd int64
			if arch.Family == sys.ARM64 {
				switch r.Type {
				case IMAGE_REL_ARM64_BRANCH26:
					// This instruction doesn't support an addend.
				case IMAGE_REL_ARM64_PAGEOFFSET_12A:
					// The addend is stored in the immediate field of the instruction.
					// Get the addend from the instruction.

View on GitHub (pinned to b6b368adc5)

When it happens

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