aboutsummaryrefslogtreecommitdiffstats
path: root/build-gcc.sh
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2015-11-09 17:18:36 (GMT)
committerThan McIntosh <thanm@google.com>2015-11-09 18:30:57 (GMT)
commitf1cf57daa44f9c2f4921e7f520c2258421c44998 (patch)
treeb899c51aa5c2d101f1c1ee116b0301aad6d87f30 /build-gcc.sh
parent6239c1ee0bd05602de249f99c7dbf30bc761cb2d (diff)
downloadtoolchain_gcc-f1cf57daa44f9c2f4921e7f520c2258421c44998.zip
toolchain_gcc-f1cf57daa44f9c2f4921e7f520c2258421c44998.tar.gz
toolchain_gcc-f1cf57daa44f9c2f4921e7f520c2258421c44998.tar.bz2
Use symlink in /tmp to obscure sysroot prefix.
Create a link in /tmp to the prebuilt sysroot and pass the link location to the gcc configure script; this is intended to avoid hard-coding buildbot pathnames into the gcc binary. Bug: 25513824 Change-Id: I49dddde6f91a9737a8b8a27802acfc7133dd63af
Diffstat (limited to 'build-gcc.sh')
-rwxr-xr-xbuild-gcc.sh29
1 files changed, 26 insertions, 3 deletions
diff --git a/build-gcc.sh b/build-gcc.sh
index cecc535..1203fa1 100755
--- a/build-gcc.sh
+++ b/build-gcc.sh
@@ -76,6 +76,9 @@ register_var_option "--enable-languages=<name>" ENABLE_LANGUAGES "Experimental:
BUILD_DEBUGGABLE="no"
register_var_option "--build-debuggable=<yes|no>" BUILD_DEBUGGABLE "Experimental: build debuggable version of gcc"
+OBSCURE_PREFIX="yes"
+register_var_option "--obscure-prefix=<yes|no>" OBSCURE_PREFIX "Experimental: obscure sysroot prefix dir by linking to it from /tmp"
+
register_jobs_option
register_canadian_option
@@ -214,6 +217,21 @@ if [ $? != 0 ] ; then
exit 1
fi
+PREFIX_LOCATION=$TOOLCHAIN_INSTALL_PATH
+BUILD_SYSROOT_LOCATION=$TOOLCHAIN_BUILD_SYSROOT
+
+# If enabled, use symbolic link to obscure prefix location (b/25513824)
+if [ "$OBSCURE_PREFIX" == "yes" ]; then
+ TAG=`echo $ARGV $$ $RELEASE | md5sum | cut -f1 -d" "`
+ rm -f /tmp/$TAG
+ ln -s $PREFIX_LOCATION /tmp/$TAG
+ PREFIX_LOCATION=/tmp/$TAG
+ BUILD_SYSROOT_LOCATION=/tmp/$TAG/sysroot
+elif [ "$OBSCURE_PREFIX" != "no" ]; then
+ echo "error: illegal value for --obscure-prefix option (must be 'yes' or 'no')"
+ exit 1
+fi
+
# configure the toolchain
#
dump "Configure: $TOOLCHAIN toolchain build"
@@ -366,15 +384,15 @@ $BUILD_SRCDIR/configure --target=$ABI_CONFIGURE_TARGET \
--host=$ABI_CONFIGURE_HOST \
--build=$ABI_CONFIGURE_BUILD \
--disable-nls \
- --prefix=$TOOLCHAIN_INSTALL_PATH \
- --with-sysroot=$TOOLCHAIN_BUILD_SYSROOT \
+ --prefix=$PREFIX_LOCATION \
+ --with-sysroot=$BUILD_SYSROOT_LOCATION \
--with-binutils-version=$BINUTILS_VERSION \
--with-mpfr-version=$MPFR_VERSION \
--with-mpc-version=$MPC_VERSION \
--with-gmp-version=$GMP_VERSION \
--with-gcc-version=$CONFIGURE_GCC_VERSION \
--with-gdb-version=none \
- --with-gxx-include-dir=$TOOLCHAIN_INSTALL_PATH/include/c++/$GCC_VERSION \
+ --with-gxx-include-dir=$PREFIX_LOCATION/include/c++/$GCC_VERSION \
--with-bugurl=$DEFAULT_ISSUE_TRACKER_URL \
--enable-languages=$ENABLE_LANGUAGES \
$EXTRA_CONFIG_FLAGS \
@@ -471,6 +489,11 @@ fi
# remove sysroot
run rm -rf "$TOOLCHAIN_INSTALL_PATH/sysroot"
+# clean up link in /tmp if needed
+if [ "$OBSCURE_PREFIX" == "yes" ]; then
+ rm -f $PREFIX_LOCATION
+fi
+
# Remove libstdc++ for now (will add it differently later)
# We had to build it to get libsupc++ which we keep.
run rm -rf $TOOLCHAIN_INSTALL_PATH/$ABI_CONFIGURE_TARGET/lib/libstdc++.*