Repository: go
Issue: all: support native build on Android
Labels: NeedsInvestigation,FeatureRequest,mobile

<!--
Please answer these questions before submitting your issue. Thanks!
For questions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.16.7 android/arm64
</pre>

### Does this issue reproduce with the latest release?



### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/data/data/com.termux/files/home/.cache/go-build"
GOENV="/data/data/com.termux/files/home/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="android"
GOINSECURE=""
GOMODCACHE="/data/data/com.termux/files/home/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="android"
GOPATH="/data/data/com.termux/files/home/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/data/data/com.termux/files/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/data/data/com.termux/files/usr/lib/go/pkg/tool/android_arm64"
GOVCS=""
GOVERSION="go1.16.7"
GCCGO="gccgo"
AR="ar"
CC="aarch64-linux-android-clang"
CXX="aarch64-linux-android-clang++"
CGO_ENABLED="1"
GOMOD="/data/data/com.termux/files/home/Applications/go/src/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/data/data/com.termux/files/usr/tmp/go-build2204854682=/tmp/go-build -gno-record-gcc-switches"
</pre></details>

### What did you do?

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->

```bash
./make.bash
```

### What did you expect to see?

```log
Installed Go for android/arm64 in /data/data/com.termux/files/home/Applications/go
Installed commands in /data/data/com.termux/files/home/Applications/go/bin
```

### What did you see instead?

```log
Building Go cmd/dist using /data/data/com.termux/files/usr/lib/go. (go1.16.7 android/arm64)
Building Go toolchain1 using /data/data/com.termux/files/usr/lib/go.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for android/arm64.
# runtime/cgo
/data/data/com.termux/files/usr/bin/ld: /system/lib64/liblog.so: unknown type [0x13] section `.relr.dyn'
/data/data/com.termux/files/usr/bin/ld: skipping incompatible /system/lib64/liblog.so when searching for -llog
/data/data/com.termux/files/usr/bin/ld: /system/lib64/liblog.so: unknown type [0x13] section `.relr.dyn'
/data/data/com.termux/files/usr/bin/ld: skipping incompatible /system/lib64/liblog.so when searching for -llog
/data/data/com.termux/files/usr/bin/ld: cannot find -llog
/data/data/com.termux/files/usr/bin/ld: /system/lib64/liblog.so: unknown type [0x13] section `.relr.dyn'
/data/data/com.termux/files/usr/bin/ld: skipping incompatible /system/lib64/liblog.so when searching for -llog
/data/data/com.termux/files/usr/bin/ld: /system/lib64/liblog.so: unknown type [0x13] section `.relr.dyn'
/data/data/com.termux/files/usr/bin/ld: skipping incompatible /system/lib64/liblog.so when searching for -llog
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
go tool dist: FAILED: /data/data/com.termux/files/home/Applications/go/pkg/tool/android_arm64/go_bootstrap install -gcflags=all= -ldflags=all= std cmd: exit status 2
```