diff --git a/src/cmd/link/internal/loadelf/ldelf.go b/src/cmd/link/internal/loadelf/ldelf.go index c1bfec059d..77247b47f4 100644 --- a/src/cmd/link/internal/loadelf/ldelf.go +++ b/src/cmd/link/internal/loadelf/ldelf.go @@ -639,11 +639,15 @@ func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, f *bio.Reader, case 0: // No local entry. R2 is preserved. case 1: - // These require R2 be saved and restored by the caller. This isn't supported today. - return errorf("%s: unable to handle local entry type 1", sb.Name()) + // This is kind of a hack, but pass the hint about this symbol's + // usage of R2 (R2 is a caller-save register not a TOC pointer, and + // this function does not have a distinct local entry) by setting + // its SymLocalentry to 1. + l.SetSymLocalentry(s, 1) case 7: return errorf("%s: invalid sym.other 0x%x", sb.Name(), elfsym.other) default: + // Convert the word sized offset into bytes. l.SetSymLocalentry(s, 4<