Currently in config.gcc, only the first multilib in a multilib list is checked 
for validity and the following elements are ignored due to the break which only 
breaks out of loop in shell. A loop is also done over the multilib list 
elements despite no combination being legal. This patch rework the code to 
address both issues.

ChangeLog entry is as follows:


2015-11-24  Thomas Preud'homme  <thomas.preudho...@arm.com>

        * config.gcc: Error out when conflicting multilib is detected.  Do not
        loop over multilibs since no combination is legal.


diff --git a/gcc/config.gcc b/gcc/config.gcc
index 59aee2c..be3c720 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3772,38 +3772,40 @@ case "${target}" in
                # Add extra multilibs
                if test "x$with_multilib_list" != x; then
                        arm_multilibs=`echo $with_multilib_list | sed -e 's/,/ 
/g'`
-                       for arm_multilib in ${arm_multilibs}; do
-                               case ${arm_multilib} in
-                               aprofile)
+                       case ${arm_multilibs} in
+                       aprofile)
                                # Note that arm/t-aprofile is a
                                # stand-alone make file fragment to be
                                # used only with itself.  We do not
                                # specifically use the
                                # TM_MULTILIB_OPTION framework because
                                # this shorthand is more
-                               # pragmatic. Additionally it is only
-                               # designed to work without any
-                               # with-cpu, with-arch with-mode
+                               # pragmatic.
+                               tmake_profile_file="arm/t-aprofile"
+                               ;;
+                       default)
+                               ;;
+                       *)
+                               echo "Error: 
--with-multilib-list=${with_multilib_list} not supported." 1>&2
+                               exit 1
+                               ;;
+                       esac
+
+                       if test "x${tmake_profile_file}" != x ; then
+                               # arm/t-aprofile is only designed to work
+                               # without any with-cpu, with-arch, with-mode,
                                # with-fpu or with-float options.
-                                       if test "x$with_arch" != x \
-                                           || test "x$with_cpu" != x \
-                                           || test "x$with_float" != x \
-                                           || test "x$with_fpu" != x \
-                                           || test "x$with_mode" != x ; then
-                                           echo "Error: You cannot use any of 
--with-arch/cpu/fpu/float/mode with --with-multilib-list=aprofile" 1>&2
-                                           exit 1
-                                       fi
-                                       tmake_file="${tmake_file} 
arm/t-aprofile"
-                                       break
-                                       ;;
-                               default)
-                                       ;;
-                               *)
-                                       echo "Error: 
--with-multilib-list=${with_multilib_list} not supported." 1>&2
-                                       exit 1
-                                       ;;
-                               esac
-                       done
+                               if test "x$with_arch" != x \
+                                   || test "x$with_cpu" != x \
+                                   || test "x$with_float" != x \
+                                   || test "x$with_fpu" != x \
+                                   || test "x$with_mode" != x ; then
+                                   echo "Error: You cannot use any of 
--with-arch/cpu/fpu/float/mode with --with-multilib-list=${arm_multilib}" 1>&2
+                                   exit 1
+                               fi
+
+                               tmake_file="${tmake_file} ${tmake_profile_file}"
+                       fi
                fi
                ;;


Tested with the following multilib lists:
  + foo -> "Error: --with-multilib-list=foo not supported" as expected
  + default,aprofile -> "Error: --with-multilib-list=default,aprofile not 
supported" as expected
  + aprofile,default -> "Error: --with-multilib-list=aprofile,default not 
supported" as expected
  + (nothing) -> libraries in $installdir/arm-none-eabi/lib{,fpu,thumb}
  + default -> libraries in $installdir/arm-none-eabi/lib{,fpu,thumb} as 
expected
  + aprofile -> $installdir/arm-none-eabi/lib contains all supported multilib

Is this ok for trunk?

Best regards,

Thomas

Reply via email to