8146638: Only use compiler option files if they are really supported by the toolchain
authorsimonis
Fri, 08 Jan 2016 09:46:02 +0100
changeset 34864 47326b00e368
parent 34863 97ab91b2238f
child 34865 48ace55e16c5
8146638: Only use compiler option files if they are really supported by the toolchain Reviewed-by: erikj
common/autoconf/flags.m4
common/autoconf/generated-configure.sh
make/common/NativeCompilation.gmk
--- a/common/autoconf/flags.m4	Thu Jan 07 15:13:42 2016 -0800
+++ b/common/autoconf/flags.m4	Fri Jan 08 09:46:02 2016 +0100
@@ -128,6 +128,26 @@
   else
     COMPILER_TARGET_BITS_FLAG="-m"
     COMPILER_COMMAND_FILE_FLAG="@"
+
+    # The solstudio linker does not support @-files.
+    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
+      COMPILER_COMMAND_FILE_FLAG=
+    fi
+
+    # Check if @file is supported by gcc
+    if test "x$TOOLCHAIN_TYPE" = xgcc; then
+      AC_MSG_CHECKING([if @file is supported by gcc])
+      # Extra emtpy "" to prevent ECHO from interpreting '--version' as argument
+      $ECHO "" "--version" > command.file
+      if $CXX @command.file 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
+        AC_MSG_RESULT(yes)
+        COMPILER_COMMAND_FILE_FLAG="@"
+      else
+        AC_MSG_RESULT(no)
+        COMPILER_COMMAND_FILE_FLAG=
+      fi
+      rm -rf command.file
+    fi
   fi
   AC_SUBST(COMPILER_TARGET_BITS_FLAG)
   AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
--- a/common/autoconf/generated-configure.sh	Thu Jan 07 15:13:42 2016 -0800
+++ b/common/autoconf/generated-configure.sh	Fri Jan 08 09:46:02 2016 +0100
@@ -4801,7 +4801,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1450277321
+DATE_WHEN_GENERATED=1452242585
 
 ###############################################################################
 #
@@ -45930,6 +45930,29 @@
   else
     COMPILER_TARGET_BITS_FLAG="-m"
     COMPILER_COMMAND_FILE_FLAG="@"
+
+    # The solstudio linker does not support @-files.
+    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
+      COMPILER_COMMAND_FILE_FLAG=
+    fi
+
+    # Check if @file is supported by gcc
+    if test "x$TOOLCHAIN_TYPE" = xgcc; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking if @file is supported by gcc" >&5
+$as_echo_n "checking if @file is supported by gcc... " >&6; }
+      # Extra emtpy "" to prevent ECHO from interpreting '--version' as argument
+      $ECHO "" "--version" > command.file
+      if $CXX @command.file 2>&5 >&5; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+        COMPILER_COMMAND_FILE_FLAG="@"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+        COMPILER_COMMAND_FILE_FLAG=
+      fi
+      rm -rf command.file
+    fi
   fi
 
 
--- a/make/common/NativeCompilation.gmk	Thu Jan 07 15:13:42 2016 -0800
+++ b/make/common/NativeCompilation.gmk	Fri Jan 08 09:46:02 2016 +0100
@@ -783,13 +783,13 @@
 
     $1_LD_OBJ_ARG := $$($1_ALL_OBJS)
 
-    # If there are many object files, use an @-file.
+    # If there are many object files, use an @-file...
     ifneq ($$(word 17, $$($1_ALL_OBJS)), )
       $1_OBJ_FILE_LIST := $$($1_OBJECT_DIR)/_$1_objectfilenames.txt
-      ifneq ($(TOOLCHAIN_TYPE),solstudio)
+      ifneq ($(COMPILER_COMMAND_FILE_FLAG),)
         $1_LD_OBJ_ARG := $(COMPILER_COMMAND_FILE_FLAG)$$($1_OBJ_FILE_LIST)
       else
-        # The solstudio linker does not support @-files.
+        # ...except for toolchains which don't support them.
         $1_LD_OBJ_ARG := `cat $$($1_OBJ_FILE_LIST)`
       endif
     endif