2017-01-15 21:13:22 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
force_fPIE=1
|
|
|
|
force_pie=1
|
|
|
|
|
|
|
|
for opt; do
|
|
|
|
case "$opt" in
|
|
|
|
-fno-PIC|-fno-pic|-fno-PIE|-fno-pie|-nopie|-static|--static|-shared|--shared|-D__KERNEL__|-nostdlib|-nostartfiles|-mcmodel=kernel|-v|--version|-M*)
|
|
|
|
force_fPIE=0
|
|
|
|
force_pie=0
|
|
|
|
;;
|
|
|
|
-fPIC|-fpic|-fPIE|-fpie)
|
|
|
|
force_fPIE=0
|
|
|
|
;;
|
|
|
|
-c|-E|-S)
|
|
|
|
force_pie=0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
arguments=()
|
|
|
|
(( $force_fPIE )) && arguments+=(-fPIE)
|
|
|
|
(( $force_pie )) && arguments+=(-pie)
|
|
|
|
|
|
|
|
# The ordinary wrapper from a NDK standalone toolchain
|
|
|
|
# with "${arguments[@]}" added.
|
|
|
|
if [ "$1" != "-cc1" ]; then
|
2017-01-17 17:31:24 +01:00
|
|
|
`dirname $0`/COMPILER -target CLANG_TARGET --sysroot `dirname $0`/../sysroot "${arguments[@]}" "$@"
|
2017-01-15 21:13:22 +01:00
|
|
|
else
|
|
|
|
# target/triple already spelled out.
|
|
|
|
`dirname $0`/COMPILER "${arguments[@]}" "$@"
|
|
|
|
fi
|