re PR target/14548 (building Ada library incorrectly requires collect2 on mingw)
authorIan Lance Taylor <ian@wasabisystems.com>
Mon, 5 Apr 2004 03:58:46 +0000 (03:58 +0000)
committerNathanael Nerode <neroden@gcc.gnu.org>
Mon, 5 Apr 2004 03:58:46 +0000 (03:58 +0000)
PR target/14548
* config.host: Set the shell variable host_can_use_collect2.
Set it to yes by default, and to no for alpha*-dec-*vms*,
i[34567]86-*-mingw32*, and powerpc-*-beos*.
* configure.ac: Set and substitute the shell variable collect2.
Give an error if use_collect2 is yes and host_can_use_collect2 is
no.
* Makefile.in (COLLECT2): Rename from USE_COLLECT2.  Change all
uses.  Initialize to @collect2@.
(STAGESTUFF): Remove $(USE_COLLECT2).
* config/alpha/x-vms (USE_COLLECT2): Don't set.
* config/i386/t-mingw32 (USE_COLLECT2): Likewise.
* config/rs6000/t-beos (USE_COLLECT2): Likewise.
* config/pa/t-pa64: Remove commented out USE_COLLECT2.
* configure: Regenerate.

Co-Authored-By: Nathanael Nerode <neroden@gcc.gnu.org>
From-SVN: r80422

gcc/ChangeLog
gcc/Makefile.in
gcc/config.host
gcc/config/alpha/x-vms
gcc/config/i386/t-mingw32
gcc/config/pa/t-pa64
gcc/config/rs6000/t-beos
gcc/configure
gcc/configure.ac

index 74005c4..d5486f2 100644 (file)
@@ -1,3 +1,22 @@
+2004-04-04  Ian Lance Taylor  <ian@wasabisystems.com>
+           Nathanael Nerode  <neroden@gcc.gnu.org>
+
+       PR target/14548
+       * config.host: Set the shell variable host_can_use_collect2.
+       Set it to yes by default, and to no for alpha*-dec-*vms*,
+       i[34567]86-*-mingw32*, and powerpc-*-beos*.
+       * configure.ac: Set and substitute the shell variable collect2.
+       Give an error if use_collect2 is yes and host_can_use_collect2 is
+       no.
+       * Makefile.in (COLLECT2): Rename from USE_COLLECT2.  Change all
+       uses.  Initialize to @collect2@.
+       (STAGESTUFF): Remove $(USE_COLLECT2).
+       * config/alpha/x-vms (USE_COLLECT2): Don't set.
+       * config/i386/t-mingw32 (USE_COLLECT2): Likewise.
+       * config/rs6000/t-beos (USE_COLLECT2): Likewise.
+       * config/pa/t-pa64: Remove commented out USE_COLLECT2.
+       * configure: Regenerate.
+
 2004-04-04  Roger Sayle  <roger@eyesopen.com>
 
        * simplify-rtx.c (simplify_binary_operation): Constant fold
index 74f2c35..f75afff 100644 (file)
@@ -539,9 +539,10 @@ EXTRA_GCC_OBJS =@extra_gcc_objs@
 # List of additional header files to install.
 EXTRA_HEADERS =@extra_headers_list@
 
-# It is convenient for configure to add the assignment at the beginning,
-# so don't override it here.
-USE_COLLECT2 = collect2$(exeext)
+# The configure script will set this to collect2$(exeext), except on a
+# (non-Unix) host which can not build collect2, for which it will be
+# set to empty.
+COLLECT2 = @collect2@
 
 # List of extra C and assembler files to add to static and shared libgcc2.
 # Assembler files should have names ending in `.asm'.
@@ -580,7 +581,7 @@ GCC_PASSES=xgcc$(exeext) cc1$(exeext) specs $(EXTRA_PASSES)
 
 # List of things which should already be built whenever we try to use xgcc
 # to link anything.
-GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
+GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(COLLECT2) $(EXTRA_PARTS)
 
 # Directory to link to, when using the target `maketest'.
 DIR = ../gcc
@@ -895,7 +896,7 @@ STAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \
  xgcc$(exeext) cpp$(exeext) cc1$(exeext) $(EXTRA_PASSES) \
  $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
  protoize$(exeext) unprotoize$(exeext) \
- $(SPECS) collect2$(exeext) $(USE_COLLECT2) \
+ $(SPECS) collect2$(exeext) \
  gcov-iov$(build_exeext) gcov$(exeext) gcov-dump$(exeext) \
  *.[0-9][0-9].* *.[si] libcpp.a libbackend.a libgcc.mk \
  $(LANG_STAGESTUFF)
