]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: ensure -fuse-ld=gold uses gold
authorDavid Crawshaw <crawshaw@golang.org>
Tue, 24 May 2016 17:40:02 +0000 (13:40 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Tue, 24 May 2016 18:56:11 +0000 (18:56 +0000)
Fixes #15696

Change-Id: I134e918dc56f79a72a04aa54f415371884113d2a
Reviewed-on: https://go-review.googlesource.com/23400
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/link/internal/ld/lib.go

index 4fff35c38e0633f27322f720d60aa04292794113..3860287e6760333bbc1bb1367b5a0e492a3a1b29 100644 (file)
@@ -1137,6 +1137,16 @@ func hostlink() {
                        //
                        // In both cases, switch to gold.
                        argv = append(argv, "-fuse-ld=gold")
+
+                       // If gold is not installed, gcc will silently switch
+                       // back to ld.bfd. So we parse the version information
+                       // and provide a useful error if gold is missing.
+                       cmd := exec.Command(extld, "-fuse-ld=gold", "-Wl,--version")
+                       if out, err := cmd.CombinedOutput(); err != nil {
+                               if !bytes.Contains(out, []byte("GNU gold")) {
+                                       log.Fatalf("ARM external linker must be gold (issue #15696), but is not: %s", out)
+                               }
+                       }
                }
        }