diff options
| author | qmuntal <quimmuntal@gmail.com> | 2025-02-03 21:05:51 +0100 |
|---|---|---|
| committer | Quim Muntal <quimmuntal@gmail.com> | 2025-02-06 09:10:09 -0800 |
| commit | 65004c7bf4a1193af7742a6de9bc515c4b07bb75 (patch) | |
| tree | 751fa68a3da7535171f69a19dfca755d11c72d6e /src | |
| parent | cd595be6d669af171bc28bdc939cc36785717718 (diff) | |
| download | go-65004c7bf4a1193af7742a6de9bc515c4b07bb75.tar.xz | |
cmd/go: report gcc ld error message when linking fails
The output of the gcc ld command is useful to understand why a package
that uses cgo can't use internal linking. We should log it.
Change-Id: Id524065fc5348be57387f2b67d1e00861f9adf15
Reviewed-on: https://go-review.googlesource.com/c/go/+/646315
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/go/internal/work/exec.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index c79d6f73ef..8e5d481033 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -2208,7 +2208,7 @@ func (b *Builder) gccld(a *Action, objdir, outfile string, flags []string, objs } cmdargs := []any{cmd, "-o", outfile, objs, flags} - _, err := sh.runOut(base.Cwd(), b.cCompilerEnv(), cmdargs...) + out, err := sh.runOut(base.Cwd(), b.cCompilerEnv(), cmdargs...) // Note that failure is an expected outcome here, so we report output only // in debug mode and don't report the error. @@ -2217,7 +2217,7 @@ func (b *Builder) gccld(a *Action, objdir, outfile string, flags []string, objs if err != nil { saw = "failed" } - sh.ShowCmd("", "%s # test for internal linking errors (%s)", joinUnambiguously(str.StringList(cmdargs...)), saw) + sh.ShowCmd("", "%s # test for internal linking errors (%s)\n%s", joinUnambiguously(str.StringList(cmdargs...)), saw, out) } return err |
