Subject: Re: Cross-compile on i386
To: None <port-hpcmips@netbsd.org>
From: Miles Nordin <carton@Ivy.NET>
List: port-hpcmips
Date: 05/18/2003 12:05:45
>>>>> "ap" == Alex Poylisher <sher@komkon.org> writes:

    ap> Yes, please.

once again, this -mips2 thing does not work.  Here is the patch to
make gcc always use -mips2 -memcpy and thus make binaries that subtly
don't work on hpcmips.  However it looks like it might be out of date
w.r.t. the latest gcc.

Index: config/mips/netbsd.h
===================================================================
RCS file: /scratch/cvsroot/netbsd/src/gnu/dist/gcc/config/mips/Attic/netbsd.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- config/mips/netbsd.h	4 Mar 2002 18:46:13 -0000	1.1.1.1
+++ config/mips/netbsd.h	8 Mar 2002 23:55:48 -0000	1.2
@@ -56,12 +56,46 @@
   -D_R3000 -Asystem(unix) -Asystem(NetBSD) -Amachine(mips)"
 #endif
 
+#ifdef HPCMIPS_GCCOPT_HACK
+#undef MIPS_ISA_DEFAULT
+#define	MIPS_ISA_DEFAULT	2
+	/*
+	 * MASK_MEMCPY:  there is suspicion gcc will emit floating 
+	 * point insns for block moves without this option.  The hpcmips 
+	 * kernel build uses -memcpy, so we turn it on by default.
+	 *
+	 * CC1_SPEC:  -mips2 implies -mfp32 -mgp32, but these options 
+	 * don't turn something on.  They turn _off_ 64-register.  TARGET_* 
+	 * can only turn things on, can't turn off.
+	 */
+#undef TARGET_CPU_DEFAULT
+#define TARGET_CPU_DEFAULT	(MASK_MEMCPY)
+	/* GCCOPT_HACK_SPEC is used only in ASM_SPEC and LINK_SPEC below. */
+#define	GCCOPT_HACK_SPEC	"%{!mips1: %{!mips2: %{!mips3: -mips2}}} "
+#if 0
+	/*
+	 * see http://mail-index.netbsd.org/port-hpcmips/2000/03/04/0000.html 
+	 * which explains that this is a very bad idea.  In short, soft-float 
+	 * is 3x faster than FPU emulation for static binaries, but much 
+	 * slower than FPU emulation for shlibs.
+	 *
+	 *  these options remove ABICALLS and add SOFT_FLOAT w.r.t. netbsd.h
+	 */
+#define	TARGET_DEFAULT		((MASK_GAS)|(MASK_DEBUG_A)|(MASK_SOFT_FLOAT))
+	/* offers substantial size reduction, but G must be 0 for shlib. */
+#define	MIPS_DEFAULT_GVALUE	(20)
+#endif	/* 0 */
+#else	/* HPCMIPS_GCCOPT_HACK */
+#define	GCCOPT_HACK_SPEC	""
+#endif	/* HPCMIPS_GCCOPT_HACK */
+
 /* Always uses gas.  */
 
 #undef ASM_SPEC
 #define ASM_SPEC \
- "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{v} \
-  %{noasmopt:-O0} \
+ "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{v} " \
+  GCCOPT_HACK_SPEC \
+ "%{noasmopt:-O0} \
   %{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \
   %{g} %{g0} %{g1} %{g2} %{g3} \
   %{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \
@@ -75,8 +109,9 @@
  
 #undef LINK_SPEC
 #define LINK_SPEC \
-  "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-   %{bestGnum} %{shared} %{non_shared} \
+  "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} " \
+   GCCOPT_HACK_SPEC \
+  "%{bestGnum} %{shared} %{non_shared} \
    %{call_shared} %{no_archive} %{exact_version} \
    %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
    %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so} \


-- 
But if you're near one of our centers, you can either provide a sample
at home in a clean container and bring it in to our offices within two
or three hours.  Or you can come in and use one of our masturbatoriums.
		-- Dr. Cappy Rothman