diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index e5d4b2458a23f577cf595fbe1938bafb853cb44e..fec3b2cedc833b8fc4e8461d3edea13720835512 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -657,7 +657,11 @@ func runInstall(dir string, ch chan struct{}) {
 		if elem == "go" {
 			elem = "go_bootstrap"
 		}
-		link = []string{pathf("%s/link", tooldir), "-o", pathf("%s/%s%s", tooldir, elem, exe)}
+		link = []string{pathf("%s/link", tooldir)}
+		if goos == "android" {
+			link = append(link, "-buildmode=pie")
+		}
+		link = append(link, "-o", pathf("%s/%s%s", tooldir, elem, exe))
 		targ = len(link) - 1
 	}
 	ttarg := mtime(link[targ])
@@ -862,6 +866,9 @@ func runInstall(dir string, ch chan struct{}) {
 		// compiler to generate ABI wrappers for everything.
 		compile = append(compile, "-allabis")
 	}
+	if goos == "android" {
+		compile = append(compile, "-shared")
+	}
 
 	compile = append(compile, gofiles...)
 	var wg sync.WaitGroup