]> Cypherpunks repositories - gostls13.git/commit
cmd/compile, cmd/link: weak relocation for ptrTo
authorDavid Crawshaw <crawshaw@golang.org>
Mon, 21 Nov 2016 21:58:55 +0000 (16:58 -0500)
committerDavid Crawshaw <crawshaw@golang.org>
Tue, 22 Nov 2016 03:10:14 +0000 (03:10 +0000)
commit6f31abd23a6f768c21c8b308f355f3a1bae521d2
treee15962050a703354bb4d5636794112f14ea2b680
parentaeaa4c3c1da9e7a4afd4152913d6f2bfcf4fad2d
cmd/compile, cmd/link: weak relocation for ptrTo

Introduce R_WEAKADDROFF, a "weak" variation of the R_ADDROFF relocation
that will only reference the type described if it is in some other way
reachable.

Use this for the ptrToThis field in reflect type information where it
is safe to do so (that is, types that don't need to be included for
interface satisfaction, and types that won't cause the compiler to
recursively generate an endless series of ptr-to-ptr-to-ptr-to...
types).

Also fix a small bug in reflect, where StructOf was not clearing the
ptrToThis field of new types.

Fixes #17931

Change-Id: I4d3b53cb9c916c97b3b16e367794eee142247281
Reviewed-on: https://go-review.googlesource.com/33427
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/gc/obj.go
src/cmd/compile/internal/gc/reflect.go
src/cmd/internal/obj/data.go
src/cmd/internal/obj/link.go
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/deadcode.go
src/cmd/link/internal/ld/lib.go
src/reflect/type.go