]> Cypherpunks repositories - gostls13.git/commit
cmd/link: always read type data for dynimport symbols
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Tue, 3 May 2016 23:23:24 +0000 (11:23 +1200)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Wed, 4 May 2016 07:13:01 +0000 (07:13 +0000)
commit2f41edf120923000c92ed65ab501590fb1c8c548
treeca7ad01360d06d3058c3e42645eb24998e30c7a4
parentba6765c237ed4dece0056b774d81e160b3839db1
cmd/link: always read type data for dynimport symbols

Consider three shared libraries:

 libBase.so -- defines a type T
 lib2.so    -- references type T
 lib3.so    -- also references type T, and something from lib2

lib2.so will contain a type symbol for T in its symbol table, but no
definition. If, when linking lib3.so the linker reads the symbols from lib2.so
before libBase.so, the linker didn't read the type data and later crashed.

The fix is trivial but the test change is a bit messy because the order the
linker reads the shared libraries in ends up depending on the order of the
import statements in the file so I had to rename one of the test packages so
that gofmt doesn't fix the test by accident...

Fixes #15516

Change-Id: I124b058f782c900a3a54c15ed66a0d91d0cde5ce
Reviewed-on: https://go-review.googlesource.com/22744
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
misc/cgo/testshared/shared_test.go
misc/cgo/testshared/src/dep2/dep2.go
misc/cgo/testshared/src/dep3/dep3.go [new file with mode: 0644]
misc/cgo/testshared/src/depBase/asm.s [moved from misc/cgo/testshared/src/dep/asm.s with 100% similarity]
misc/cgo/testshared/src/depBase/dep.go [moved from misc/cgo/testshared/src/dep/dep.go with 74% similarity]
misc/cgo/testshared/src/depBase/gccgo.go [moved from misc/cgo/testshared/src/dep/gccgo.go with 73% similarity]
misc/cgo/testshared/src/depBase/stubs.go [moved from misc/cgo/testshared/src/dep/stubs.go with 72% similarity]
misc/cgo/testshared/src/exe/exe.go
misc/cgo/testshared/src/exe3/exe3.go [new file with mode: 0644]
src/cmd/link/internal/ld/lib.go