Package: iceowl Version: 0.5-2 Tags: patch Iceowl currently fails to build on mips/mipsel because it doesn't carry the usual set of mozilla patches which add MIPS support.
The three patches attached fix the problem, they are derived from the xulrunner ones. It looks like iceowl should eventually use most of the xulrunner patches, they fix a number of problems which seem to be common to both packages. Thiemo
#! /bin/sh /usr/share/dpatch/dpatch-run ## 38_mips_xpcom.dpatch by Mike Hommey <[EMAIL PROTECTED]> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Patch from Thiemo Seufer to fix mips. bz#258429 @DPATCH@ === xpcom/reflect/xptcall/src/md/unix/Makefile.in ================================================================== --- mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in (revision 22) +++ mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in (local) @@ -227,13 +227,9 @@ 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__ +AS := $(CC) $(CFLAGS) $(INCLUDES) -c -x assembler-with-cpp endif endif -endif ###################################################################### # PowerPC @@ -378,10 +374,8 @@ 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 ================================================================== --- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s (revision 22) +++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s (local) @@ -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 +# 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 -# 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). +#define LOCALSZ 3 /* gp, fp, ra */ +#define FRAMESZ ((((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK) -LOCALSZ=4 # s0, s1, ra, gp -NARGSAVE=4 # a0, a1, a2, a3 -HIFRAMESZ=(LOCALSZ*SZREG) -LOFRAMESZ=(NARGSAVE*SZREG) -FRAMESZ=(HIFRAMESZ+LOFRAMESZ+ALSZ)&ALMASK +#define RAOFF (FRAMESZ - (1*SZREG)) +#define FPOFF (FRAMESZ - (2*SZREG)) +#define GPOFF (FRAMESZ - (3*SZREG)) -# 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) +#define A0OFF (FRAMESZ + (0*SZREG)) +#define A1OFF (FRAMESZ + (1*SZREG)) +#define A2OFF (FRAMESZ + (2*SZREG)) +#define A3OFF (FRAMESZ + (3*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) + .text - # - # _XPTC_InvokeByIndex(that, methodIndex, paramCount, params) - # a0 a1 a2 a3 +# +# _XPTC_InvokeByIndex(that, methodIndex, paramCount, params) +# a0 a1 a2 a3 -NESTED(_XPTC_InvokeByIndex, FRAMESZ, ra) - - .set noreorder - .cpload t9 - .set reorder - + .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) + # specify the save register mask for gp, fp, ra, a3 - a0 + .mask 0xD00000F0, RAOFF-FRAMESZ - # thou shalt not use .cprestore if yer frame has variable size... - # .cprestore GPOFF + sw ra, RAOFF(sp) + sw fp, FPOFF(sp) - REG_S ra, RAOFF(sp) + # we can't use .cprestore in a variable stack frame + sw gp, GPOFF(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) + sw a0, A0OFF(sp) + sw a1, A1OFF(sp) + sw a2, A2OFF(sp) + sw a3, A3OFF(sp) - REG_S a0, A0OFF(sp) - REG_S a1, A1OFF(sp) - REG_S a2, A2OFF(sp) - REG_S a3, A3OFF(sp) + # save bottom of fixed frame + move fp, sp - # invoke_count_words(paramCount, params) + # 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) - jal invoke_count_words - lw gp, GPOFF(sp) + # 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 - # 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 - - # copy the param into the stack areas + # 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) + # 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) - move sp, s0 # get orig sp back, popping params and argsave + # back to the variable stack frame + addu sp, 16 - 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 + # 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) + # 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 */ - # 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 + # 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) - REG_L a1, 1*SZREG(s1) - REG_L a2, 2*SZREG(s1) - REG_L a3, 3*SZREG(s1) + jalr t9 + # Micro-optimization: There's no gp usage below this point, so + # we don't reload. + # lw gp, GPOFF(fp) - l.d $f13, 8(s1) - l.d $f14, 16(s1) + # leave variable stack frame + move sp, fp - # 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 + lw ra, RAOFF(sp) + lw fp, FPOFF(sp) - jalr ra, t9 - lw gp, GPOFF(s0) - - move sp, s0 - - 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 ================================================================== --- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp (revision 22) +++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp (local) @@ -24,6 +24,7 @@ * Contributor(s): * Stuart Parmenter <[EMAIL PROTECTED]> * Brendan Eich <[EMAIL PROTECTED]> + * Thiemo Seufer <[EMAIL PROTECTED]> * * Alternatively, the contents of this file may be used under the terms of * either of the GNU General Public License Version 2 or later (the "GPL"), @@ -52,10 +53,8 @@ // 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; @@ -68,6 +67,9 @@ result++; result++; break; + + default: + break; } } return (result + 1) & ~(PRUint32)1; @@ -88,8 +90,6 @@ continue; } - *((void**)d) = s->val.p; - switch(s->type) { case nsXPTType::T_I64 : @@ -104,6 +104,9 @@ if ((PRWord)d & 4) d++; *((double*) d) = s->val.d; d++; break; + default: + *((void**)d) = s->val.p; + break; } } } @@ -118,5 +121,4 @@ PRUint32 paramCount, nsXPTCVariant* params) { return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params); -} - +} === xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s ================================================================== --- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s (revision 22) +++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s (local) @@ -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)
#! /bin/sh /usr/share/dpatch/dpatch-run ## 38_sparc64_unichar_alignment.dpatch by Mike Hommey <[EMAIL PROTECTED]> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Patch from bz#161826 to fix alignment issues on sparc64. @DPATCH@ === gfx/src/gtk/nsFontMetricsPango.cpp ================================================================== Index: mozilla/gfx/src/gtk/nsFontMetricsPango.cpp =================================================================== --- mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 2007-11-03 02:02:16.000000000 +0000 +++ mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 2007-11-03 14:20:34.000000000 +0000 @@ -536,11 +536,23 @@ nsRenderingContextGTK *aContext) { nsresult rv = NS_OK; - + gchar *text = NULL; PangoLayout *layout = pango_layout_new(mPangoContext); - gchar *text = g_utf16_to_utf8(aString, aLength, - NULL, NULL, NULL); + // Just copy the aString to ensure the alignment, + // it is not used anywhere else. + PRUnichar* dummy = (PRUnichar *) PR_Malloc(aLength*sizeof(PRUnichar)); + if(!dummy) { +#ifdef DEBUG + NS_WARNING("nsFontMetricsPango::GetTextDimensions malloc() failed"); +#endif + rv = NS_ERROR_FAILURE; + goto out; + } + memcpy(dummy, aString, aLength*sizeof(PRUnichar)); + text = g_utf16_to_utf8(dummy, aLength, + NULL, NULL, NULL); + PR_Free(dummy); if (!text) { #ifdef DEBUG @@ -581,6 +593,7 @@ loser: g_free(text); + out: g_object_unref(layout); return rv; Index: mozilla/intl/unicharutil/util/nsUnicharUtils.h =================================================================== --- mozilla/intl/unicharutil/util/nsUnicharUtils.h 2007-11-03 02:02:15.000000000 +0000 +++ mozilla/intl/unicharutil/util/nsUnicharUtils.h 2007-11-03 14:25:41.000000000 +0000 @@ -82,7 +82,7 @@ PRUnichar ToUpperCase(PRUnichar); PRUnichar ToLowerCase(PRUnichar); -#define NEED_STRICT_ALIGNMENT defined(__sparc__) || defined(__alpha__) || defined(__mips__) +#define NEED_STRICT_ALIGNMENT defined(__sparc__) || defined(__alpha__) || defined(__mips__) || defined(__ia64) PRUnichar GetUnichar(const void *); void SetUnichar(void *, PRUnichar);
#! /bin/sh /usr/share/dpatch/dpatch-run ## 68_mips_performance.dpatch by Mike Hommey <[EMAIL PROTECTED]> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Patch from Thiemo Seufer to increase stability and performance on mips. @DPATCH@ === config/rules.mk ================================================================== --- mozilla/config/rules.mk (revision 22) +++ mozilla/config/rules.mk (local) @@ -456,15 +456,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 === configure.in ================================================================== --- mozilla/configure.in (revision 22) +++ mozilla/configure.in (local) @@ -1481,8 +1481,6 @@ MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1 ;; mips*) - CFLAGS="$CFLAGS -Wa,-xgot" - CXXFLAGS="$CXXFLAGS -Wa,-xgot" ;; esac ;;