Ah yes, thanks. I forgot that the kernel version string includes the compiler used. I suppose the compiler used to build the kernel explains why the two compilers are supplied - although not why the old one is the default. It also makes me wonder what it is about the newer gcc which prevents it being used for kernel build...

It sounds easy to say 'use gcc6 for my own code', but in practice it is a bit tedious to have a special case on SUSE if you are trying to maintain a lot of software on a lot of different platforms. If I rsync my source tree to do a test build on SUSE, there would be a lot of makefiles to customize.

As a work around, I created the following script to switch the default between the two compilers:


#!/bin/sh
# Switch default compiler between 4.8 and 6
#

if [ "$#" != "1" ] ;then
arg=help
else
arg=$1
fi

case "$arg" in
orig) VER=4.8 ;;
new) VER=6 ;;
*)

echo "Usage: $0 {orig|new}"
exit 1 ;;
esac

echo "Switching to compiler version $VER"
cd /usr/bin
for LINK in gcov g++ gcc gcc-ar gcc-nm gcc-ranlib cpp c++ cc
do
TGT=$LINK
[ "$TGT" = "c++" ] && TGT=g++
[ "$TGT" = "cc" ] && TGT=gcc
echo SETTING UP $LINK to $TGT-$VER
rm -f $LINK
ln -s $TGT-$VER $LINK
done

Now I just need to remember to switch defaults back to the old compiler when I do kernel builds...