aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/internal')
-rw-r--r--src/cmd/internal/objabi/line.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/internal/objabi/line.go b/src/cmd/internal/objabi/line.go
index beee1291b5..80a1137ebe 100644
--- a/src/cmd/internal/objabi/line.go
+++ b/src/cmd/internal/objabi/line.go
@@ -8,6 +8,7 @@ import (
"internal/buildcfg"
"os"
"path/filepath"
+ "runtime"
"strings"
)
@@ -43,6 +44,13 @@ func AbsFile(dir, file, rewrites string) string {
abs = "$GOROOT" + abs[len(buildcfg.GOROOT):]
}
+ // Rewrite paths to match the slash convention of the target.
+ // This helps ensure that cross-compiled distributions remain
+ // bit-for-bit identical to natively compiled distributions.
+ if runtime.GOOS == "windows" {
+ abs = strings.ReplaceAll(abs, `\`, "/")
+ }
+
if abs == "" {
abs = "??"
}