Skip to content

Commit 26d0b00

Browse files
committed
cmd/go: enable android/amd64 build.
For #10743 Change-Id: Iec047821147a0e28edebf875fefe25993785702b Reviewed-on: https://go-review.googlesource.com/15994 Reviewed-by: David Crawshaw <crawshaw@golang.org>
1 parent dfc8649 commit 26d0b00

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

misc/cgo/testcshared/test.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ GOPATH=$(pwd) go install -buildmode=c-shared $suffix libgo
8181
GOPATH=$(pwd) go build -buildmode=c-shared $suffix -o libgo.$libext src/libgo/libgo.go
8282
binpush libgo.$libext
8383

84-
if [ "$goos" == "linux" ]; then
84+
if [ "$goos" == "linux" ] || [ "$goos" == "android" ] ; then
8585
if readelf -d libgo.$libext | grep TEXTREL >/dev/null; then
8686
echo "libgo.$libext has TEXTREL set"
8787
exit 1

src/cmd/go/build.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ func buildModeInit() {
350350
codegenArg = "-fPIC"
351351
} else {
352352
switch platform {
353-
case "linux/amd64", "linux/arm", "android/arm":
353+
case "linux/amd64", "linux/arm",
354+
"android/amd64", "android/arm":
354355
codegenArg = "-shared"
355356
case "darwin/amd64":
356357
default:
@@ -3075,7 +3076,7 @@ func (b *builder) cgo(p *Package, cgoExe, obj string, pcCFLAGS, pcLDFLAGS, cgofi
30753076

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

0 commit comments

Comments
 (0)