diff options
| author | Jes Cok <xigua67damn@gmail.com> | 2023-08-28 22:16:33 +0000 |
|---|---|---|
| committer | Cherry Mui <cherryyz@google.com> | 2023-08-29 15:33:31 +0000 |
| commit | 2efebf3ee0796054942a49d0f8b1c2c50193c7fe (patch) | |
| tree | ed57bcce25a5087f90bd94cb891102e2e9fa536c /src | |
| parent | 07faf8fab55d74ef6108e56b9e0ccee3e62b0a2d (diff) | |
| download | go-2efebf3ee0796054942a49d0f8b1c2c50193c7fe.tar.xz | |
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 <joedian@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/link/internal/sym/reloc.go | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/cmd/link/internal/sym/reloc.go b/src/cmd/link/internal/sym/reloc.go index 53c0329180..e614caa5d8 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 { |
