-
Notifications
You must be signed in to change notification settings - Fork 0
/
gccwrapper
executable file
·33 lines (27 loc) · 958 Bytes
/
gccwrapper
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# $Id: gccwrapper,v 1.1 2009/09/14 10:35:12 eha Exp eha $
# Copyright (C) 2007 Frederick Emmott <[email protected]>
# Copyright (C) 2009 Eric Hameleers, Eindhoven, NL
# Copyright (C) 2018 Ben Stern <[email protected]>
# Based on gccwrapper from the Slamd64 Linux project (www.slamd64.com)
# Distributed under the GNU General Public License, version 2, as published by
# the Free Software Foundation.
# Find the stub gcc's directory:
STUBPATH=$(cd $(dirname $0); pwd)
# Now find the "real" gcc
REALCC=$(PATH="$(echo $PATH | sed "s#\(.*\):\?$STUBPATH/\?:\?#\1#")" which $(basename $0))
# Filter out -m32 from $@ (this is sometimes added even though we specify -m64)
declare -a Arguments
for i; do
case "$i" in
-m32)
;;
*)
Arguments[${#Arguments[@]}]="$i"
;;
esac
done
# Compiling a 64-bit program requires we call gcc with -m64
$REALCC -m64 "${Arguments[@]}"
# Exit with $REALCC's exit code
exit $?