]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link/internal/ld/lib.go: use lld on Android
authorPaul D. Weber <x0bdev@gmail.com>
Tue, 26 May 2020 07:00:30 +0000 (07:00 +0000)
committerIan Lance Taylor <iant@golang.org>
Tue, 26 May 2020 19:10:28 +0000 (19:10 +0000)
Set linker explicitly to lld because the default does not work on NDK
versions r19c, r20, r20b and r21. NDK 18b (or earlier) based builds
will need to specify -fuse-ld=gold.

Fixes #38838

Change-Id: Ib75f71fb9896b843910f41bd12aa1e36868fa9b3
GitHub-Last-Rev: eeaa171604b59d8ad3d86944ebf21ee758e92f95
GitHub-Pull-Request: golang/go#39217
Reviewed-on: https://go-review.googlesource.com/c/go/+/235017
Reviewed-by: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/link/internal/ld/lib.go

index 523a7992bb4168a067024be18bf7e332ee3783fe..707e664bd030dadcaa469dc8e83feed30bd7cc63 100644 (file)
@@ -1478,6 +1478,11 @@ func (ctxt *Link) hostlink() {
                // from the beginning of the section (like sym.STYPE).
                argv = append(argv, "-Wl,-znocopyreloc")
 
+               if objabi.GOOS == "android" {
+                       // Use lld to avoid errors from default linker (issue #38838)
+                       altLinker = "lld"
+               }
+
                if ctxt.Arch.InFamily(sys.ARM, sys.ARM64) && objabi.GOOS == "linux" {
                        // On ARM, the GNU linker will generate COPY relocations
                        // even with -znocopyreloc set.