Skip to content

Commit 47a57bc

Browse files
committed
[release-branch.go1.17] cmd/link: do not use GO_LDSO when cross compile
GO_LDSO is a setting that is set when the toolchain is build. It only makes sense to use it on the host platform. Do not use it when targetting a different platform. In the past it was not a problem as GO_LDSO was almost always unset. Now, with CL 301989 it is almost always set (maybe we want to revisit it). Updates #47760. Fixes #47782. Change-Id: I2704b9968781f46e2d2f8624090db19689b1a32f Reviewed-on: https://go-review.googlesource.com/c/go/+/343010 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> (cherry picked from commit ddfcc02) Reviewed-on: https://go-review.googlesource.com/c/go/+/343309
1 parent 2d97a87 commit 47a57bc

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"fmt"
1717
"internal/buildcfg"
1818
"path/filepath"
19+
"runtime"
1920
"sort"
2021
"strings"
2122
)
@@ -1749,7 +1750,7 @@ func asmbElf(ctxt *Link) {
17491750
sh.Flags = uint64(elf.SHF_ALLOC)
17501751
sh.Addralign = 1
17511752

1752-
if interpreter == "" && buildcfg.GO_LDSO != "" {
1753+
if interpreter == "" && buildcfg.GOOS == runtime.GOOS && buildcfg.GOARCH == runtime.GOARCH && buildcfg.GO_LDSO != "" {
17531754
interpreter = buildcfg.GO_LDSO
17541755
}
17551756

0 commit comments

Comments
 (0)