cmd/go: -buildmode=pie for android/arm

Also make PIE executables the default build mode, as PIE executables
are required as of Android L.

For #10807

Change-Id: I86b7556b9792105cd2531df1b8f3c8f7a8c5d25c
Reviewed-on: https://go-review.googlesource.com/16055
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
David Crawshaw 2015-10-19 12:54:38 -04:00
parent 26205cb3c0
commit 17a256bf22
1 changed files with 19 additions and 1 deletions

View File

@ -353,10 +353,28 @@ func buildModeInit() {
}
ldBuildmode = "c-shared"
case "default":
ldBuildmode = "exe"
switch platform {
case "android/arm":
codegenArg = "-shared"
ldBuildmode = "pie"
default:
ldBuildmode = "exe"
}
case "exe":
pkgsFilter = pkgsMain
ldBuildmode = "exe"
case "pie":
if gccgo {
fatalf("-buildmode=pie not supported by gccgo")
} else {
switch platform {
case "android/arm":
codegenArg = "-shared"
default:
fatalf("-buildmode=pie not supported on %s\n", platform)
}
}
ldBuildmode = "pie"
case "shared":
pkgsFilter = pkgsNotMain
if gccgo {