From 95b3f8b773f19dbd125cfd684d1617835d6c6cb0 Mon Sep 17 00:00:00 2001 From: Diego Elio Pettenò Date: Sat, 26 Jan 2013 06:48:14 -0800 Subject: Update the --as-needed specs hacking so that it works with hardened toolchain. Previously, this caused the --as-needed hack to be applied over and over and over again every time a GCC was to be rebuilt for whatever reason. Now it'll only be applied once. --- tinderbox-restart.sh | 2 +- update-gcc-asneeded.sh | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tinderbox-restart.sh b/tinderbox-restart.sh index b2c89ad..2d555a9 100755 --- a/tinderbox-restart.sh +++ b/tinderbox-restart.sh @@ -49,7 +49,7 @@ reset_emergelog emerge -Nu1 sys-apps/portage emerge -Nu1 sys-devel/gcc -if fgrep -q '>>> emerge' /var/log/emerge.log && gcc-config -l | tail -n 1 | grep -v asneeded; then +if fgrep -q '>>> emerge' /var/log/emerge.log; then ${tboxdir}/update-gcc-asneeded.sh exit 0 fi diff --git a/update-gcc-asneeded.sh b/update-gcc-asneeded.sh index 38f5717..31c348c 100755 --- a/update-gcc-asneeded.sh +++ b/update-gcc-asneeded.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright © 2007-2010 Diego Elio Pettenò +# Copyright © 2007-2013 Diego Elio Pettenò # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -15,9 +15,15 @@ # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS # SOFTWARE. -export SPECSFILE=$(dirname "$(gcc -print-libgcc-file-name)")/asneeded.specs -export CURRPROFILE=/etc/env.d/gcc/$(gcc-config -c) -gcc -dumpspecs | sed -e '/link:/,+1 s:--eh-frame-hdr:\0 --as-needed:' > "$SPECSFILE" -sed "${CURRPROFILE}" -e '1i\GCC_SPECS='$SPECSFILE > "${CURRPROFILE}-asneeded" -gcc-config "$(basename "${CURRPROFILE}")-asneeded" -source /etc/profile +SPECSFILE=$(dirname "$(gcc -print-libgcc-file-name)")/asneeded.specs +CURRPROFILE=$(gcc-config -c) +PROFILEFILE=/etc/env.d/gcc/$(gcc-config -c) + +# only proceed with the changes if we're not already on an asneeded +# profile. +if [ ${CURRPROFILE/asneeded} = ${CURRPROFILE} ]; then + gcc -dumpspecs | sed -e '/link:/,+1 s:--eh-frame-hdr:\0 --as-needed:' > "$SPECSFILE" + sed "${PROFILEFILE}" -e '1i\GCC_SPECS='$SPECSFILE > "${PROFILEFILE}-asneeded" + gcc-config "${CURRPROFILE}-asneeded" + source /etc/profile +fi -- cgit v1.2.3-65-gdbad