This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR other/7956


Hi,

This is an old problem related to multilib on SPARC/Solaris 7, 8 and 9.  The 
compiler is always built as a multiarch compiler on these platforms, and by 
default, as a multilib compiler.  Now, you may want (or need) not to build 
both flavors of the libraries by passing --disable-multilib to the top-level 
configure script.

So, in this case, you end up with a multiarch but not multilib compiler. This 
means that you can compile but not link, the error issued in the latter case 
being a bit cryptic:

ld: fatal: file /usr/lib/sparcv9/values-Xa.o: cannot open file: No such file 
or directory
ld: fatal: file /var/tmp//ccKb4eqM.o: wrong machine class
ld: fatal: File processing errors. No output written to a.out
collect2: ld returned 1 exit status

The attached patch turns the error message into:
gcc: does not support multilib

Compiled on sparc64-sun-solaris2.9 and sparc-sun-solaris2.8. Ok for mainline?


2003-12-02  Eric Botcazou  <ebotcazou@libertysurf.fr>

        PR other/7956
	* genmultilib: New variable disable_multilib.  Set it to 'yes'
	if enable_multilib was set to 'no'.  Emit DISABLE_MULTILIB
	if disable_multilib was set to 'yes'.
	* gcc.c: Include multilib.h before tm.h.
	* config/sparc/sol2-bi.h (LINK_ARCH_SPEC): Emit an error
	message for multiarch options if DISABLE_MULTILIB is set.

--
Eric Botcazou
Index: genmultilib
===================================================================
RCS file: /cvs/gcc/gcc/gcc/genmultilib,v
retrieving revision 1.13
diff -u -p -r1.13 genmultilib
--- genmultilib	23 Oct 2003 05:16:52 -0000	1.13
+++ genmultilib	1 Dec 2003 16:58:42 -0000
@@ -323,6 +323,7 @@ for combo in ${combinations}; do
     osdirout=`echo ${osdirout} | sed -e 's|^/||' -e 's|/$||g'`
     if [ "x${enable_multilib}" != xyes ]; then
       dirout=".:${osdirout}"
+      disable_multilib=yes
     else
       case "${osdirout}" in
         !*)
@@ -402,6 +403,12 @@ echo "};"
 moptions=`echo ${options} | sed -e 's,[ 	][ 	]*, ,g'`
 echo ""
 echo "static const char *multilib_options = \"${moptions}\";"
+
+# Finally output the disable flag if specified
+if [ "x${disable_multilib}" = xyes ]; then
+  echo ""
+  echo "#define DISABLE_MULTILIB  1"
+fi
 
 cd ..
 rm -r tmpmultilib.$$
Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.395
diff -u -p -r1.395 gcc.c
--- gcc.c	23 Oct 2003 19:27:41 -0000	1.395
+++ gcc.c	1 Dec 2003 16:58:58 -0000
@@ -73,6 +73,7 @@ compilation is specified by a string cal
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "multilib.h" /* before tm.h */
 #include "tm.h"
 #include <signal.h>
 #if ! defined( SIGCHLD ) && defined( SIGCLD )
@@ -791,7 +792,6 @@ static const char *multilib_select;
 static const char *multilib_matches;
 static const char *multilib_defaults;
 static const char *multilib_exclusions;
-#include "multilib.h"
 
 /* Check whether a particular argument is a default argument.  */
 
Index: config/sparc/sol2-bi.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sol2-bi.h,v
retrieving revision 1.12
diff -u -p -r1.12 sol2-bi.h
--- config/sparc/sol2-bi.h	17 Jun 2003 01:00:43 -0000	1.12
+++ config/sparc/sol2-bi.h	1 Dec 2003 16:58:58 -0000
@@ -147,11 +147,27 @@
        %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}}"
 
 #undef LINK_ARCH_SPEC
+#if DISABLE_MULTILIB
+#if DEFAULT_ARCH32_P
+#define LINK_ARCH_SPEC "\
+%{m32:%(link_arch32)} \
+%{m64:%edoes not support multilib} \
+%{!m32:%{!m64:%(link_arch_default)}} \
+"
+#else
+#define LINK_ARCH_SPEC "\
+%{m32:%edoes not support multilib} \
+%{m64:%(link_arch64)} \
+%{!m32:%{!m64:%(link_arch_default)}} \
+"
+#endif
+#else
 #define LINK_ARCH_SPEC "\
 %{m32:%(link_arch32)} \
 %{m64:%(link_arch64)} \
 %{!m32:%{!m64:%(link_arch_default)}} \
 "
+#endif
 
 #define LINK_ARCH_DEFAULT_SPEC \
 (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]