Wrappers to invoke between 32-/64-bit prebuilt linux toolchain for SDK

The folder gcc-sdk contains wrappers to invoke either
prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6 or
x86_64-linux-glibc2.7-4.6 based on the presence of -m32 or -m64
(default) in command line options.

Changes for the following to use these will be submitted later
(in different git)
1) build/core/combo/HOST_linux-x86.mk
2) external/qemu/android-configure.sh
3) external/qemu/Makefile.android

Only gcc, g++ and ar are exercised by the above scripts.

Change-Id: I45dc3a496ebd396b65885bd8994f397f80ca99e6
diff --git a/gcc-sdk/addr2line b/gcc-sdk/addr2line
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/addr2line
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/ar b/gcc-sdk/ar
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/ar
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/as b/gcc-sdk/as
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/as
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/c++ b/gcc-sdk/c++
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/c++
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/c++filt b/gcc-sdk/c++filt
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/c++filt
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/cpp b/gcc-sdk/cpp
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/cpp
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/elfedit b/gcc-sdk/elfedit
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/elfedit
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/g++ b/gcc-sdk/g++
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/g++
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/gcc b/gcc-sdk/gcc
new file mode 100755
index 0000000..eac1c47
--- /dev/null
+++ b/gcc-sdk/gcc
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+HOST_OS=`uname -s | tr '[:upper:]' '[:lower:]'`
+if [ "$HOST_OS" != "linux" ] ; then
+  echo "ERROR: The gcc this script points to can only run on linux"
+  exit 1
+fi
+
+PROGNAME=`basename $0`
+
+#PREFIX32=../../gcc/linux-x86/host/i686-linux-glibc2.7-4.4.3/bin/i686-linux  # previous version
+PREFIX32=../../gcc/linux-x86/host/i686-linux-glibc2.7-4.6/bin/i686-linux
+PREFIX64=../../gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/bin/x86_64-linux
+
+options=" ${@} "   # sentinel prefix/suffix space to simplify pattern match below
+
+suffix_m32=${options##* -m32 }    # suffix after the last -m32
+suffix_m64=${options##* -m64 }    # suffix after the last -m64
+
+len_m32=${#suffix_m32}            # length of suffix after the last -m32
+len_m64=${#suffix_m64}            # length of suffix after the last -m64
+
+if [ $len_m32 -ge $len_m64 ] ; then
+  # Choose 64-bit if -m64 only, -m64 appears after -m32, or neither exist (-eq)
+  MY_TOOL=`dirname $0`/${PREFIX64}-${PROGNAME}
+  # Make sure host is running 64-bit OS.
+  # Note that "uname -m" only show host CPU is capable of.  Use the following technique
+  # from ndk/build/core/ndk-common.sh instead
+  file -L "$SHELL" | grep -q "x86[_-]64"
+  if [ $? != 0 ]; then
+    # $SHELL is not a 64-bit executable, so assume our userland is too.
+    echo "ERROR: $MY_TOOL only run on 64-bit linux"
+    exit 1
+  fi
+else
+  # Otherwise, choose 32-bit
+  MY_TOOL=`dirname $0`/${PREFIX32}-${PROGNAME}
+fi
+
+$MY_TOOL "$@"
diff --git a/gcc-sdk/gcov b/gcc-sdk/gcov
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/gcov
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/gprof b/gcc-sdk/gprof
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/gprof
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/ld b/gcc-sdk/ld
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/ld
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/nm b/gcc-sdk/nm
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/nm
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/objcopy b/gcc-sdk/objcopy
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/objcopy
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/objdump b/gcc-sdk/objdump
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/objdump
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/ranlib b/gcc-sdk/ranlib
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/ranlib
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/readelf b/gcc-sdk/readelf
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/readelf
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/size b/gcc-sdk/size
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/size
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/strings b/gcc-sdk/strings
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/strings
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/gcc-sdk/strip b/gcc-sdk/strip
new file mode 120000
index 0000000..b08d5af
--- /dev/null
+++ b/gcc-sdk/strip
@@ -0,0 +1 @@
+gcc
\ No newline at end of file