• Michael Hudson-Doyle's avatar
    cmd/link: always read type data for dynimport symbols · 2f41edf1
    Michael Hudson-Doyle authored
    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: 's avatarIan Lance Taylor <iant@golang.org>
    2f41edf1
shared_test.go 23.7 KB