]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link/internal/sym: uncomment code for RelocName
authorJes Cok <xigua67damn@gmail.com>
Mon, 28 Aug 2023 22:16:33 +0000 (22:16 +0000)
committerCherry Mui <cherryyz@google.com>
Tue, 29 Aug 2023 15:33:31 +0000 (15:33 +0000)
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>

src/cmd/link/internal/sym/reloc.go

index 53c03291804f462fd05410b6ce578e2eb79d2d26..e614caa5d89c7d7b72d4679d7b2d203fab007df8 100644 (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 {