@@ -1072,7 +1073,7 @@ rest.encap: $(STMP_FIXPROTO) $(LIBGCC) $(EXTRA_PARTS) lang.rest.encap
 # This is what is made with the host's compiler
 # whether making a cross compiler or not.
 native: config.status auto-host.h build-@POSUB@ $(LANGUAGES) \
-       $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
+       $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(COLLECT2)
 
 # Define the names for selecting languages in LANGUAGES.
 C c: cc1$(exeext)
@@ -2904,7 +2905,7 @@ install-common: native $(EXTRA_PARTS) lang.install-common installdirs
          else true; \
          fi; \
        done
-       for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
+       for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(COLLECT2) ..; do \
          if [ x"$$file" != x.. ]; then \
            rm -f $(DESTDIR)$(libexecsubdir)/$$file; \
            $(INSTALL_PROGRAM) $$file $(DESTDIR)$(libexecsubdir)/$$file; \
index 1956651..9734966 100644 (file)
@@ -49,6 +49,9 @@
 #                       be linked into the gcc driver.
 #
 #  out_host_hook_obj    An object file that provides the host hooks.
+#
+#  host_can_use_collect2 Set to yes normally; to no if the host cannot
+#                      link or otherwise use collect2
 
 # When setting any of these variables, check to see if a corresponding
 # variable is present in config.build; if so, you will likely want to 
@@ -62,6 +65,7 @@ host_exeext=
 host_extra_objs=
 host_extra_gcc_objs=
 out_host_hook_obj=host-default.o
+host_can_use_collect2=yes
 
 # Unsupported hosts list.  Generally, only include hosts known to fail here,
 # since we allow hosts not listed to be supported generically.
@@ -82,6 +86,7 @@ case ${host} in
     host_xm_file=alpha/xm-vms.h
     host_xmake_file=alpha/x-vms
     host_exeext=.exe
+    host_can_use_collect2=no
     # This removes the cpu type and manufacturer components and
     #  replaces "." with "_" in the operating system version.
     target_noncanonical=`echo $host | sed 's/.*-.*-\(.*\)$/\1/' | sed 's/\./_/g'`
@@ -137,6 +142,7 @@ case ${host} in
     host_xm_file=i386/xm-mingw32.h
     host_xmake_file=i386/x-mingw32
     host_exeext=.exe
+    host_can_use_collect2=no
     ;;
   i[34567]86-*-uwin*)
     echo "*** UWIN may not be used as a host platform because"
@@ -149,6 +155,9 @@ case ${host} in
   i860-*-sysv4*)
     host_xmake_file=i860/x-sysv4
     ;;
+  powerpc-*-beos*)
+    host_can_use_collect2=no
+    ;;
   powerpc-*-darwin*)
     # powerpc-darwin host support.
     out_host_hook_obj=host-darwin.o
index c98f03d..a0ee214 100644 (file)
@@ -19,6 +19,3 @@ decc.exe : vms-cc.o
 # These extra parts can only be compiled on a VMS host and are only needed
 # on a VMS target.  The rules are in t-vms.
 VMS_EXTRA_PARTS=vcrt0.o pcrt0.o
-
-# Doesn't work on VMS
-USE_COLLECT2=
index 28096f8..f67fa1e 100644 (file)
@@ -1,7 +1,2 @@
-#
-# collect2 doesn't work for i386-mingw32* yet.
-#
-USE_COLLECT2=
-
 # We hide calls to w32api needed for w32 thread support here:
 LIB2FUNCS_EXTRA = $(srcdir)/config/i386/gthr-win32.c
index d1b2b26..e804060 100644 (file)
@@ -5,9 +5,6 @@ LIB2FUNCS_EXTRA=quadlib.c
 # We'll need this once .init sections are enabled on PA64.
 #EXTRA_PARTS = crtbegin.o crtend.o
 
-# For the time being, we are using collect.
-#USE_COLLECT2 =
-
 quadlib.c: $(srcdir)/config/pa/quadlib.c
        rm -f quadlib.c
        cp $(srcdir)/config/pa/quadlib.c .
index badffef..dc3b89d 100644 (file)
@@ -28,6 +28,3 @@ EXTRA_PARTS = milli.exp
 milli.exp: $(srcdir)/config/rs6000/milli.exp
        rm -f milli.exp
        cp $(srcdir)/config/rs6000/milli.exp ./milli.exp
