aboutsummaryrefslogtreecommitdiff
path: root/go/go_target
diff options
context:
space:
mode:
Diffstat (limited to 'go/go_target')
-rwxr-xr-xgo/go_target32
1 files changed, 8 insertions, 24 deletions
diff --git a/go/go_target b/go/go_target
index 05786377..8943d813 100755
--- a/go/go_target
+++ b/go/go_target
@@ -4,7 +4,7 @@ set -e -o pipefail
# This script wraps the go cross compilers.
#
# It ensures that Go binaries are linked with an external linker
-# by default (cross gcc). Appropriate flags are added to build a
+# by default (cross clang). Appropriate flags are added to build a
# position independent executable (PIE) for ASLR.
# "export GOPIE=0" to temporarily disable this behavior.
@@ -36,44 +36,28 @@ then
case "$1" in
build | install | run | test)
# Add "-buildmode=pie" to "go build|install|run|test" commands.
- pie_flags=(
- "$1"
- "-buildmode=pie"
- )
+ pie_flags=( "$1" )
shift
+ [[ "${GOOS}" == "android" ]] || pie_flags+=( "-buildmode=pie" )
;;
tool)
case "$2" in
asm)
# Handle direct assembler invocations ("go tool asm <args>").
- pie_flags=(
- "$1"
- "$2"
- "-shared"
- )
+ pie_flags=( "$1" "$2" "-shared" )
shift 2
;;
compile)
# Handle direct compiler invocations ("go tool compile <args>").
- pie_flags=(
- "$1"
- "$2"
- "-shared"
- "-installsuffix=shared"
- )
+ pie_flags=( "$1" "$2" "-shared" )
shift 2
+ [[ "${GOOS}" == "android" ]] || pie_flags+=( "-installsuffix=shared" )
;;
link)
# Handle direct linker invocations ("go tool link <args>").
- pie_flags=(
- "$1"
- "$2"
- "-installsuffix=shared"
- "-buildmode=pie"
- "-extld"
- "${CC}"
- )
+ pie_flags=( "$1" "$2" "-extld" "${CC}" "-buildmode=pie" )
shift 2
+ [[ "${GOOS}" == "android" ]] || pie_flags+=( "-installsuffix=shared" )
;;
esac
;;