mirror of https://github.com/golang/go.git
cmd/dist: set buildmode=pie on Android
Android refuses to run non-PIE binaries, a restriction already encoded in the cmd/go tool's buildModeInit function. This CL adds the necessary flags to cmd/dist to make ./make.bash run on an Android device. Change-Id: I162084f573befaa41dcb47a2b78448bce5b83d35 Reviewed-on: https://go-review.googlesource.com/c/go/+/170943 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
This commit is contained in:
parent
00530918db
commit
81c7beb04e
|
|
@ -657,7 +657,11 @@ func runInstall(dir string, ch chan struct{}) {
|
||||||
if elem == "go" {
|
if elem == "go" {
|
||||||
elem = "go_bootstrap"
|
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
|
targ = len(link) - 1
|
||||||
}
|
}
|
||||||
ttarg := mtime(link[targ])
|
ttarg := mtime(link[targ])
|
||||||
|
|
@ -862,6 +866,9 @@ func runInstall(dir string, ch chan struct{}) {
|
||||||
// compiler to generate ABI wrappers for everything.
|
// compiler to generate ABI wrappers for everything.
|
||||||
compile = append(compile, "-allabis")
|
compile = append(compile, "-allabis")
|
||||||
}
|
}
|
||||||
|
if goos == "android" {
|
||||||
|
compile = append(compile, "-shared")
|
||||||
|
}
|
||||||
|
|
||||||
compile = append(compile, gofiles...)
|
compile = append(compile, gofiles...)
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue