From f1cf57daa44f9c2f4921e7f520c2258421c44998 Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Mon, 9 Nov 2015 12:18:36 -0500 Subject: 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 --- build-gcc.sh | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'build-gcc.sh') diff --git a/build-gcc.sh b/build-gcc.sh index cecc53594..1203fa194 100755 --- a/build-gcc.sh +++ b/build-gcc.sh @@ -76,6 +76,9 @@ register_var_option "--enable-languages=" ENABLE_LANGUAGES "Experimental: BUILD_DEBUGGABLE="no" register_var_option "--build-debuggable=" BUILD_DEBUGGABLE "Experimental: build debuggable version of gcc" +OBSCURE_PREFIX="yes" +register_var_option "--obscure-prefix=" 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++.* -- cgit v1.2.3