1
0
mirror of https://github.com/golang/go synced 2024-11-18 23:05:06 -07:00

cmd/link/internal/sym: uncomment code for RelocName

Currently we include those relocation types in bootstrap code.

Change-Id: I3016f33f70a756255545431319ffc542893e75aa
GitHub-Last-Rev: 24916e86d0
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>
This commit is contained in:
Jes Cok 2023-08-28 22:16:33 +00:00 committed by Cherry Mui
parent 07faf8fab5
commit 2efebf3ee0

View File

@ -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 {