1
0
mirror of https://github.com/golang/go synced 2024-11-18 08:04:40 -07:00

cmd/link/internal/ld/lib.go: use lld on Android

Set linker explicitly to lld because the default does not work on NDK versions
20.0, 20.1, 21.0 and 21.1. NDK 17c (or earlier) based builds will need to
specify -fuse-ld=gold.

Fixes #38838
This commit is contained in:
Paul D. Weber 2020-05-22 21:33:59 +02:00
parent bcda68447b
commit eeaa171604

View 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.