Subject: Re: mozilla - "make" stops.
To: None <tech-pkg@netbsd.org>
From: Klaus Heinz <k.heinz.aug.zwei@onlinehome.de>
List: tech-pkg
Date: 08/05/2002 21:56:47
--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Shigeki UNO wrote:

  [ compiler/assembler errors in MD files for Mozilla/m68k ]

> Any clues? 

Syntax for registers has changed for m68k assembler. You may try the
appended patches for this problem. Please tell me if it works for you.

I have tried not to break Mozilla on aout machines (see SYMBOLPREFIX in
the patches) but it looks kind of ugly to me. Maybe someone else has a
better idea.

ciao
     Klaus


--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Makefile.in.diff"

--- xpcom/reflect/xptcall/src/md/unix/Makefile.in.orig	Wed Apr 10 05:37:34 2002
+++ xpcom/reflect/xptcall/src/md/unix/Makefile.in	Sun Jul 21 03:29:48 2002
@@ -149,6 +149,14 @@
 #
 ifeq ($(OS_ARCH),NetBSD)
 ifneq (,$(filter amiga atari hp300 mac68k mvme68k next68k sun3 sun3x x68k,$(OS_TEST)))
+ifneq (,$(findstring elf,$(TARGET_OS)))
+# ELF format
+SYMBOLPREFIX=\"\"
+else 
+# aout format
+SYMBOLPREFIX=\"_\"
+endif
+CXXFLAGS        += -DSYMBOLPREFIX=$(SYMBOLPREFIX)
 CPPSRCS		:= xptcinvoke_netbsd_m68k.cpp xptcstubs_netbsd_m68k.cpp
 endif
 endif
@@ -253,6 +261,13 @@
 ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc)
 CPPSRCS		:= xptcinvoke_sparc_netbsd.cpp xptcstubs_sparc_netbsd.cpp
 ASFILES		:= xptcinvoke_asm_sparc_netbsd.s xptcstubs_asm_sparc_netbsd.s
+endif
+#   
+# NetBSD/SPARC64
+#   
+ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc64)
+CPPSRCS		:= xptcinvoke_sparc64_netbsd.cpp xptcstubs_sparc64_netbsd.cpp
+ASFILES		:= xptcinvoke_asm_sparc64_netbsd.s xptcstubs_asm_sparc64_netbsd.s
 endif
 #
 # Solaris/SPARC

--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="xptcinvoke_netbsd_m68k.cpp.diff"

--- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp.orig	Sat Jul 20 19:41:33 2002
+++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp	Sun Jul 21 03:23:59 2002
@@ -132,6 +132,10 @@
     }
 }
 
+/*
+ * SYMBOL PREFIX must be "_" for aout symbols and "" for ELF
+ */
+
 XPTC_PUBLIC_API(nsresult)
 XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
                    PRUint32 paramCount, nsXPTCVariant* params)
@@ -139,30 +143,30 @@
     PRUint32 result;
 
  __asm__ __volatile__(
-    "movl  %4, sp@-\n\t"
-    "movl  %3, sp@-\n\t"
-    "jbsr  _invoke_count_words\n\t"     /* count words */
-    "addql #8, sp\n\t"
-    "lsll  #2, d0\n\t"      /* *= 4 */
-    "movl  sp, a2\n\t"	    /* save original sp */
-    "subl  d0, sp\n\t"      /* make room for params */
-    "movl  sp, a0\n\t"
-    "movl  %4, sp@-\n\t"
-    "movl  %3, sp@-\n\t"
-    "movl  a0, sp@-\n\t"
-    "jbsr  _invoke_copy_to_stack\n\t"   /* copy params */
-    "addl  #12, sp\n\t"
-    "movl  %1, a0\n\t"
-    "movl  a0@, a1\n\t"
-    "movl  %2, d0\n\t"      /* function index */
-    "movl  a0, d1\n\t"
-    "movw  a1@(8,d0:l:8), a0\n\t"
-    "addl  a0, d1\n\t"
-    "movl  a1@(12,d0:l:8), a1\n\t"
-    "movl  d1, sp@-\n\t"
-    "jbsr  a1@\n\t"
-    "movl  a2, sp\n\t"	    /* restore original sp */
-    "movl  d0, %0\n\t"
+    "movl  %4, %%sp@-\n\t"
+    "movl  %3, %%sp@-\n\t"
+    "jbsr  "SYMBOLPREFIX"invoke_count_words\n\t"     /* count words */
+    "addql #8, %%sp\n\t"
+    "lsll  #2, %%d0\n\t"      /* *= 4 */
+    "movl  %%sp, %%a2\n\t"	    /* save original sp */
+    "subl  %%d0, %%sp\n\t"      /* make room for params */
+    "movl  %%sp, %%a0\n\t"
+    "movl  %4, %%sp@-\n\t"
+    "movl  %3, %%sp@-\n\t"
+    "movl  %%a0, %%sp@-\n\t"
+    "jbsr  "SYMBOLPREFIX"invoke_copy_to_stack\n\t"   /* copy params */
+    "addl  #12, %%sp\n\t"
+    "movl  %1, %%a0\n\t"
+    "movl  %%a0@, %%a1\n\t"
+    "movl  %2, %%d0\n\t"      /* function index */
+    "movl  %%a0, %%d1\n\t"
+    "movw  %%a1@(8,%%d0:l:8), %%a0\n\t"
+    "addl  %%a0, %%d1\n\t"
+    "movl  %%a1@(12,%%d0:l:8), %%a1\n\t"
+    "movl  %%d1, %%sp@-\n\t"
+    "jbsr  %%a1@\n\t"
+    "movl  %%a2, %%sp\n\t"	    /* restore original sp */
+    "movl  %%d0, %0\n\t"
     : "=g" (result)         /* %0 */
     : "g" (that),           /* %1 */
       "g" (methodIndex),    /* %2 */

--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="xptcstubs_netbsd_m68k.cpp.diff"

--- xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp.orig	Wed Apr 10 05:37:42 2002
+++ xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp	Sun Jul 21 03:35:25 2002
@@ -123,17 +123,22 @@
     }
 }
 
+/*
+ * Beware: use % instead of %% for register identifiers in a preprocessor macro
+ * SYMBOL PREFIX must be "_" for aout and "" for ELF 
+ */
+
 #define STUB_ENTRY(n)							\
 __asm__(								\
-    ".global	_Stub"#n"__14nsXPTCStubBase\n\t"			\
-"_Stub"#n"__14nsXPTCStubBase:\n\t"					\
-    "link  a6,#0			\n\t"				\
-    "lea   a6@(12), a0			\n\t"	/* pointer to args */	\
-    "movl  a0, sp@-			\n\t"				\
-    "movl  #"#n", sp@-			\n\t"	/* method index */	\
-    "movl  a6@(8), sp@-			\n\t"	/* this */		\
-    "jbsr  _PrepareAndDispatch		\n\t"				\
-    "unlk  a6				\n\t"				\
+    ".global	"SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase\n\t"		\
+SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase:\n\t"				\
+    "link  %a6,#0			\n\t"				\
+    "lea   %a6@(12), %a0		\n\t"	/* pointer to args */	\
+    "movl  %a0, %sp@-			\n\t"				\
+    "movl  #"#n", %sp@-			\n\t"	/* method index */	\
+    "movl  %a6@(8), %sp@-		\n\t"	/* this */		\
+    "jbsr  "SYMBOLPREFIX"PrepareAndDispatch\n\t"			\
+    "unlk  %a6				\n\t"				\
     "rts				\n\t"				\
 );
 

--tKW2IUtsqtDRztdT--