env/corellium/android: fix testcshared tests on android/arm64

Using the lld linker fixes link errors such as:

--- FAIL: TestUnexportedSymbols (1.32s)
    cshared_test.go:378: run: [go build -buildmode=c-shared -installsuffix testcshared -o libgo2.a ./libgo2]
    cshared_test.go:392: command failed: [/data/data/com.termux/files/home/clangwrap -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/data/data/com.termux/files/home/tmpdir/workdir-host-android-arm64-corellium-android/tmp/go-build035435173=/tmp/go-build -gno-record-gcc-switches -pie -I pkg/android_arm64 -o testp2 main2.c -Wl,--no-as-needed libgo2.a]
        exit status 1
        /data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: /system/lib64/libc++.so: undefined reference to `strtof_l@LIBC_O'
        /data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: /system/lib64/libc++.so: undefined reference to `strtod_l@LIBC_O'
        clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

Change-Id: I73348bdba37e2758b810ac9ee2bad296fc2e6ab7
Reviewed-on: https://go-review.googlesource.com/c/build/+/207288
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/env/corellium/android/files/clangwrap.go b/env/corellium/android/files/clangwrap.go
index 7f17c48..0b4ed05 100644
--- a/env/corellium/android/files/clangwrap.go
+++ b/env/corellium/android/files/clangwrap.go
@@ -15,6 +15,8 @@
 	if os.Getenv("GOARCH") == "arm" {
 		pref := os.Getenv("PREFIX")
 		cmd.Args = append(cmd.Args, "-target", "armv7a-linux-androideabi", "-Qunused-arguments", "-Wl,-rpath-link="+pref+"/../home/arm-linux-androideabi/lib", "-L"+pref+"/../home/arm-linux-androideabi/lib", "-B"+pref+"/../home/arm-linux-androideabi/lib")
+	} else {
+		cmd.Args = append(cmd.Args, "-Qunused-arguments", "-fuse-ld=lld")
 	}
 	cmd.Args = append(cmd.Args, args...)
 	cmd.Stdout = os.Stdout
diff --git a/env/corellium/android/install.sh b/env/corellium/android/install.sh
index 8c227dd..74faa60 100755
--- a/env/corellium/android/install.sh
+++ b/env/corellium/android/install.sh
@@ -22,7 +22,7 @@
 adb root
 
 # Wait for the Termux filesystem.
-while adb shell ls /data/data/com.termux/files > /dev/null ; [ $? -ne 0 ]; do
+while adb shell ls /data/data/com.termux/files/home 2> /dev/null ; [ $? -ne 0 ]; do
 	sleep 1
 done
 
@@ -44,7 +44,7 @@
 # Run builder at boot.
 termux mkdir -p /data/data/com.termux/files/home/.termux/boot
 adb push files/run-builder-at-boot /data/data/com.termux/files/home/.termux/boot
-termux pkg install -y openssh tmux ndk-multilib clang git golang
+termux pkg install -y openssh tmux ndk-multilib clang git golang lld
 termux go build clangwrap.go
 
 # Move the arm 32-bit sysroot so 32-bit arm binaries use the Android