Skip to content

Commit 3aa7ada

Browse files
committed
cmd/go: extend the linker -o workaround for plugins to all platforms
On Linux, for a shared object, at least with the Gold linker, the output file path is recorded in the .gnu.version_d section. When the output file path is in a temporary directory, it causes nondeterministic build. This is similar to #58557, but for Linux with the Gold linker. Apply the same workaround as in CL 477296. Should fix the linux-arm64-longtest builder. Change-Id: Ic703bff32c1bcc40054b89be696e04280855e876 Reviewed-on: https://go-review.googlesource.com/c/go/+/478196 Run-TryBot: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Bryan Mills <[email protected]>
1 parent eedd97d commit 3aa7ada

File tree

1 file changed

+3
-1
lines changed
  • src/cmd/go/internal/work

1 file changed

+3
-1
lines changed

src/cmd/go/internal/work/gc.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,10 @@ func (gcToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string)
683683
// just the final path element.
684684
// On Windows, DLL file name is recorded in PE file
685685
// export section, so do like on OS X.
686+
// On Linux, for a shared object, at least with the Gold linker,
687+
// the output file path is recorded in the .gnu.version_d section.
686688
dir := "."
687-
if (cfg.Goos == "darwin" || cfg.Goos == "windows") && (cfg.BuildBuildmode == "c-shared" || cfg.BuildBuildmode == "plugin") {
689+
if cfg.BuildBuildmode == "c-shared" || cfg.BuildBuildmode == "plugin" {
688690
dir, out = filepath.Split(out)
689691
}
690692

0 commit comments

Comments
 (0)