]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: extend the linker -o workaround for plugins to all platforms
authorCherry Mui <cherryyz@google.com>
Tue, 21 Mar 2023 20:27:14 +0000 (16:27 -0400)
committerCherry Mui <cherryyz@google.com>
Tue, 21 Mar 2023 20:57:28 +0000 (20:57 +0000)
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 <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/cmd/go/internal/work/gc.go

index c144413f85f7e0ecffa73d528770b19f6341969b..4f6f18ee1d8309c7c2260c25a788e50b94172a7e 100644 (file)
@@ -683,8 +683,10 @@ func (gcToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string)
        // just the final path element.
        // On Windows, DLL file name is recorded in PE file
        // export section, so do like on OS X.
+       // On Linux, for a shared object, at least with the Gold linker,
+       // the output file path is recorded in the .gnu.version_d section.
        dir := "."
-       if (cfg.Goos == "darwin" || cfg.Goos == "windows") && (cfg.BuildBuildmode == "c-shared" || cfg.BuildBuildmode == "plugin") {
+       if cfg.BuildBuildmode == "c-shared" || cfg.BuildBuildmode == "plugin" {
                dir, out = filepath.Split(out)
        }