-
-# Don't use collect.
-USE_COLLECT2 =
index f0d5d41..ad40eab 100755 (executable)
@@ -309,7 +309,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP strict1_warn warn_cflags WERROR nocommon_flag EGREP valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep SET_MAKE AWK LN LN_S RANLIB ac_ct_RANLIB INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON stage1_cflags COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file FORBUILD PACKAGE VERSION USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS CROSS ALL SYSTEM_HEADER_DIR inhibit_libc BUILD_PREFIX BUILD_PREFIX_1 CC_FOR_BUILD BUILD_CFLAGS STMP_FIXINC STMP_FIXPROTO libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir objdir subdirs srcdir all_boot_languages all_compilers all_gtfiles all_gtfiles_files_langs all_gtfiles_files_files all_lang_makefrags all_lang_makefiles all_languages all_stagestuff build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines check_languages cc_set_by_configure quoted_cc_set_by_configure cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir libstdcxx_incdir gcc_version gcc_version_full gcc_version_trigger host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file stage_prefix_set_by_configure quoted_stage_prefix_set_by_configure symbolic_link thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines target_noncanonical c_target_objs cxx_target_objs target_cpu_default LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP strict1_warn warn_cflags WERROR nocommon_flag EGREP valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep SET_MAKE AWK LN LN_S RANLIB ac_ct_RANLIB INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON stage1_cflags COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file FORBUILD PACKAGE VERSION USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS CROSS ALL SYSTEM_HEADER_DIR inhibit_libc BUILD_PREFIX BUILD_PREFIX_1 CC_FOR_BUILD BUILD_CFLAGS STMP_FIXINC STMP_FIXPROTO collect2 libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir objdir subdirs srcdir all_boot_languages all_compilers all_gtfiles all_gtfiles_files_langs all_gtfiles_files_files all_lang_makefrags all_lang_makefiles all_languages all_stagestuff build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines check_languages cc_set_by_configure quoted_cc_set_by_configure cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir libstdcxx_incdir gcc_version gcc_version_full gcc_version_trigger host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file stage_prefix_set_by_configure quoted_stage_prefix_set_by_configure symbolic_link thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines target_noncanonical c_target_objs cxx_target_objs target_cpu_default LIBOBJS LTLIBOBJS'
 ac_subst_files='language_hooks'
 
 # Initialize some variables set by options.
@@ -10019,6 +10019,13 @@ for file in ${extra_headers} ; do
   extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
 done
 
+# Define collect2 in Makefile.
+case $host_can_use_collect2 in
+  no) collect2= ;;
+  *) collect2='collect2$(exeext)' ;;
+esac
+
+
 # Add a definition of USE_COLLECT2 if system wants one.
 case $use_collect2 in
   no) use_collect2= ;;
@@ -10026,6 +10033,13 @@ case $use_collect2 in
   *)
     host_xm_defines="${host_xm_defines} USE_COLLECT2"
     xm_defines="${xm_defines} USE_COLLECT2"
+    case $host_can_use_collect2 in
+      no)
+        { { echo "$as_me:$LINENO: error: collect2 is required but cannot be built on this system" >&5
+echo "$as_me: error: collect2 is required but cannot be built on this system" >&2;}
+   { (exit 1); exit 1; }; }
+        ;;
+    esac
     ;;
 esac
 
@@ -13026,6 +13040,7 @@ s,@CC_FOR_BUILD@,$CC_FOR_BUILD,;t t
 s,@BUILD_CFLAGS@,$BUILD_CFLAGS,;t t
 s,@STMP_FIXINC@,$STMP_FIXINC,;t t
 s,@STMP_FIXPROTO@,$STMP_FIXPROTO,;t t
+s,@collect2@,$collect2,;t t
 s,@libgcc_visibility@,$libgcc_visibility,;t t
 s,@GGC@,$GGC,;t t
 s,@zlibdir@,$zlibdir,;t t
index f35812d..742432b 100644 (file)
@@ -1656,6 +1656,13 @@ for file in ${extra_headers} ; do
   extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
 done
 
+# Define collect2 in Makefile.
+case $host_can_use_collect2 in
+  no) collect2= ;;
+  *) collect2='collect2$(exeext)' ;;
+esac
+AC_SUBST([collect2])
+
 # Add a definition of USE_COLLECT2 if system wants one.
 case $use_collect2 in
   no) use_collect2= ;;
@@ -1663,6 +1670,11 @@ case $use_collect2 in
   *) 
     host_xm_defines="${host_xm_defines} USE_COLLECT2"
     xm_defines="${xm_defines} USE_COLLECT2"
+    case $host_can_use_collect2 in
+      no)
+        AC_MSG_ERROR([collect2 is required but cannot be built on this system])
+        ;;
+    esac
     ;;
 esac