1
0
mirror of https://github.com/golang/go synced 2024-11-22 21:00:04 -07:00

cmd/link: link libgcc archive after mingw archives

When compiling with the race detector using modern mingw, this prevents:

    libgcc(.text): relocation target ___chkstk_ms not defined

Change-Id: I2095ad09a535505b54f9ff2d3075fd20ac85e515
Reviewed-on: https://go-review.googlesource.com/c/go/+/295910
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Jason A. Donenfeld 2021-02-24 16:47:58 +01:00 committed by Russ Cox
parent 519f223aa2
commit c432917061

View File

@ -603,9 +603,6 @@ func (ctxt *Link) loadlib() {
// errors - see if we can find libcompiler_rt.a instead.
*flagLibGCC = ctxt.findLibPathCmd("--print-file-name=libcompiler_rt.a", "libcompiler_rt")
}
if *flagLibGCC != "none" {
hostArchive(ctxt, *flagLibGCC)
}
if ctxt.HeadType == objabi.Hwindows {
if p := ctxt.findLibPath("libmingwex.a"); p != "none" {
hostArchive(ctxt, p)
@ -627,6 +624,9 @@ func (ctxt *Link) loadlib() {
libmsvcrt.a libm.a
*/
}
if *flagLibGCC != "none" {
hostArchive(ctxt, *flagLibGCC)
}
}
}