chiark / gitweb /
php: Update from 7.2.4 to 7.2.5
[termux-packages] / scripts / clang-pie-wrapper
1 #!/bin/bash
2
3 force_fPIE=1
4 force_pie=1
5
6 for opt; do
7         case "$opt" in
8         -fno-PIC|-fno-pic|-fno-PIE|-fno-pie|-nopie|-static|--static|-shared|--shared|-D__KERNEL__|-nostdlib|-nostartfiles|-mcmodel=kernel|-v|--version|-M*)
9                 force_fPIE=0
10                 force_pie=0
11                 ;;
12         -fPIC|-fpic|-fPIE|-fpie)
13                 force_fPIE=0
14                 ;;
15         -c|-E|-S)
16                 force_pie=0
17                 ;;
18         esac
19 done
20
21 arguments=()
22 (( $force_fPIE )) && arguments+=(-fPIE)
23 (( $force_pie )) && arguments+=(-pie)
24
25 # The ordinary wrapper from a NDK standalone toolchain
26 # with "${arguments[@]}" added.
27 if [ "$1" != "-cc1" ]; then
28     `dirname $0`/COMPILER -target CLANG_TARGET --sysroot `dirname $0`/../sysroot "${arguments[@]}" "$@"
29 else
30     # target/triple already spelled out.
31     `dirname $0`/COMPILER "${arguments[@]}" "$@"
32 fi