This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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

Re: Trying to set up gcc 3.2.3 cross i686-linux -> mips-sgi-irix6


Hi again,

many thanks to Kai who helped me a lot getting my cross-compiler
working.  This is my progress report, coupled with new questions.

I've meanwhile updated to gcc-3.3, a binutils snapshot dated May 16th,
and followed Kai's excellent advice, in particular in choosing the
proper target triple `mips-sgi-irix6.5'.

Attached is a diff to the current gcc-3.3 sources which does two things:
change the hardcoded paths for the cross-compile case from
/usr/lib{32,64} to somewhere under $build_tooldir; and patch libstdc++'s
configure script so it finds the appropriate headers.  

Comments on this patch are extremely welcome, since I don't really
understand the implications of what I'm doing.  Notably the configure.in
patch is just copied from the other architectures, minus the lines that
had the compile choke afterwards.  (I wouldn't want to submit this patch
to the gcc folks without any feedback from some of you.)

With this patch, I've had success getting a cross-compiler to work. 
Here's how I did it:

---
setenv PREFIX <something>
setenv TARGET mips-sgi-irix6.5
cd binutils-build
../binutils-030516/configure --prefix=$PREFIX --target=$TARGET
make; make install

cd $PREFIX/$TARGET/lib
rsync -avr --copy-unsafe-links irix-host:/usr/lib32/ mabi=32/
rsync -avr --copy-unsafe-links irix-host:/usr/lib64/ mabi=64/
cd $PREFIX/$TARGET
rsync -avr irix-host:/usr/include .

cd <back somewhere>/gcc-build
../gcc-3.3/configure --prefix=$PREFIX --target=$TARGET --with-gnu-ld
--with-gnu-as --without-newlib --disable-static
make; make install

---

The resulting mips-sgi-irix6.5-gcc compiles and links a small test
program, but chokes on Qt examples (yes, I'm targetting Qt, silly me!):

dbx ./dclock
dbx version 7.3.4 (86441_Nov11 MR) Nov 11 2002 11:31:55
Executable ./dclock
(dbx) run
Process 190293 (dclock) started
Regions overlap: PIOCMAP returned bad data.region 0 addr 0xaf80000 size
0x12000 mflags 0x2100dregion 1 addr 0xaf8d000 size 0x48000 mflags
0x12005 ignoring later region 
Regions overlap: PIOCMAP returned bad data.region 0 addr 0xaf80000 size
0x12000 mflags 0x2100dregion 1 addr 0xaf8d000 size 0x48000 mflags
0x2100d ignoring later region 
Regions overlap: PIOCMAP returned bad data.region 2 addr 0xaf80000 size
0x12000 mflags 0x2100dregion 3 addr 0xaf8d000 size 0x48000 mflags
0x12005 ignoring later region 
Regions overlap: PIOCMAP returned bad data.region 4 addr 0xaf80000 size
0x12000 mflags 0x2100dregion 5 addr 0xaf8d000 size 0x48000 mflags
0x12005 ignoring later region 
Regions overlap: PIOCMAP returned bad data.region 6 addr 0xaf80000 size
0x12000 mflags 0x2100dregion 7 addr 0xaf8d000 size 0x48000 mflags
0x12005 ignoring later region 
Regions overlap: PIOCMAP returned bad data.region 6 addr 0xaf80000 size
0x12000 mflags 0x2100dregion 7 addr 0xaf8d000 size 0x48000 mflags
0x12005 ignoring later region 
Process 190293 (dclock) stopped on signal SIGSEGV: Segmentation
violation (default) at [__do_global_ctors:0 ,0x6071e54c]
(dbx) 

Does anybody have any ideas where this comes from?

Alex

-- 
Alexander Jolk         /         BUF Compagnie
tel +33-1 42 68 18 28 /  fax +33-1 42 68 18 29
diff -rux configure gcc-3.3/gcc/config/mips/iris6.h gcc-3.3-patched/gcc/config/mips/iris6.h
--- gcc-3.3/gcc/config/mips/iris6.h	Mon Feb 24 20:08:07 2003
+++ gcc-3.3-patched/gcc/config/mips/iris6.h	Fri May 16 17:51:56 2003
@@ -31,6 +31,18 @@
 #define TARGET_DEFAULT (MASK_ABICALLS|MASK_FLOAT64|MASK_64BIT)
 #endif
 
+#ifndef MIPS_LIB32
+
+#ifdef CROSS_COMPILE
+#define MIPS_LIB32	CROSS_TOOLDIR "/lib/mabi=32"
+#define MIPS_LIB64	CROSS_TOOLDIR "/lib/mabi=64"
+#else
+#define MIPS_LIB32	"/usr/lib32"
+#define MIPS_LIB64	"/usr/lib64"
+#endif
+
+#endif
+
 #include "mips/iris5.h"
 
 /* Irix6 assembler does handle DWARF2 directives.  Override setting in
@@ -453,36 +465,36 @@
      %{mabi=32:%{pg:gcrt1.o%s} \
        %{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
      %{mabi=n32: \
-       %{mips4:%{pg:/usr/lib32/mips4/gcrt1.o%s} \
-         %{!pg:%{p:/usr/lib32/mips4/mcrt1.o%s /usr/lib32/mips4/libprof1.a%s} \
-           %{!p:/usr/lib32/mips4/crt1.o%s}}} \
-       %{!mips4:%{pg:/usr/lib32/mips3/gcrt1.o%s} \
-         %{!pg:%{p:/usr/lib32/mips3/mcrt1.o%s /usr/lib32/mips3/libprof1.a%s} \
-           %{!p:/usr/lib32/mips3/crt1.o%s}}}} \
+       %{mips4:%{pg:" MIPS_LIB32 "/mips4/gcrt1.o%s} \
+         %{!pg:%{p:" MIPS_LIB32 "/mips4/mcrt1.o%s " MIPS_LIB32 "/mips4/libprof1.a%s} \
+           %{!p:" MIPS_LIB32 "/mips4/crt1.o%s}}} \
+       %{!mips4:%{pg:" MIPS_LIB32 "/mips3/gcrt1.o%s} \
+         %{!pg:%{p:" MIPS_LIB32 "/mips3/mcrt1.o%s " MIPS_LIB32 "/mips3/libprof1.a%s} \
+           %{!p:" MIPS_LIB32 "/mips3/crt1.o%s}}}} \
      %{mabi=64: \
-       %{mips4:%{pg:/usr/lib64/mips4/gcrt1.o} \
-         %{!pg:%{p:/usr/lib64/mips4/mcrt1.o /usr/lib64/mips4/libprof1.a} \
-           %{!p:/usr/lib64/mips4/crt1.o}}} \
-       %{!mips4:%{pg:/usr/lib64/mips3/gcrt1.o} \
-         %{!pg:%{p:/usr/lib64/mips3/mcrt1.o /usr/lib64/mips3/libprof1.a} \
-           %{!p:/usr/lib64/mips3/crt1.o}}}} \
+       %{mips4:%{pg:" MIPS_LIB64 "/mips4/gcrt1.o} \
+         %{!pg:%{p:" MIPS_LIB64 "/mips4/mcrt1.o " MIPS_LIB64 "/mips4/libprof1.a} \
+           %{!p:" MIPS_LIB64 "/mips4/crt1.o}}} \
+       %{!mips4:%{pg:" MIPS_LIB64 "/mips3/gcrt1.o} \
+         %{!pg:%{p:" MIPS_LIB64 "/mips3/mcrt1.o " MIPS_LIB64 "/mips3/libprof1.a} \
+           %{!p:" MIPS_LIB64 "/mips3/crt1.o}}}} \
      %{!mabi*: \
-       %{mips4:%{pg:/usr/lib32/mips4/gcrt1.o%s} \
-         %{!pg:%{p:/usr/lib32/mips4/mcrt1.o%s /usr/lib32/mips4/libprof1.a%s} \
-           %{!p:/usr/lib32/mips4/crt1.o%s}}} \
-       %{!mips4:%{pg:/usr/lib32/mips3/gcrt1.o%s} \
-         %{!pg:%{p:/usr/lib32/mips3/mcrt1.o%s /usr/lib32/mips3/libprof1.a%s} \
-           %{!p:/usr/lib32/mips3/crt1.o%s}}}}} \
+       %{mips4:%{pg:" MIPS_LIB32 "/mips4/gcrt1.o%s} \
+         %{!pg:%{p:" MIPS_LIB32 "/mips4/mcrt1.o%s " MIPS_LIB32 "/mips4/libprof1.a%s} \
+           %{!p:" MIPS_LIB32 "/mips4/crt1.o%s}}} \
+       %{!mips4:%{pg:" MIPS_LIB32 "/mips3/gcrt1.o%s} \
+         %{!pg:%{p:" MIPS_LIB32 "/mips3/mcrt1.o%s " MIPS_LIB32 "/mips3/libprof1.a%s} \
+           %{!p:" MIPS_LIB32 "/mips3/crt1.o%s}}}}} \
    crtbegin.o%s"
 
 #undef LIB_SPEC
 #define LIB_SPEC \
-  "%{mabi=n32: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \
-     -L/usr/lib32} \
-   %{mabi=64: %{mips4:-L/usr/lib64/mips4} %{!mips4:-L/usr/lib64/mips3} \
-     -L/usr/lib64} \
-   %{!mabi*: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \
-     -L/usr/lib32} \
+  "%{mabi=n32: %{mips4:-L" MIPS_LIB32 "/mips4} %{!mips4:-L" MIPS_LIB32 "/mips3} \
+     -L" MIPS_LIB32 "} \
+   %{mabi=64: %{mips4:-L" MIPS_LIB64 "/mips4} %{!mips4:-L" MIPS_LIB64 "/mips3} \
+     -L" MIPS_LIB64 "} \
+   %{!mabi*: %{mips4:-L" MIPS_LIB32 "/mips4} %{!mips4:-L" MIPS_LIB32 "/mips3} \
+     -L" MIPS_LIB32 "} \
    %{!shared: \
      -dont_warn_unused %{p:libprof1.a%s}%{pg:libprof1.a%s} -lc -warn_unused}"
 
@@ -497,12 +509,12 @@
   "crtend.o%s \
    %{!shared: \
      %{mabi=32:crtn.o%s}\
-     %{mabi=n32:%{mips4:/usr/lib32/mips4/crtn.o%s}\
-       %{!mips4:/usr/lib32/mips3/crtn.o%s}}\
-     %{mabi=64:%{mips4:/usr/lib64/mips4/crtn.o%s}\
-       %{!mips4:/usr/lib64/mips3/crtn.o%s}}\
-     %{!mabi*:%{mips4:/usr/lib32/mips4/crtn.o%s}\
-       %{!mips4:/usr/lib32/mips3/crtn.o%s}}}"
+     %{mabi=n32:%{mips4:" MIPS_LIB32 "/mips4/crtn.o%s}\
+       %{!mips4:" MIPS_LIB32 "/mips3/crtn.o%s}}\
+     %{mabi=64:%{mips4:" MIPS_LIB64 "/mips4/crtn.o%s}\
+       %{!mips4:" MIPS_LIB64 "/mips3/crtn.o%s}}\
+     %{!mabi*:%{mips4:" MIPS_LIB32 "/mips4/crtn.o%s}\
+       %{!mips4:" MIPS_LIB32 "/mips3/crtn.o%s}}}"
 
 /* ??? If no mabi=X option give, but a mipsX option is, then should depend
    on the mipsX option.  */
diff -rux configure gcc-3.3/gcc/config/mips/iris6gld.h gcc-3.3-patched/gcc/config/mips/iris6gld.h
--- gcc-3.3/gcc/config/mips/iris6gld.h	Fri May 17 09:43:33 2002
+++ gcc-3.3-patched/gcc/config/mips/iris6gld.h	Fri May 16 17:51:56 2003
@@ -22,12 +22,12 @@
 
 #undef LIB_SPEC
 #define LIB_SPEC \
-  "%{mabi=n32: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \
-     -L/usr/lib32} \
-   %{mabi=64: %{mips4:-L/usr/lib64/mips4} %{!mips4:-L/usr/lib64/mips3} \
-     -L/usr/lib64} \
-   %{!mabi*: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \
-     -L/usr/lib32} \
+  "%{mabi=n32: %{mips4:-L" MIPS_LIB32 "/mips4} %{!mips4:-L" MIPS_LIB32 "/mips3} \
+     -L" MIPS_LIB32 "} \
+   %{mabi=64: %{mips4:-L" MIPS_LIB64 "/mips4} %{!mips4:-L" MIPS_LIB64 "/mips3} \
+     -L" MIPS_LIB64 "} \
+   %{!mabi*: %{mips4:-L" MIPS_LIB32 "/mips4} %{!mips4:-L" MIPS_LIB32 "/mips3} \
+     -L" MIPS_LIB32 "} \
    %{!shared: \
      %{p:libprof1.a%s}%{pg:libprof1.a%s} -lc}"
 
diff -rux configure gcc-3.3/gcc/config/mips/t-iris6 gcc-3.3-patched/gcc/config/mips/t-iris6
--- gcc-3.3/gcc/config/mips/t-iris6	Tue Jan 28 03:18:38 2003
+++ gcc-3.3-patched/gcc/config/mips/t-iris6	Fri May 16 17:51:56 2003
@@ -8,6 +8,7 @@
 
 LIBGCC = stmp-multilib
 INSTALL_LIBGCC = install-multilib
+T_CPPFLAGS=-DCROSS_TOOLDIR=\"$(build_tooldir)\"
 
 # For svr4 we build crtbegin.o and crtend.o which serve to add begin and
 # end labels to the .ctors and .dtors section when we link using gcc.
diff -rux configure gcc-3.3/libstdc++-v3/configure.in gcc-3.3-patched/libstdc++-v3/configure.in
--- gcc-3.3/libstdc++-v3/configure.in	Fri May  2 00:20:08 2003
+++ gcc-3.3-patched/libstdc++-v3/configure.in	Tue May 20 13:28:34 2003
@@ -265,6 +265,37 @@
       AC_DEFINE(HAVE_SINHF)
       AC_DEFINE(HAVE_SINHL)
       ;;
+    *-irix6.5)
+      # Check for available headers.
+      AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
+        machine/endian.h machine/param.h sys/machine.h sys/types.h \
+        fp.h locale.h float.h inttypes.h sys/resource.h sys/stat.h \
+        sys/time.h unistd.h])
+      SECTION_FLAGS='-ffunction-sections -fdata-sections'
+      AC_SUBST(SECTION_FLAGS) 
+      GLIBCPP_CHECK_LINKER_FEATURES
+      GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
+      GLIBCPP_CHECK_WCHAR_T_SUPPORT
+      os_include_dir="os/irix/irix6.5"
+      AC_DEFINE(HAVE_LC_MESSAGES)
+      AC_DEFINE(HAVE_DRAND48)
+      AC_DEFINE(HAVE_GETPAGESIZE)
+      AC_DEFINE(HAVE_SIGSETJMP)
+      AC_DEFINE(HAVE_COPYSIGN)
+      AC_DEFINE(HAVE_COPYSIGNF)
+      AC_DEFINE(HAVE_FINITE)
+      AC_DEFINE(HAVE_FREXPF)
+      AC_DEFINE(HAVE_HYPOT)
+      AC_DEFINE(HAVE_HYPOTF)
+      AC_DEFINE(HAVE_ISINF)
+      AC_DEFINE(HAVE_ISNAN)
+      AC_DEFINE(HAVE_ISNANF)
+      if test x"long_double_math_on_this_cpu" = x"yes"; then
+        AC_DEFINE(HAVE_FINITEL)
+        AC_DEFINE(HAVE_ISINFL)
+        AC_DEFINE(HAVE_ISNANL)
+      fi
+      ;;
     *)
       os_include_dir="os/newlib"
       AC_DEFINE(HAVE_HYPOT)

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com

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