]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: switch to ld.bfd on freebsd/arm64
authorDmitri Goutnik <dgoutnik@gmail.com>
Sun, 27 Oct 2019 17:22:02 +0000 (12:22 -0500)
committerTobias Klauser <tobias.klauser@gmail.com>
Mon, 28 Oct 2019 09:26:37 +0000 (09:26 +0000)
Updates golang/go#35197

Change-Id: I4fd85c84475761d71d2c17e62796e0a411cf91d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/203519
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
src/cmd/link/internal/ld/lib.go

index 1edf8cf4078fc76b8ab61acee777fc3c53797c32..a6fa14cc747854579bfb5c5ab6a86fa0dbd1d2e5 100644 (file)
@@ -1294,6 +1294,19 @@ func (ctxt *Link) hostlink() {
                }
        }
 
+       if ctxt.Arch.Family == sys.ARM64 && objabi.GOOS == "freebsd" {
+               // Switch to ld.bfd on freebsd/arm64.
+               argv = append(argv, "-fuse-ld=bfd")
+
+               // Provide a useful error if ld.bfd is missing.
+               cmd := exec.Command(*flagExtld, "-fuse-ld=bfd", "-Wl,--version")
+               if out, err := cmd.CombinedOutput(); err == nil {
+                       if !bytes.Contains(out, []byte("GNU ld")) {
+                               log.Fatalf("ARM64 external linker must be ld.bfd (issue #35197), please install devel/binutils")
+                       }
+               }
+       }
+
        if ctxt.IsELF && len(buildinfo) > 0 {
                argv = append(argv, fmt.Sprintf("-Wl,--build-id=0x%x", buildinfo))
        }