]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: fix TestRuntimeTypeAttr on ppc64,solaris
authorHeschi Kreinick <heschi@google.com>
Mon, 23 Apr 2018 21:07:12 +0000 (17:07 -0400)
committerHeschi Kreinick <heschi@google.com>
Tue, 24 Apr 2018 18:58:45 +0000 (18:58 +0000)
For ppc64, skip -linkmode=external per
https://go-review.googlesource.com/c/go/+/106775#message-f95b9bd716e3d9ebb3f47a50492cde9f2972e859

For Solaris, apparently type.* isn't the same as runtime.types. I don't
know why, but runtime.types is what goes into moduledata, and so it's
definitely the more correct thing to use.

Fixes: #24983
Change-Id: I6b465ac7b8f91ce55a63acbd7fe76e4a2dbb6f22
Reviewed-on: https://go-review.googlesource.com/108955
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/link/internal/ld/dwarf_test.go

index 5475edbf629175d0c4358eb3d6b9d70abc08ce50..d0090bc3fef74821f99015bdbc0f7d465f7d4581 100644 (file)
@@ -17,6 +17,7 @@ import (
        "reflect"
        "runtime"
        "strconv"
+       "strings"
        "testing"
 )
 
@@ -813,10 +814,6 @@ func TestAbstractOriginSanityWithLocationLists(t *testing.T) {
 func TestRuntimeTypeAttr(t *testing.T) {
        testenv.MustHaveGoBuild(t)
 
-       if runtime.GOOS == "solaris" || runtime.GOARCH == "ppc64" {
-               t.Skip("TODO(heschi): fix or make skip permanent (golang.org/issue/24983)")
-       }
-
        if runtime.GOOS == "plan9" {
                t.Skip("skipping on plan9; no DWARF symbol table in executables")
        }
@@ -824,6 +821,10 @@ func TestRuntimeTypeAttr(t *testing.T) {
        // Explicitly test external linking, for dsymutil compatility on Darwin.
        for _, flags := range []string{"-ldflags=linkmode=internal", "-ldflags=-linkmode=external"} {
                t.Run("flags="+flags, func(t *testing.T) {
+                       if runtime.GOARCH == "ppc64" && strings.Contains(flags, "external") {
+                               t.Skip("-linkmode=external not supported on ppc64")
+                       }
+
                        testRuntimeTypeAttr(t, flags)
                })
        }
@@ -863,15 +864,15 @@ func main() {
        if err != nil {
                t.Fatalf("error reading symbols: %v", err)
        }
-       var typeStar *objfilepkg.Sym
+       var types *objfilepkg.Sym
        for _, sym := range symbols {
-               if sym.Name == "type.*" {
-                       typeStar = &sym
+               if sym.Name == "runtime.types" {
+                       types = &sym
                        break
                }
        }
-       if typeStar == nil {
-               t.Fatal("couldn't find types.* in symbols")
+       if types == nil {
+               t.Fatal("couldn't find runtime.types in symbols")
        }
 
        d, err := f.DWARF()
@@ -893,7 +894,7 @@ func main() {
                t.Fatalf("*main.X DIE had no runtime type attr. DIE: %v", dies[0])
        }
 
-       if rtAttr.(uint64)+typeStar.Addr != addr {
-               t.Errorf("DWARF type offset was %#x+%#x, but test program said %#x", rtAttr.(uint64), typeStar.Addr, addr)
+       if rtAttr.(uint64)+types.Addr != addr {
+               t.Errorf("DWARF type offset was %#x+%#x, but test program said %#x", rtAttr.(uint64), types.Addr, addr)
        }
 }