mirror of
https://github.com/golang/go
synced 2024-11-22 04:04:40 -07:00
cmd/link/internal/ld: handle "\r" in MinGW "--print-prog-name" output
Fix the "gcc --print-prog-name" output parser to handle "\r\n", not only "\n". The MinGW compiler on Windows uses "\r\n" as line endings, causing the existing parser to create paths like ".../x86_64-w64-mingw32/bin/ar.exe\r", which is not correct. By trimming the "\r\n" cutset, both types of line endings are handled correctly. Fixes #68121 Change-Id: I04b8bf9b6a5b29a1e59a6aa07fa4faa4c5bdeee6 Reviewed-on: https://go-review.googlesource.com/c/go/+/593916 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
44f1870666
commit
e8ee1dc4f9
@ -2917,6 +2917,6 @@ func (ctxt *Link) findExtLinkTool(toolname string) string {
|
||||
if err != nil {
|
||||
Exitf("%s: finding %s failed: %v\n%s", os.Args[0], toolname, err, out)
|
||||
}
|
||||
cmdpath := strings.TrimSuffix(string(out), "\n")
|
||||
cmdpath := strings.TrimRight(string(out), "\r\n")
|
||||
return cmdpath
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user