summaryrefslogtreecommitdiffstats
path: root/compat32-tools/gccwrapper
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2009-09-14 10:35:02 +0000
committer Eric Hameleers <alien@slackware.com>2009-09-14 10:35:02 +0000
commit962b7aa0e9d564f4491b1ea3531643f19361774d (patch)
tree141095bb64410228ac5db9bd5dfc9877144df90f /compat32-tools/gccwrapper
parent0608f99b26235a4fdee629b82bc5c70f33f8e12d (diff)
downloadmultilib-962b7aa0e9d564f4491b1ea3531643f19361774d.tar.gz
multilib-962b7aa0e9d564f4491b1ea3531643f19361774d.tar.xz
Initial revision
Diffstat (limited to 'compat32-tools/gccwrapper')
-rwxr-xr-xcompat32-tools/gccwrapper33
1 files changed, 33 insertions, 0 deletions
diff --git a/compat32-tools/gccwrapper b/compat32-tools/gccwrapper
new file mode 100755
index 0000000..96b6c37
--- /dev/null
+++ b/compat32-tools/gccwrapper
@@ -0,0 +1,33 @@
+#!/bin/bash
+# $Id$
+# Copyright (C) 2007 Frederick Emmott <mail@fredemmott.co.uk>
+# Copyright 2009 Eric Hameleers, Eindhoven, NL
+# Based on the file with the same name which is part of
+# 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 -m64 from $@ (this is sometimes added even though we specify -m32)
+declare -a Arguments
+for i; do
+ case "$i" in
+ -m64)
+ ;;
+ *)
+ Arguments[${#Arguments[@]}]="$i"
+ ;;
+ esac
+done
+
+# Compiling a 32bit program requires we call gcc with -m32
+$REALCC -m32 "${Arguments[@]}"
+
+# Exit with $REALCC's exit code
+exit $?