This is the mail archive of the gcc@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]

sparc64-linux busted as a cross compiler


I thought I'd look into some of the reported sparc64 binutils
problems, but have run into difficulties building an x86-linux to
sparc64-linux cross compiler.

/usr/local/sparc64-linux/bin/ld: /usr/lib/crti.o: Relocations in generic ELF (EM: 3)
/usr/lib/crti.o: could not read symbols: File in wrong format

Ick.  My cross-compiler wants to use x86 crti.i???  Not hard to see
why, looking at the hard-coded paths in sparc/linux64.h STARTFILE_SPEC
and ENDFILE_SPEC.  Here's a suggestion that works for me building
crosscompilers (I can't test native).

	* config/sparc/linux64.h (STARTFILE_SPEC): Remove hardcoded paths.
	(ENDFILE_SPEC): Likewise.
	(STARTFILE_SPEC32, STARTFILE_SPEC64): Delete.
	(ENDFILE_SPEC32, ENDFILE_SPEC64): Likewise.
	(STARTFILE_PREFIX_SPEC): Define.

Index: gcc/config/sparc/linux64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/linux64.h,v
retrieving revision 1.62
diff -u -p -r1.62 linux64.h
--- gcc/config/sparc/linux64.h	15 Sep 2002 12:03:42 -0000	1.62
+++ gcc/config/sparc/linux64.h	22 Sep 2002 14:24:07 -0000
@@ -46,6 +46,16 @@ Boston, MA 02111-1307, USA.  */
 #define CPP_ARCH32_SPEC "%{mlong-double-128:-D__LONG_DOUBLE_128__} \
 -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc"
 
+#if DEFAULT_ARCH32_P
+#define STARTFILE_PREFIX_SPEC "\
+  %{!m64: " STANDARD_STARTFILE_PREFIX " /lib/ /usr/lib/} \
+  %{m64: " STANDARD_STARTFILE_PREFIX "64/ /lib64/ /usr/lib64/}"
+#else
+#define STARTFILE_PREFIX_SPEC "\
+  %{!m32: " STANDARD_STARTFILE_PREFIX " /lib64/ /usr/lib64/} \
+  %{m32: " STANDARD_STARTFILE_PREFIX "32/ /lib/ /usr/lib/}"
+#endif
+
 #endif
 
 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux.  Here we add
@@ -54,39 +64,12 @@ Boston, MA 02111-1307, USA.  */
    object constructed before entering `main'.  */
    
 #undef  STARTFILE_SPEC
-
-#define STARTFILE_SPEC32 \
-  "%{!shared: \
-     %{pg:/usr/lib/gcrt1.o%s} %{!pg:%{p:/usr/lib/gcrt1.o%s} %{!p:/usr/lib/crt1.o%s}}}\
-   /usr/lib/crti.o%s %{static:crtbeginT.o%s}\
-   %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
-
-#define STARTFILE_SPEC64 \
+#define STARTFILE_SPEC \
   "%{!shared: \
-     %{pg:/usr/lib64/gcrt1.o%s} %{!pg:%{p:/usr/lib64/gcrt1.o%s} %{!p:/usr/lib64/crt1.o%s}}}\
-   /usr/lib64/crti.o%s %{static:crtbeginT.o%s}\
+     %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
+   crti.o%s %{static:crtbeginT.o%s}\
    %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
 
-#ifdef SPARC_BI_ARCH
-
-#if DEFAULT_ARCH32_P
-#define STARTFILE_SPEC "\
-%{m32:" STARTFILE_SPEC32 "} \
-%{m64:" STARTFILE_SPEC64 "} \
-%{!m32:%{!m64:" STARTFILE_SPEC32 "}}"
-#else
-#define STARTFILE_SPEC "\
-%{m32:" STARTFILE_SPEC32 "} \
-%{m64:" STARTFILE_SPEC64 "} \
-%{!m32:%{!m64:" STARTFILE_SPEC64 "}}"
-#endif
-
-#else
-
-#define STARTFILE_SPEC STARTFILE_SPEC64
-
-#endif
-
 /* Provide a ENDFILE_SPEC appropriate for GNU/Linux.  Here we tack on
    the GNU/Linux magical crtend.o file (see crtstuff.c) which
    provides part of the support for getting C++ file-scope static
@@ -94,37 +77,9 @@ Boston, MA 02111-1307, USA.  */
    GNU/Linux "finalizer" file, `crtn.o'.  */
 
 #undef  ENDFILE_SPEC
-
-#define ENDFILE_SPEC32 \
-  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib/crtn.o%s"
-
-#define ENDFILE_SPEC64 \
-  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib64/crtn.o%s"
-  
-#define ENDFILE_SPEC_COMMON \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
-
-#ifdef SPARC_BI_ARCH
-
-#if DEFAULT_ARCH32_P
-#define ENDFILE_SPEC "\
-%{m32:" ENDFILE_SPEC32 "} \
-%{m64:" ENDFILE_SPEC64 "} \
-%{!m32:%{!m64:" ENDFILE_SPEC32 "}} " \
-ENDFILE_SPEC_COMMON
-#else
-#define ENDFILE_SPEC "\
-%{m32:" ENDFILE_SPEC32 "} \
-%{m64:" ENDFILE_SPEC64 "} \
-%{!m32:%{!m64:" ENDFILE_SPEC64 "}} " \
-ENDFILE_SPEC_COMMON
-#endif
-
-#else
-
-#define ENDFILE_SPEC ENDFILE_SPEC64 " " ENDFILE_SPEC_COMMON
-
-#endif
+#define ENDFILE_SPEC \
+  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+   %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
 
 /* The GNU C++ standard library requires that these macros be defined.  */
 #undef CPLUSPLUS_CPP_SPEC


-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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