From 2efebf3ee0796054942a49d0f8b1c2c50193c7fe Mon Sep 17 00:00:00 2001 From: Jes Cok Date: Mon, 28 Aug 2023 22:16:33 +0000 Subject: [PATCH] cmd/link/internal/sym: uncomment code for RelocName Currently we include those relocation types in bootstrap code. Change-Id: I3016f33f70a756255545431319ffc542893e75aa GitHub-Last-Rev: 24916e86d0e90f88ba953cea60d38805dcb8a6a3 GitHub-Pull-Request: golang/go#62322 Reviewed-on: https://go-review.googlesource.com/c/go/+/523395 Reviewed-by: Joedian Reid TryBot-Result: Gopher Robot Reviewed-by: Cherry Mui Run-TryBot: Cherry Mui --- src/cmd/link/internal/sym/reloc.go | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/cmd/link/internal/sym/reloc.go b/src/cmd/link/internal/sym/reloc.go index 53c03291804..e614caa5d89 100644 --- a/src/cmd/link/internal/sym/reloc.go +++ b/src/cmd/link/internal/sym/reloc.go @@ -8,6 +8,7 @@ import ( "cmd/internal/objabi" "cmd/internal/sys" "debug/elf" + "debug/macho" ) // RelocVariant is a linker-internal variation on a relocation. @@ -30,24 +31,17 @@ const ( ) func RelocName(arch *sys.Arch, r objabi.RelocType) string { - // We didn't have some relocation types at Go1.4. - // Uncomment code when we include those in bootstrap code. - switch { case r >= objabi.MachoRelocOffset: // Mach-O - // nr := (r - objabi.MachoRelocOffset)>>1 - // switch ctxt.Arch.Family { - // case sys.AMD64: - // return macho.RelocTypeX86_64(nr).String() - // case sys.ARM: - // return macho.RelocTypeARM(nr).String() - // case sys.ARM64: - // return macho.RelocTypeARM64(nr).String() - // case sys.I386: - // return macho.RelocTypeGeneric(nr).String() - // default: - // panic("unreachable") - // } + nr := (r - objabi.MachoRelocOffset) >> 1 + switch arch.Family { + case sys.AMD64: + return macho.RelocTypeX86_64(nr).String() + case sys.ARM64: + return macho.RelocTypeARM64(nr).String() + default: + panic("unreachable") + } case r >= objabi.ElfRelocOffset: // ELF nr := r - objabi.ElfRelocOffset switch arch.Family {