Skip to content

Commit 6e38b8a

Browse files
dagoodchengsiyuan
authored and
chengsiyuan
committed
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 golang#68121 Change-Id: I04b8bf9b6a5b29a1e59a6aa07fa4faa4c5bdeee6 Reviewed-on: https://go-review.googlesource.com/c/go/+/593916 LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Commit-Queue: Ian Lance Taylor <[email protected]>
1 parent 5e8c3c5 commit 6e38b8a

File tree

1 file changed

+1
-1
lines changed
  • src/cmd/link/internal/ld

1 file changed

+1
-1
lines changed

src/cmd/link/internal/ld/lib.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2917,6 +2917,6 @@ func (ctxt *Link) findExtLinkTool(toolname string) string {
29172917
if err != nil {
29182918
Exitf("%s: finding %s failed: %v\n%s", os.Args[0], toolname, err, out)
29192919
}
2920-
cmdpath := strings.TrimSuffix(string(out), "\n")
2920+
cmdpath := strings.TrimRight(string(out), "\r\n")
29212921
return cmdpath
29222922
}

0 commit comments

Comments
 (0)