Commit 152dddee authored by Dmitri Goutnik's avatar Dmitri Goutnik Committed by Tobias Klauser

cmd/link: switch to ld.bfd on freebsd/arm64

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: default avatarTobias Klauser <tobias.klauser@gmail.com>
parent 1f3339f4
...@@ -1294,6 +1294,19 @@ func (ctxt *Link) hostlink() { ...@@ -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 { if ctxt.IsELF && len(buildinfo) > 0 {
argv = append(argv, fmt.Sprintf("-Wl,--build-id=0x%x", buildinfo)) argv = append(argv, fmt.Sprintf("-Wl,--build-id=0x%x", buildinfo))
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment