]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/link: use libmsvcrt.a during internal link
authorAlex Brainman <alex.brainman@gmail.com>
Sat, 19 Oct 2019 06:47:12 +0000 (17:47 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Sun, 20 Oct 2019 06:38:39 +0000 (06:38 +0000)
commite4c3925925d9bb93554cc60a29a4d728bb969296
tree0d6c5f1133e19ac4ba860628b9e54c0a083dde62
parent39cfb7609d293ae9acc40d09645d01258dc8edbf
cmd/link: use libmsvcrt.a during internal link

When using recent versions of gcc with cgo, internal link fails with

c:\>go test debug/pe
--- FAIL: TestInternalLinkerDWARF (0.94s)
    file_test.go:394: building test executable for linktype 2 failed: exit status 2 # command-line-arguments
        runtime/cgo(.text): relocation target __acrt_iob_func not defined for ABI0 (but is defined for ABI0)
        runtime/cgo(.text): relocation target __acrt_iob_func not defined for ABI0 (but is defined for ABI0)
        runtime/cgo(.text): relocation target __acrt_iob_func not defined for ABI0 (but is defined for ABI0)
FAIL
FAIL    debug/pe        4.572s
FAIL

It appears that __acrt_iob_func is defined in libmsvcrt.a. And this
change adds libmsvcrt.a to the list of libraries always used byi
internal linker.

libmsvcrt.a also implements __imp___acrt_iob_func. So this change
also prevents rewriting __imp___acrt_iob_func name into
__acrt_iob_func, otherwise we end up with duplicate __acrt_iob_func
symbol error.

Fixes #23649

Change-Id: Ie9864cd17e907501e9a8a3672bbc33e02ca20e5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/197977
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/loadpe/ldpe.go