]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/ld: put all type decoding in decodesym.go
authorAustin Clements <austin@google.com>
Mon, 4 May 2015 18:35:35 +0000 (14:35 -0400)
committerAustin Clements <austin@google.com>
Mon, 4 May 2015 20:17:39 +0000 (20:17 +0000)
Move the one instance of type structure decoding in the linker that
doesn't live decodesym.go in to decodesym.go.

Change-Id: Ic6a23500deb72f0e9c8227ab611511e9781fac70
Reviewed-on: https://go-review.googlesource.com/9690
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/internal/ld/decodesym.go
src/cmd/internal/ld/lib.go

index 19d2502c7a39c141d71a23372ee1e56157a86b18..7dbe4b164ea7dc251309c8ac470c29ac0216c9d1 100644 (file)
@@ -75,6 +75,10 @@ func decodetype_gcprog(s *LSym) *LSym {
        return decode_reloc_sym(s, 1*int32(Thearch.Ptrsize)+8+2*int32(Thearch.Ptrsize))
 }
 
+func decodetype_gcprog_shlib(s *LSym) uint64 {
+       return decode_inuxi(s.P[1*int32(Thearch.Ptrsize)+8+1*int32(Thearch.Ptrsize):], Thearch.Ptrsize)
+}
+
 func decodetype_gcmask(s *LSym) []byte {
        if s.Type == obj.SDYNIMPORT {
                // ldshlibsyms makes special efforts to read the value
index 75a88541b05e476703a9f38ad50a9d9298dd9d2b..6a9c277008018dd695019e8961fb1af316d899be 100644 (file)
@@ -1224,10 +1224,7 @@ func ldshlibsyms(shlib string) {
                if decodetype_noptr(t) != 0 || decodetype_usegcprog(t) != 0 {
                        continue
                }
-               // The expression on the next line is a copy of the expression from
-               // decodetype_gcmask in decodesym.go, which in turn depends on details of
-               // how the type data is laid out, as seen in gc/reflect.go:dcommontype.
-               addr := decode_inuxi(t.P[1*int32(Thearch.Ptrsize)+8+1*int32(Thearch.Ptrsize):], Thearch.Ptrsize)
+               addr := decodetype_gcprog_shlib(t)
                tgcmask, ok := gcmasks[addr]
                if !ok {
                        Diag("bits not found for %s at %d", t.Name, addr)