Package: nvu
Version: 1.0final-1
Severity: important
Tags: patch
The mozilla version in nvu lacks the attached patches to build on
mips/mipsel. With them, a test build on mips succeeded.
Thiemo
--- configure.in.old 2004-09-09 04:17:48.000000000 +0200
+++ configure.in 2004-09-10 11:51:35.000000000 +0200
@@ -1107,8 +1107,7 @@ case "$target" in
MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
;;
mips*)
- CFLAGS="$CFLAGS -Wa,-xgot"
- CXXFLAGS="$CXXFLAGS -Wa,-xgot"
+ MOZ_DEBUG_FLAGS="-g" # We want inlining
;;
esac
;;
--- configure.old 2004-09-16 22:04:43.000000000 +0200
+++ configure 2004-09-11 11:13:01.000000000 +0200
@@ -5337,8 +5337,7 @@ EOF
MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
;;
mips*)
- CFLAGS="$CFLAGS -Wa,-xgot"
- CXXFLAGS="$CXXFLAGS -Wa,-xgot"
+ MOZ_DEBUG_FLAGS="-g" # We want inlining
;;
esac
;;
--- config/rules.mk.old 2006-06-20 11:06:33.000000000 +0100
+++ config/rules.mk 2006-06-20 11:06:54.000000000 +0100
@@ -452,15 +452,6 @@ endif
endif
endif
-ifeq ($(OS_ARCH),Linux)
-ifneq (,$(filter mips mipsel,$(OS_TEST)))
-ifeq ($(MODULE),layout)
-OS_CFLAGS += -Wa,-xgot
-OS_CXXFLAGS += -Wa,-xgot
-endif
-endif
-endif
-
#
# HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
# which uses internal symbols first
--- xpcom/reflect/xptcall/src/md/unix/Makefile.in.orig 2004-09-03
08:13:20.000000000 +0200
+++ xpcom/reflect/xptcall/src/md/unix/Makefile.in 2004-09-03
02:59:33.000000000 +0200
@@ -210,11 +210,7 @@ ifeq ($(OS_ARCH),Linux)
ifneq (,$(findstring mips, $(OS_TEST)))
CPPSRCS := xptcinvoke_mips.cpp xptcstubs_mips.cpp
ASFILES := xptcinvoke_asm_mips.s xptcstubs_asm_mips.s
-#xptcstubs_mips.cpp
-# xptcstubs_asm_mips.s
-ifdef GNU_CC
-ASFLAGS += $(INCLUDES) -x assembler-with-cpp -D__GNUC__
-endif
+AS := $(CC) $(CFLAGS) $(INCLUDES) -c -x assembler-with-cpp
endif
endif
@@ -359,10 +355,8 @@ INCLUDES += -I$(srcdir)/../..
ifeq ($(OS_ARCH),Linux)
ifneq (,$(findstring mips, $(OS_TEST)))
-xptcstubs_asm_mips.o: xptcstubs_asm_mips.s.m4 $(PUBLIC)/xptcstubsdef.inc
- m4 $(INCLUDES) $< > ./xptcstubs_asm_mips.s && \
- $(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) ./xptcstubs_asm_mips.s
- $(RM) -f ./xptcstubs_asm_mips.s
+xptcstubs_asm_mips.o: xptcstubs_asm_mips.s $(PUBLIC)/xptcstubsdef.inc
+ $(AS) -o $@ $<
endif
endif
--- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s.orig
2004-09-03 08:14:00.000000000 +0200
+++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s 2004-09-03
02:59:33.000000000 +0200
@@ -21,6 +21,7 @@
* Contributor(s):
* Brendan Eich <[EMAIL PROTECTED]>
* Stuart Parmenter <[EMAIL PROTECTED]>
+ * Thiemo Seufer <[EMAIL PROTECTED]>
*/
/* This code is for MIPS using the O32 ABI. */
@@ -28,139 +29,123 @@
#include <sys/regdef.h>
#include <sys/asm.h>
-.text
-.globl invoke_count_words
-.globl invoke_copy_to_stack
-
-# We need a variable number of words allocated from the stack for copies of
-# the params, and this space must come between the high frame (where ra, gp,
-# and s0 are saved) and the low frame (where a0-a3 are saved by the callee
-# functions we invoke).
-
-LOCALSZ=4 # s0, s1, ra, gp
-NARGSAVE=4 # a0, a1, a2, a3
-HIFRAMESZ=(LOCALSZ*SZREG)
-LOFRAMESZ=(NARGSAVE*SZREG)
-FRAMESZ=(HIFRAMESZ+LOFRAMESZ+ALSZ)&ALMASK
-
-# XXX these 2*SZREG, etc. are very magic -- we *know* that ALSZ&ALMASK cause
-# FRAMESZ to be 0 mod 8, in this case to be 16 and not 12.
-RAOFF=FRAMESZ - (2*SZREG)
-GPOFF=FRAMESZ - (3*SZREG)
-S0OFF=FRAMESZ - (4*SZREG)
-S1OFF=FRAMESZ - (5*SZREG)
-
-# These are not magic -- they are just our argsave slots in the caller frame.
-A0OFF=FRAMESZ
-A1OFF=FRAMESZ + (1*SZREG)
-A2OFF=FRAMESZ + (2*SZREG)
-A3OFF=FRAMESZ + (3*SZREG)
-
- #
- # _XPTC_InvokeByIndex(that, methodIndex, paramCount, params)
- # a0 a1 a2 a3
-
-NESTED(_XPTC_InvokeByIndex, FRAMESZ, ra)
-
- .set noreorder
- .cpload t9
- .set reorder
-
+# NARGSAVE is the argument space in the callers frame, including extra
+# 'shadowed' space for the argument registers. The minimum of 4
+# argument slots is sometimes predefined in the header files.
+#ifndef NARGSAVE
+#define NARGSAVE 4
+#endif
+
+#define LOCALSZ 3 /* gp, fp, ra */
+#define FRAMESZ ((((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK)
+
+#define RAOFF (FRAMESZ - (1*SZREG))
+#define FPOFF (FRAMESZ - (2*SZREG))
+#define GPOFF (FRAMESZ - (3*SZREG))
+
+#define A0OFF (FRAMESZ + (0*SZREG))
+#define A1OFF (FRAMESZ + (1*SZREG))
+#define A2OFF (FRAMESZ + (2*SZREG))
+#define A3OFF (FRAMESZ + (3*SZREG))
+
+ .text
+
+#
+# _XPTC_InvokeByIndex(that, methodIndex, paramCount, params)
+# a0 a1 a2 a3
+
+ .globl _XPTC_InvokeByIndex
+ .align 2
+ .type _XPTC_InvokeByIndex,@function
+ .ent _XPTC_InvokeByIndex,0
+ .frame fp, FRAMESZ, ra
+_XPTC_InvokeByIndex:
+ SETUP_GP
subu sp, FRAMESZ
- # specify the save register mask -- XXX do we want the a0-a3 here, given
- # our "split" frame where the args are saved below a dynamicly allocated
- # region under the high frame?
- #
- # 10010000000000010000000011110000
- .mask 0x900100F0, -((NARGSAVE+LOCALSZ)*SZREG)
-
- # thou shalt not use .cprestore if yer frame has variable size...
- # .cprestore GPOFF
-
- REG_S ra, RAOFF(sp)
-
- # this happens automatically with .cprestore, but we cannot use that
op...
- REG_S gp, GPOFF(sp)
- REG_S s0, S0OFF(sp)
- REG_S s1, S1OFF(sp)
-
- REG_S a0, A0OFF(sp)
- REG_S a1, A1OFF(sp)
- REG_S a2, A2OFF(sp)
- REG_S a3, A3OFF(sp)
+ # specify the save register mask for gp, fp, ra, a3 - a0
+ .mask 0xD00000F0, RAOFF-FRAMESZ
- # invoke_count_words(paramCount, params)
- move a0, a2
- move a1, a3
+ sw ra, RAOFF(sp)
+ sw fp, FPOFF(sp)
- jal invoke_count_words
- lw gp, GPOFF(sp)
+ # we can't use .cprestore in a variable stack frame
+ sw gp, GPOFF(sp)
- # save the old sp so we can pop the param area and any "low frame"
- # needed as an argsave area below the param block for callees that
- # we invoke.
- move s0, sp
-
- REG_L a1, A2OFF(sp) # a1 = paramCount
- REG_L a2, A3OFF(sp) # a2 = params
-
- # we define a word as 4 bytes, period end of story!
- sll v0, 2 # 4 bytes * result of invoke_copy_words
- subu v0, LOFRAMESZ # but we take back the argsave area built into
- # our stack frame -- SWEET!
- subu sp, sp, v0 # make room
- move a0, sp # a0 = param stack address
- move s1, a0 # save it for later -- it should be safe here
-
- # the old sp is still saved in s0, but we now need another argsave
- # area ("low frame") for the invoke_copy_to_stack call.
- subu sp, sp, LOFRAMESZ
+ sw a0, A0OFF(sp)
+ sw a1, A1OFF(sp)
+ sw a2, A2OFF(sp)
+ sw a3, A3OFF(sp)
+
+ # save bottom of fixed frame
+ move fp, sp
+
+ # extern "C" uint32
+ # invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s);
+ la t9, invoke_count_words
+ move a0, a2
+ move a1, a3
+ jalr t9
+ lw gp, GPOFF(fp)
- # copy the param into the stack areas
+ # allocate variable stack, with a size of:
+ # wordsize (of 4 bytes) * result (already aligned to dword)
+ # but a minimum of 16 byte
+ sll v0, 2
+ slt t0, v0, 16
+ beqz t0, 1f
+ li v0, 16
+1: subu sp, v0
+
+ # let a0 point to the bottom of the variable stack, allocate
+ # another fixed stack for:
+ # extern "C" void
# invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount,
- # nsXPTCVariant* s)
- jal invoke_copy_to_stack
- lw gp, GPOFF(s0)
-
- move sp, s0 # get orig sp back, popping params and argsave
-
- REG_L a0, A0OFF(sp) # a0 = set "that" to be "this"
- REG_L a1, A1OFF(sp) # a1 = methodIndex
-
- # t1 = methodIndex * 4
- # (use shift instead of mult)
- sll t1, a1, 2
-
- # calculate the function we need to jump to,
- # which must then be saved in t9
+ # nsXPTCVariant* s);
+ la t9, invoke_copy_to_stack
+ move a0, sp
+ lw a1, A2OFF(fp)
+ lw a2, A3OFF(fp)
+ subu sp, 16
+ jalr t9
+ lw gp, GPOFF(fp)
+
+ # back to the variable stack frame
+ addu sp, 16
+
+ # calculate the function we need to jump to, which must then be
+ # stored in t9
+ lw a0, A0OFF(fp) # a0 = set "that" to be "this"
+ lw t0, A1OFF(fp) # a1 = methodIndex
lw t9, 0(a0)
- addu t9, t9, t1
- lw t9, 8(t9)
-
- # a1..a3 and f13..f14 should now be set to what
- # invoke_copy_to_stack told us. skip a0 and f12
- # because that is the "this" pointer
-
- REG_L a1, 1*SZREG(s1)
- REG_L a2, 2*SZREG(s1)
- REG_L a3, 3*SZREG(s1)
-
- l.d $f13, 8(s1)
- l.d $f14, 16(s1)
-
- # Create the stack pointer for the function, which must have 4 words
- # of space for callee-saved args. invoke_count_words allocated space
- # for a0 starting at s1, so we just move s1 into sp.
- move sp, s1
+ # t0 = methodIndex << PTRLOG
+ sll t0, t0, PTRLOG
+ addu t9, t0
+#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
+ lw t9, (t9)
+#else /* not G++ V3 ABI */
+ lw t9, 2*PTRSIZE(t9)
+#endif /* G++ V3 ABI */
+
+ # Set a1-a3 to what invoke_copy_to_stack told us. a0 is already
+ # the "this" pointer. We don't have to care about floating
+ # point arguments, the non-FP "this" pointer as first argument
+ # means they'll never be used.
+ lw a1, 1*SZREG(sp)
+ lw a2, 2*SZREG(sp)
+ lw a3, 3*SZREG(sp)
+
+ jalr t9
+ # Micro-optimization: There's no gp usage below this point, so
+ # we don't reload.
+ # lw gp, GPOFF(fp)
- jalr ra, t9
- lw gp, GPOFF(s0)
+ # leave variable stack frame
+ move sp, fp
- move sp, s0
+ lw ra, RAOFF(sp)
+ lw fp, FPOFF(sp)
- REG_L ra, RAOFF(sp)
- REG_L s0, S0OFF(sp)
- addu sp, FRAMESZ
+ addiu sp, FRAMESZ
j ra
-.end _XPTC_InvokeByIndex
+END(_XPTC_InvokeByIndex)
--- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp.orig 2004-09-03
08:14:39.000000000 +0200
+++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp 2004-09-03
02:59:33.000000000 +0200
@@ -21,7 +21,7 @@
* Contributor(s):
* Stuart Parmenter <[EMAIL PROTECTED]>
* Brendan Eich <[EMAIL PROTECTED]>
- *
+ * Thiemo Seufer <[EMAIL PROTECTED]>
*/
/* This code is for MIPS using the O32 ABI. */
@@ -37,10 +37,8 @@ invoke_count_words(PRUint32 paramCount,
// Count a word for a0 even though it's never stored or loaded
// We do this only for alignment of register pairs.
PRUint32 result = 1;
- for (PRUint32 i = 0; i < paramCount; i++, s++)
+ for (PRUint32 i = 0; i < paramCount; i++, result++, s++)
{
- result++;
-
if (s->IsPtrData())
continue;
@@ -53,6 +51,9 @@ invoke_count_words(PRUint32 paramCount,
result++;
result++;
break;
+
+ default:
+ break;
}
}
return (result + 1) & ~(PRUint32)1;
@@ -73,8 +74,6 @@ invoke_copy_to_stack(PRUint32* d, PRUint
continue;
}
- *((void**)d) = s->val.p;
-
switch(s->type)
{
case nsXPTType::T_I64 :
@@ -89,6 +88,9 @@ invoke_copy_to_stack(PRUint32* d, PRUint
if ((PRWord)d & 4) d++;
*((double*) d) = s->val.d; d++;
break;
+ default:
+ *((void**)d) = s->val.p;
+ break;
}
}
}
@@ -103,5 +105,4 @@ XPTC_InvokeByIndex(nsISupports* that, PR
PRUint32 paramCount, nsXPTCVariant* params)
{
return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params);
-}
-
+}
--- xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s.m4.orig
2004-09-03 08:15:10.000000000 +0200
+++ xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s.m4 1970-01-01
01:00:00.000000000 +0100
@@ -1,93 +0,0 @@
-/* -*- Mode: asm; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corp, Inc.
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Stuart Parmenter <[EMAIL PROTECTED]>
- * Chris Waterson <[EMAIL PROTECTED]>
- */
-
-/* This code is for MIPS using the O32 ABI. */
-
-#include <sys/regdef.h>
-#include <sys/asm.h>
-
- .text
- .globl PrepareAndDispatch
-
-NARGSAVE=4 # extra space for the callee to use. gccism
- # we can put our a0-a3 in our callers space.
-LOCALSZ=2 # gp, ra
-FRAMESZ=(((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK
-
-define(STUB_NAME, `Stub'$1`__14nsXPTCStubBase')
-
-define(STUB_ENTRY,
-` .globl 'STUB_NAME($1)`
- .align 2
- .type 'STUB_NAME($1)`,@function
- .ent 'STUB_NAME($1)`, 0
-'STUB_NAME($1)`:
- .frame sp, FRAMESZ, ra
- .set noreorder
- .cpload t9
- .set reorder
- subu sp, FRAMESZ
- .cprestore 16
- li t0, '$1`
- b sharedstub
-.end 'STUB_NAME($1)`
-
-')
-
-define(SENTINEL_ENTRY, `')
-
-include(xptcstubsdef.inc)
-
- .globl sharedstub
- .ent sharedstub
-sharedstub:
-
- REG_S ra, 20(sp)
-
- REG_S a0, 24(sp)
- REG_S a1, 28(sp)
- REG_S a2, 32(sp)
- REG_S a3, 36(sp)
-
- # t0 is methodIndex
- move a1, t0
-
- # put the start of a1, a2, a3, and stack
- move a2, sp
- addi a2, 24 # have a2 point to sp + 24 (where a0 is)
-
- # PrepareAndDispatch(that, methodIndex, args)
- # a0 a1 a2
- #
- jal PrepareAndDispatch
-
- REG_L ra, 20(sp)
- REG_L a1, 28(sp)
- REG_L a2, 32(sp)
-
- addu sp, FRAMESZ
- j ra
-
-.end sharedstub
--- /dev/null 1970-01-01 01:00:00.000000000 +0100
+++ xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s 2004-09-03
09:22:27.000000000 +0200
@@ -0,0 +1,142 @@
+/* -*- Mode: asm; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Stuart Parmenter <[EMAIL PROTECTED]>
+ * Chris Waterson <[EMAIL PROTECTED]>
+ * Thiemo Seufer <[EMAIL PROTECTED]>
+ */
+
+/* This code is for MIPS using the O32 ABI. */
+
+#include <sys/regdef.h>
+#include <sys/asm.h>
+
+# NARGSAVE is the argument space in the callers frame, including extra
+# 'shadowed' space for the argument registers. The minimum of 4
+# argument slots is sometimes predefined in the header files.
+#ifndef NARGSAVE
+#define NARGSAVE 4
+#endif
+
+#define LOCALSZ 2 /* gp, ra */
+#define FRAMESZ ((((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK)
+
+#define RAOFF (FRAMESZ - (1*SZREG))
+#define GPOFF (FRAMESZ - (2*SZREG))
+
+#define A0OFF (FRAMESZ + (0*SZREG))
+#define A1OFF (FRAMESZ + (1*SZREG))
+#define A2OFF (FRAMESZ + (2*SZREG))
+#define A3OFF (FRAMESZ + (3*SZREG))
+
+ .text
+
+#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
+#define STUB_ENTRY(x) \
+ .if x < 10; \
+ .globl _ZN14nsXPTCStubBase5Stub ##x ##Ev; \
+ .type _ZN14nsXPTCStubBase5Stub ##x ##Ev,@function; \
+ .aent _ZN14nsXPTCStubBase5Stub ##x ##Ev,0; \
+_ZN14nsXPTCStubBase5Stub ##x ##Ev:; \
+ SETUP_GP; \
+ li t0,x; \
+ b sharedstub; \
+ .elseif x < 100; \
+ .globl _ZN14nsXPTCStubBase6Stub ##x ##Ev; \
+ .type _ZN14nsXPTCStubBase6Stub ##x ##Ev,@function; \
+ .aent _ZN14nsXPTCStubBase6Stub ##x ##Ev,0; \
+_ZN14nsXPTCStubBase6Stub ##x ##Ev:; \
+ SETUP_GP; \
+ li t0,x; \
+ b sharedstub; \
+ .elseif x < 1000; \
+ .globl _ZN14nsXPTCStubBase7Stub ##x ##Ev; \
+ .type _ZN14nsXPTCStubBase7Stub ##x ##Ev,@function; \
+ .aent _ZN14nsXPTCStubBase7Stub ##x ##Ev,0; \
+_ZN14nsXPTCStubBase7Stub ##x ##Ev:; \
+ SETUP_GP; \
+ li t0,x; \
+ b sharedstub; \
+ .else; \
+ .err; \
+ .endif
+#else /* not G++ V3 ABI */
+#define STUB_ENTRY(x) \
+ .globl Stub ##x ##__14nsXPTCStubBase; \
+ .type Stub ##x ##__14nsXPTCStubBase,@function; \
+ .aent Stub ##x ##__14nsXPTCStubBase,0; \
+Stub ##x ##__14nsXPTCStubBase:; \
+ SETUP_GP; \
+ li t0,x; \
+ b sharedstub
+#endif /* G++ V3 ABI */
+
+# SENTINEL_ENTRY is handled in the cpp file.
+#define SENTINEL_ENTRY(x)
+
+#
+# open a dummy frame for the function entries
+#
+ .align 2
+ .type dummy,@function
+ .ent dummy, 0
+ .frame sp, FRAMESZ, ra
+dummy:
+ SETUP_GP
+
+#include "xptcstubsdef.inc"
+
+sharedstub:
+ subu sp, FRAMESZ
+
+ # specify the save register mask for gp, ra, a0-a3
+ .mask 0x900000F0, RAOFF-FRAMESZ
+
+ sw ra, RAOFF(sp)
+ SAVE_GP(GPOFF)
+
+ # Micro-optimization: a0 is already loaded, and its slot gets
+ # ignored by PrepareAndDispatch, so no need to save it here.
+ # sw a0, A0OFF(sp)
+ sw a1, A1OFF(sp)
+ sw a2, A2OFF(sp)
+ sw a3, A3OFF(sp)
+
+ la t9, PrepareAndDispatch
+
+ # t0 is methodIndex
+ move a1, t0
+ # have a2 point to the begin of the argument space on stack
+ addiu a2, sp, FRAMESZ
+
+ # PrepareAndDispatch(that, methodIndex, args)
+ jalr t9
+
+ # Micro-optimization: Using jalr explicitly has the side-effect
+ # of not triggering .cprestore. This is ok because we have no
+ # gp reference below this point. It also allows better
+ # instruction sscheduling.
+ # lw gp, GPOFF(fp)
+
+ lw ra, RAOFF(sp)
+ addiu sp, FRAMESZ
+ j ra
+ END(dummy)