termux-packages/scripts/clang-pie-wrapper

33 lines
747 B
Plaintext
Raw Normal View History

#!/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
`dirname $0`/COMPILER -target CLANG_TARGET --sysroot `dirname $0`/../sysroot "${arguments[@]}" "$@"
else
# target/triple already spelled out.
`dirname $0`/COMPILER "${arguments[@]}" "$@"
fi