golang: update to v1.19.2
[feed/packages.git] / lang / golang / golang / patches / 001-cmd-link-use-gold-on-ARM-ARM64-only-if-gold-is-available.patch
index bfd861f2245a8d5513d8f1553f5c7c0cac04df31..7eb40a4749cd57faa5712610ed6489f2c9a0920d 100644 (file)
@@ -1,8 +1,19 @@
-This is https://github.com/golang/go/pull/49748 backported for Go 1.17.
+From 5ccf9f47bf4f5ba53e0ab7338a7fd4626714cfb2 Mon Sep 17 00:00:00 2001
+From: Jeffery To <jeffery.to@gmail.com>
+Date: Tue, 23 Nov 2021 15:05:37 +0800
+Subject: [PATCH] cmd/link: use gold on ARM/ARM64 only if gold is available
+
+COPY relocation handling on ARM/ARM64 has been fixed in recent versions
+of the GNU linker. This switches to gold only if gold is available.
+
+Fixes #22040.
+---
+ src/cmd/link/internal/ld/lib.go | 19 +++++++------------
+ 1 file changed, 7 insertions(+), 12 deletions(-)
 
 --- a/src/cmd/link/internal/ld/lib.go
 +++ b/src/cmd/link/internal/ld/lib.go
-@@ -1388,23 +1388,18 @@ func (ctxt *Link) hostlink() {
+@@ -1502,25 +1502,20 @@ func (ctxt *Link) hostlink() {
                }
  
                if ctxt.Arch.InFamily(sys.ARM, sys.ARM64) && buildcfg.GOOS == "linux" {
@@ -24,7 +35,9 @@ This is https://github.com/golang/go/pull/49748 backported for Go 1.17.
 -                      // back to ld.bfd. So we parse the version information
 -                      // and provide a useful error if gold is missing.
 +                      // In both cases, switch to gold if gold is available.
-                       cmd := exec.Command(*flagExtld, "-fuse-ld=gold", "-Wl,--version")
+                       name, args := flagExtld[0], flagExtld[1:]
+                       args = append(args, "-fuse-ld=gold", "-Wl,--version")
+                       cmd := exec.Command(name, args...)
                        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)