Skip to content

Commit

Permalink
cmd/go: enable android/amd64 build.
Browse files Browse the repository at this point in the history
For golang#10743

Change-Id: Iec047821147a0e28edebf875fefe25993785702b
Reviewed-on: https://go-review.googlesource.com/15994
Reviewed-by: David Crawshaw <[email protected]>
  • Loading branch information
hyangah committed Oct 28, 2015
1 parent dfc8649 commit 26d0b00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion misc/cgo/testcshared/test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ GOPATH=$(pwd) go install -buildmode=c-shared $suffix libgo
GOPATH=$(pwd) go build -buildmode=c-shared $suffix -o libgo.$libext src/libgo/libgo.go
binpush libgo.$libext

if [ "$goos" == "linux" ]; then
if [ "$goos" == "linux" ] || [ "$goos" == "android" ] ; then
if readelf -d libgo.$libext | grep TEXTREL >/dev/null; then
echo "libgo.$libext has TEXTREL set"
exit 1
Expand Down
5 changes: 3 additions & 2 deletions src/cmd/go/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ func buildModeInit() {
codegenArg = "-fPIC"
} else {
switch platform {
case "linux/amd64", "linux/arm", "android/arm":
case "linux/amd64", "linux/arm",
"android/amd64", "android/arm":
codegenArg = "-shared"
case "darwin/amd64":
default:
Expand Down Expand Up @@ -3075,7 +3076,7 @@ func (b *builder) cgo(p *Package, cgoExe, obj string, pcCFLAGS, pcLDFLAGS, cgofi

linkobj = append(linkobj, p.SysoFiles...)
dynobj := obj + "_cgo_.o"
pie := goarch == "arm" && (goos == "linux" || goos == "android")
pie := (goarch == "arm" && goos == "linux") || goos == "android"
if pie { // we need to use -pie for Linux/ARM to get accurate imported sym
cgoLDFLAGS = append(cgoLDFLAGS, "-pie")
}
Expand Down

0 comments on commit 26d0b00

Please sign in to comment.