summaryrefslogtreecommitdiff
path: root/toolchain/3rd-party-gcc.in
blob: e5e3af4f603ad8bfabde4dfb3ab7fe0e9d302917 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# Reject attempts to include or link host paths.
if echo " $* " | grep -qE '[[:space:]]-[IL][[:space:]]*(/+usr)?/+((local|X11R6)/+)?(include|lib)'; then
  echo "$0: poisoned host path detected: $*" >&2
  exit 1
fi

# Android only supports PIEs, but they don't set the default PIE behavior in
# the compiler, so we need to manually add the flags.
case " $* " in
*" -fPIC "*|*" -fpic "*|*" -fPIE "*|*" -fpie "*|*" -shared "*|*" -static "*|*" -pie "*) ;;
*) set -- -fpie -pie "$@"
esac

exec \
	"${ANDROID_TOOLCHAIN}/@CC@" \
	@CFLAGS@ \
	@LDFLAGS@ \
	--sysroot "${ANDROID_PRODUCT_OUT}/@ROOT_SUBDIR@" \
	-Wl,--enable-new-dtags,-rpath,/system/usr/@LIBDIR@ \
	"$@"