mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 17:24:29 +00:00
Bug 684659 - Drop references to really old gcc versions.
This commit is contained in:
parent
537fecaa3c
commit
b45d5dc70d
@ -55,38 +55,5 @@
|
||||
#define SYMBOL_UNDERSCORE
|
||||
#endif
|
||||
|
||||
/*
|
||||
What are those keeper functions?
|
||||
|
||||
The problem: gcc doesn't know that the assembler routines call
|
||||
static functions so gcc may not emit the definition (i.e., the
|
||||
code) for these functions. In gcc 3.1 and up
|
||||
"__attribute__ ((used))" exists and solves the problem.
|
||||
For older gcc versions it's not so easy. One could use the
|
||||
-fkeep-inline-functions but that keeps a surprising number of
|
||||
functions which bloats the compiled library. It seems otherwise
|
||||
harmless, though. Alternatively, one could use
|
||||
-fno-inline-functions which works right now but might cause a
|
||||
slowdown under some circumstances. The problem with these methods
|
||||
is that they do not automatically adapt to the compiler used.
|
||||
|
||||
The best solution seems to be to create dummy functions that
|
||||
reference the appropriate static functions. It's then necessary
|
||||
to "use" these functions in a way that gcc will not optimize
|
||||
away. The keeper functions use assembly code to confuse gcc.
|
||||
|
||||
One drawback is that the keeper functions are externally visible
|
||||
so they shouldn't do anything harmful.
|
||||
|
||||
With the right linker, one could make the keeper functions local
|
||||
so they wouldn't be visible.
|
||||
*/
|
||||
|
||||
|
||||
// gcc 3.1 and up
|
||||
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||
#define ATTRIBUTE_USED __attribute__ ((__used__))
|
||||
#else
|
||||
#define ATTRIBUTE_USED
|
||||
#endif
|
||||
|
||||
|
@ -162,11 +162,7 @@ __asm__(
|
||||
"bis $16,$16,$1\n\t" /* load "this" */
|
||||
"ldq $2,16($15)\n\t" /* load "methodIndex" */
|
||||
"ldq $1,0($1)\n\t" /* load vtable */
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
"s8addq $2,$31,$2\n\t" /* vtable index = "methodIndex" * 8 */
|
||||
#else /* not G++ V3 ABI */
|
||||
"s8addq $2,16,$2\n\t" /* vtable index = "methodIndex" * 8 + 16 */
|
||||
#endif /* G++ V3 ABI */
|
||||
"addq $1,$2,$1\n\t"
|
||||
"ldq $27,0($1)\n\t" /* load address of function */
|
||||
"jsr $26,($27),0\n\t" /* call virtual function */
|
||||
|
@ -187,11 +187,7 @@ NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
|
||||
paramCount, params);
|
||||
|
||||
vtable = *reinterpret_cast<vtable_func **>(that);
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
func = vtable[methodIndex];
|
||||
#else /* non G++ V3 ABI */
|
||||
func = vtable[2 + methodIndex];
|
||||
#endif
|
||||
|
||||
return func(that, stack_space[base_size * 2 - 3],
|
||||
stack_space[base_size * 2 - 2],
|
||||
@ -386,11 +382,7 @@ NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
|
||||
PRUint32 paramCount, nsXPTCVariant* params)
|
||||
{
|
||||
vtable_func *vtable = *reinterpret_cast<vtable_func **>(that);
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
vtable_func func = vtable[methodIndex];
|
||||
#else /* non G++ V3 ABI */
|
||||
vtable_func func = vtable[2 + methodIndex];
|
||||
#endif
|
||||
// 'register PRUint32 result asm("r0")' could be used here, but it does not
|
||||
// seem to be reliable in all cases: http://gcc.gnu.org/PR46164
|
||||
PRUint32 result;
|
||||
|
@ -191,12 +191,7 @@ NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
|
||||
"ldr r1, [r0, #0] \n\t" /* get that->vtable offset */
|
||||
"ldr r2, [%1, #4] \n\t"
|
||||
"mov r2, r2, lsl #2 \n\t" /* a vtable_entry(x)=8 + (4 bytes * x) */
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
"ldr ip, [r1, r2] \n\t" /* get method adress from vtable */
|
||||
#else /* non G++ V3 ABI */
|
||||
"add r2, r2, #8 \n\t" /* with this compilers */
|
||||
"ldr ip, [r1, r2] \n\t" /* get method adress from vtable */
|
||||
#endif
|
||||
"cmp r4, #12 \n\t" /* more than 3 arguments??? */
|
||||
"ldmgtia sp!, {r1, r2, r3}\n\t" /* yes: load arguments for r1-r3 */
|
||||
"subgt r4, r4, #12 \n\t" /* and correct the stack pointer */
|
||||
|
@ -137,11 +137,7 @@ _NS_InvokeByIndex_P:
|
||||
# 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
|
||||
|
@ -113,11 +113,7 @@ NESTED(_NS_InvokeByIndex_P, FRAMESZ, ra)
|
||||
# which must then be saved in t9
|
||||
lw t9, 0(a0)
|
||||
addu t9, t9, t1
|
||||
#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 */
|
||||
|
||||
# get register save area from invoke_copy_to_stack
|
||||
subu t1, t3, 64
|
||||
|
@ -107,9 +107,6 @@ NS_InvokeByIndex_P:
|
||||
lwz r3,8(r31) // r3 <= that
|
||||
lwz r4,12(r31) // r4 <= methodIndex
|
||||
lwz r5,0(r3) // r5 <= vtable ( == *that )
|
||||
#if !((__GNUC__ == 3 && __GNUC_MINOR__ < 2) || __GXX_ABI_VERSION >= 100) // G++ pre-V3 ABI
|
||||
addi r4,r4,2 // skip first two vtable entries
|
||||
#endif
|
||||
slwi r4,r4,2 // convert to offset ( *= 4 )
|
||||
lwzx r0,r5,r4 // r0 <= methodpointer ( == vtable + offset )
|
||||
|
||||
|
@ -102,9 +102,6 @@ NS_InvokeByIndex_P:
|
||||
lwz r3,8(r31) // r3 <= that
|
||||
lwz r4,12(r31) // r4 <= methodIndex
|
||||
lwz r5,0(r3) // r5 <= vtable ( == *that )
|
||||
#if !((__GNUC__ == 3 && __GNUC_MINOR__ < 2) || __GXX_ABI_VERSION >= 100) // G++ pre-V3 ABI
|
||||
addi r4,r4,2 // skip first two vtable entries
|
||||
#endif
|
||||
slwi r4,r4,2 // convert to offset ( *= 4 )
|
||||
lwzx r0,r5,r4 // r0 <= methodpointer ( == vtable + offset )
|
||||
|
||||
|
@ -37,8 +37,6 @@
|
||||
|
||||
/* Platform specific code to invoke XPCOM methods on native objects */
|
||||
|
||||
#ifdef __GNUC__ /* Gnu compiler. */
|
||||
|
||||
#include "xptcprivate.h"
|
||||
#include "xptc_platforms_unixish_x86.h"
|
||||
#include "xptc_gcc_x86_unix.h"
|
||||
@ -69,27 +67,6 @@ invoke_copy_to_stack(PRUint32 paramCount, nsXPTCVariant* s, PRUint32* d)
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
// NOTE! See xptc_gcc_x86_unix.h for the reason why this function exists.
|
||||
#if (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ == 0))
|
||||
PRUint32
|
||||
xptc_invoke_copy_to_stack_keeper (void)
|
||||
{
|
||||
PRUint32 dummy1;
|
||||
void ATTRIBUTE_USED __attribute__ ((regparm(3))) (*dummy2)
|
||||
(PRUint32, nsXPTCVariant*, PRUint32*) = invoke_copy_to_stack;
|
||||
|
||||
// dummy2 references invoke_copy_to_stack, now we have to "use" it
|
||||
__asm__ __volatile__ (
|
||||
""
|
||||
: "=&a" (dummy1)
|
||||
: "g" (dummy2)
|
||||
);
|
||||
|
||||
return dummy1 & 0xF0F00000;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
EXPORT_XPCOM_API(nsresult)
|
||||
NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
|
||||
@ -187,11 +164,7 @@ __asm__ (
|
||||
"pushl %ecx\n\t"
|
||||
"movl (%ecx), %edx\n\t"
|
||||
"movl 0x0c(%ebp), %eax\n\t" /* function index */
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
"leal (%edx,%eax,4), %edx\n\t"
|
||||
#else /* not G++ V3 ABI */
|
||||
"leal 8(%edx,%eax,4), %edx\n\t"
|
||||
#endif /* G++ V3 ABI */
|
||||
#endif
|
||||
"call *(%edx)\n\t"
|
||||
#ifdef MOZ_PRESERVE_PIC
|
||||
@ -204,7 +177,3 @@ __asm__ (
|
||||
".size " SYMBOL_UNDERSCORE "NS_InvokeByIndex_P, . -" SYMBOL_UNDERSCORE "NS_InvokeByIndex_P\n\t"
|
||||
#endif
|
||||
);
|
||||
|
||||
#else
|
||||
#error "can't find a compiler to use"
|
||||
#endif /* __GNUC__ */
|
||||
|
@ -162,11 +162,7 @@ __asm__(
|
||||
"bis $16,$16,$1\n\t" /* load "this" */
|
||||
"ldq $2,16($15)\n\t" /* load "methodIndex" */
|
||||
"ldq $1,0($1)\n\t" /* load vtable */
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
"s8addq $2,$31,$2\n\t" /* vtable index = "methodIndex" * 8 */
|
||||
#else /* not G++ V3 ABI */
|
||||
"s8addq $2,16,$2\n\t" /* vtable index = "methodIndex" * 8 + 16 */
|
||||
#endif /* G++ V3 ABI */
|
||||
"addq $1,$2,$1\n\t"
|
||||
"ldq $27,0($1)\n\t" /* load address of function */
|
||||
"jsr $26,($27),0\n\t" /* call virtual function */
|
||||
|
@ -145,11 +145,7 @@ NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
|
||||
"addw #12, %%sp\n\t"
|
||||
"movel %1, %%sp@-\n\t"
|
||||
"movel %1@, %%a0\n\t"
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
"movel %%a0@(%2:l:4), %%a0\n\t"
|
||||
#else /* not V3 */
|
||||
"movel %%a0@(8,%2:l:4), %%a0\n\t"
|
||||
#endif
|
||||
"jbsr %%a0@\n\t" /* safe to not cleanup sp */
|
||||
"lea %%sp@(4,%5:l), %%sp\n\t"
|
||||
"movel %%d0, %0"
|
||||
|
@ -205,11 +205,7 @@ NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
|
||||
PRUint32 paramCount, nsXPTCVariant* params)
|
||||
{
|
||||
PRUint32 *vtable = *(PRUint32 **)that;
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
PRUint32 method = vtable[methodIndex];
|
||||
#else /* not G++ V3 ABI */
|
||||
PRUint32 method = vtable[methodIndex + 2];
|
||||
#endif /* G++ V3 ABI */
|
||||
PRUint32 overflow = invoke_count_words (paramCount, params);
|
||||
PRUint32 result;
|
||||
|
||||
|
@ -199,11 +199,7 @@ NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
|
||||
PRUint32 paramCount, nsXPTCVariant* params)
|
||||
{
|
||||
PRUint64 *vtable = *(PRUint64 **)that;
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
PRUint64 method = vtable[methodIndex];
|
||||
#else /* not G++ V3 ABI */
|
||||
PRUint64 method = vtable[methodIndex + 2];
|
||||
#endif /* G++ V3 ABI */
|
||||
PRUint64 overflow = invoke_count_words (paramCount, params);
|
||||
PRUint64 result;
|
||||
|
||||
|
@ -194,12 +194,7 @@ XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
|
||||
"ldr r1, [r0, #0] \n\t" /* get that->vtable offset */
|
||||
"ldr r2, [%1, #4] \n\t"
|
||||
"mov r2, r2, lsl #2 \n\t" /* a vtable_entry(x)=8 + (4 bytes * x) */
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
"ldr ip, [r1, r2] \n\t" /* get method adress from vtable */
|
||||
#else /* non G++ V3 ABI */
|
||||
"add r2, r2, #8 \n\t" /* with this compilers */
|
||||
"ldr ip, [r1, r2] \n\t" /* get method adress from vtable */
|
||||
#endif
|
||||
"cmp r4, #12 \n\t" /* more than 3 arguments??? */
|
||||
"ldmgtia sp!, {r1, r2, r3}\n\t" /* yes: load arguments for r1-r3 */
|
||||
"subgt r4, r4, #12 \n\t" /* and correct the stack pointer */
|
||||
|
@ -77,7 +77,6 @@ EXPORT_XPCOM_API(nsresult)
|
||||
NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
|
||||
PRUint32 paramCount, nsXPTCVariant* params)
|
||||
{
|
||||
#ifdef __GNUC__ /* Gnu compiler. */
|
||||
PRUint32 result;
|
||||
/* Each param takes at most 2, 4-byte words
|
||||
It doesn't matter if we push too many words, and calculating the exact
|
||||
@ -142,11 +141,7 @@ NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
|
||||
"pushl %%ecx\n\t"
|
||||
"movl (%%ecx), %%edx\n\t"
|
||||
"movl %5, %%eax\n\t" /* function index */
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
"leal (%%edx,%%eax,4), %%edx\n\t"
|
||||
#else /* not G++ V3 ABI */
|
||||
"leal 8(%%edx,%%eax,4), %%edx\n\t"
|
||||
#endif /* G++ V3 ABI */
|
||||
#endif
|
||||
"call *(%%edx)\n\t" /* safe to not cleanup esp */
|
||||
#ifdef KEEP_STACK_16_BYTE_ALIGNED
|
||||
@ -179,9 +174,4 @@ NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
|
||||
);
|
||||
|
||||
return result;
|
||||
|
||||
#else
|
||||
#error "can't find a compiler to use"
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
}
|
||||
|
@ -199,8 +199,6 @@ symbol ":" "\n\t" \
|
||||
"br $31,$SharedStub..ng" "\n\t" \
|
||||
".end " symbol
|
||||
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
|
||||
#define STUB_ENTRY(n) \
|
||||
__asm__( \
|
||||
".if "#n" < 10" "\n\t" \
|
||||
@ -214,15 +212,6 @@ __asm__( \
|
||||
".endif" \
|
||||
);
|
||||
|
||||
#else /* not G++ V3 ABI */
|
||||
|
||||
#define STUB_ENTRY(n) \
|
||||
__asm__( \
|
||||
STUB_MANGLED_ENTRY(n, "Stub"#n"__14nsXPTCStubBase") \
|
||||
);
|
||||
|
||||
#endif /* G++ V3 ABI */
|
||||
|
||||
#define SENTINEL_ENTRY(n) \
|
||||
nsresult nsXPTCStubBase::Sentinel##n() \
|
||||
{ \
|
||||
|
@ -156,7 +156,6 @@ PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex,
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
// Linux/x86-64 uses gcc >= 3.1
|
||||
#define STUB_ENTRY(n) \
|
||||
asm(".section \".text\"\n\t" \
|
||||
@ -232,7 +231,3 @@ nsresult nsXPTCStubBase::Sentinel##n() \
|
||||
}
|
||||
|
||||
#include "xptcstubsdef.inc"
|
||||
|
||||
#else
|
||||
#error "Unsupported compiler. Use gcc >= 3.1 for Linux/x86-64."
|
||||
#endif /* __GNUC__ */
|
||||
|
@ -183,7 +183,7 @@ SharedStub: \n\
|
||||
*
|
||||
* This will work with or without optimisation.
|
||||
*/
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
|
||||
/*
|
||||
* Note : As G++3 ABI contains the length of the functionname in the
|
||||
* mangled name, it is difficult to get a generic assembler mechanism like
|
||||
@ -237,19 +237,6 @@ nsresult nsXPTCStubBase::Stub##n () \
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* G++2.95 ABI */
|
||||
|
||||
#define STUB_ENTRY(n) \
|
||||
__asm__( \
|
||||
".section \".text\"\n" \
|
||||
" .align\n" \
|
||||
" .globl Stub"#n"__14nsXPTCStubBase\n" \
|
||||
" .type Stub"#n"__14nsXPTCStubBase,#function\n\n" \
|
||||
"Stub"#n"__14nsXPTCStubBase:\n" \
|
||||
" mov ip, #"#n"\n" \
|
||||
" b SharedStub\n\t");
|
||||
|
||||
#endif
|
||||
|
||||
#define SENTINEL_ENTRY(n) \
|
||||
nsresult nsXPTCStubBase::Sentinel##n() \
|
||||
|
@ -173,7 +173,7 @@ SharedStub: \n\
|
||||
*
|
||||
* This will work with or without optimisation.
|
||||
*/
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
|
||||
/*
|
||||
* Note : As G++3 ABI contains the length of the functionname in the
|
||||
* mangled name, it is difficult to get a generic assembler mechanism like
|
||||
@ -227,19 +227,6 @@ nsresult nsXPTCStubBase::Stub##n () \
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* G++2.95 ABI */
|
||||
|
||||
#define STUB_ENTRY(n) \
|
||||
__asm__( \
|
||||
".section \".text\"\n" \
|
||||
" .align\n" \
|
||||
" .globl Stub"#n"__14nsXPTCStubBase\n" \
|
||||
" .type Stub"#n"__14nsXPTCStubBase,#function\n\n" \
|
||||
"Stub"#n"__14nsXPTCStubBase:\n" \
|
||||
" mov ip, #"#n"\n" \
|
||||
" b SharedStub\n\t");
|
||||
|
||||
#endif
|
||||
|
||||
#define SENTINEL_ENTRY(n) \
|
||||
nsresult nsXPTCStubBase::Sentinel##n() \
|
||||
|
@ -49,7 +49,6 @@
|
||||
|
||||
.text
|
||||
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
#define STUB_ENTRY(x) \
|
||||
.if x < 10; \
|
||||
.globl _ZN14nsXPTCStubBase5Stub ##x ##Ev; \
|
||||
@ -78,16 +77,6 @@ _ZN14nsXPTCStubBase7Stub ##x ##Ev:; \
|
||||
.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)
|
||||
|
@ -61,7 +61,6 @@ F19OFF=FRAMESZ-(10*SZREG)
|
||||
|
||||
#define SENTINEL_ENTRY(n) /* defined in cpp file, not here */
|
||||
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
#define STUB_ENTRY(x) \
|
||||
.if x < 10; \
|
||||
MAKE_STUB(x, _ZN14nsXPTCStubBase5Stub ##x ##Ev); \
|
||||
@ -72,10 +71,6 @@ F19OFF=FRAMESZ-(10*SZREG)
|
||||
.else; \
|
||||
.err; \
|
||||
.endif
|
||||
#else /* not G++ V3 ABI */
|
||||
#define STUB_ENTRY(x) \
|
||||
MAKE_STUB(x, Stub ##x ##__14nsXPTCStubBase)
|
||||
#endif /* G++ V3 ABI */
|
||||
|
||||
#define MAKE_STUB(x, name) \
|
||||
.globl name; \
|
||||
|
@ -37,8 +37,6 @@
|
||||
|
||||
/* Implement shared vtbl methods. */
|
||||
|
||||
#ifdef __GNUC__ /* Gnu Compiler. */
|
||||
|
||||
#include "xptcprivate.h"
|
||||
#include "xptiprivate.h"
|
||||
#include "xptc_platforms_unixish_x86.h"
|
||||
@ -101,25 +99,6 @@ PrepareAndDispatch(uint32 methodIndex, nsXPTCStubBase* self, PRUint32* args)
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
// NOTE! See xptc_gcc_x86_unix.h for the reason this function exists.
|
||||
#if (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ == 0))
|
||||
PRUint32
|
||||
xptc_PrepareAndDispatch_keeper (void)
|
||||
{
|
||||
PRUint32 dummy1;
|
||||
nsresult ATTRIBUTE_USED __attribute__ ((regparm (3))) (*dummy2)
|
||||
(uint32, nsXPTCStubBase *, PRUint32*) = PrepareAndDispatch;
|
||||
// dummy2 references PrepareAndDispatch, now "use" it
|
||||
__asm__ __volatile__ (
|
||||
""
|
||||
: "=&a" (dummy1)
|
||||
: "g" (dummy2)
|
||||
);
|
||||
return dummy1 & 0xF0F00000;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
// gcc3 mangling tends to insert the length of the method name
|
||||
#define STUB_ENTRY(n) \
|
||||
asm(".text\n\t" \
|
||||
@ -151,18 +130,6 @@ asm(".text\n\t" \
|
||||
".else\n\t" \
|
||||
".size " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev,.-" SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \
|
||||
".endif");
|
||||
#else
|
||||
#define STUB_ENTRY(n) \
|
||||
asm(".text\n\t" \
|
||||
".align 2\n\t" \
|
||||
".globl " SYMBOL_UNDERSCORE "Stub" #n "__14nsXPTCStubBase\n\t" \
|
||||
".hidden " SYMBOL_UNDERSCORE "Stub" #n "__14nsXPTCStubBase\n\t" \
|
||||
".type " SYMBOL_UNDERSCORE "Stub" #n "__14nsXPTCStubBase,@function\n" \
|
||||
SYMBOL_UNDERSCORE "Stub" #n "__14nsXPTCStubBase:\n\t" \
|
||||
"movl $" #n ", %eax\n\t" \
|
||||
"jmp " SYMBOL_UNDERSCORE "SharedStub\n\t" \
|
||||
".size " SYMBOL_UNDERSCORE "Stub" #n "__14nsXPTCStubBase,.-" SYMBOL_UNDERSCORE "Stub" #n "__14nsXPTCStubBase");
|
||||
#endif
|
||||
|
||||
// static nsresult SharedStub(PRUint32 methodIndex) __attribute__((regparm(1)))
|
||||
asm(".text\n\t"
|
||||
@ -187,7 +154,3 @@ void
|
||||
xptc_dummy()
|
||||
{
|
||||
}
|
||||
|
||||
#else
|
||||
#error "can't find a compiler to use"
|
||||
#endif /* __GNUC__ */
|
||||
|
@ -196,8 +196,6 @@ symbol ":" "\n\t" \
|
||||
"br $31,$SharedStub..ng" "\n\t" \
|
||||
".end " symbol
|
||||
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
|
||||
#define STUB_ENTRY(n) \
|
||||
__asm__( \
|
||||
".if "#n" < 10" "\n\t" \
|
||||
@ -211,14 +209,6 @@ __asm__( \
|
||||
".endif" \
|
||||
);
|
||||
|
||||
#else /* not G++ V3 ABI */
|
||||
|
||||
#define STUB_ENTRY(n) \
|
||||
__asm__( \
|
||||
STUB_MANGLED_ENTRY(n, "Stub"#n"__14nsXPTCStubBase") \
|
||||
);
|
||||
|
||||
#endif /* G++ V3 ABI */
|
||||
|
||||
#define SENTINEL_ENTRY(n) \
|
||||
nsresult nsXPTCStubBase::Sentinel##n() \
|
||||
|
@ -166,7 +166,6 @@ SharedStub: \n\
|
||||
*
|
||||
* This will work with or without optimisation.
|
||||
*/
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
/*
|
||||
* Note : As G++3 ABI contains the length of the functionname in the
|
||||
* mangled name, it is difficult to get a generic assembler mechanism like
|
||||
@ -220,19 +219,6 @@ nsresult nsXPTCStubBase::Stub##n () \
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* G++2.95 ABI */
|
||||
|
||||
#define STUB_ENTRY(n) \
|
||||
__asm__( \
|
||||
".section \".text\"\n" \
|
||||
" .align\n" \
|
||||
" .globl Stub"#n"__14nsXPTCStubBase\n" \
|
||||
" .type Stub"#n"__14nsXPTCStubBase,#function\n\n" \
|
||||
"Stub"#n"__14nsXPTCStubBase:\n" \
|
||||
" mov ip, #"#n"\n" \
|
||||
" b SharedStub\n\t");
|
||||
|
||||
#endif
|
||||
|
||||
#define SENTINEL_ENTRY(n) \
|
||||
nsresult nsXPTCStubBase::Sentinel##n() \
|
||||
|
@ -175,9 +175,7 @@ PrepareAndDispatch(nsXPTCStubBase* self,
|
||||
// however, it's quick, dirty, and'll break when the ABI changes on
|
||||
// us, which is what we want ;-).
|
||||
|
||||
#if __GXX_ABI_VERSION < 100
|
||||
#error Prehistoric GCC not supported here
|
||||
#else
|
||||
|
||||
// gcc-3 version
|
||||
//
|
||||
// As G++3 ABI contains the length of the functionname in the mangled
|
||||
@ -233,7 +231,6 @@ __asm__ ( \
|
||||
"li 11,"#n" \n\t" \
|
||||
"b SharedStub \n" \
|
||||
);
|
||||
#endif
|
||||
|
||||
#define SENTINEL_ENTRY(n) \
|
||||
nsresult nsXPTCStubBase::Sentinel##n() \
|
||||
|
@ -204,20 +204,6 @@ PrepareAndDispatch(nsXPTCStubBase* self,
|
||||
// however, it's quick, dirty, and'll break when the ABI changes on
|
||||
// us, which is what we want ;-).
|
||||
|
||||
#if __GXX_ABI_VERSION < 100
|
||||
// gcc-2 version
|
||||
# define STUB_ENTRY(n) \
|
||||
__asm__ ( \
|
||||
".section \".text\" \n\t" \
|
||||
".align 2 \n\t" \
|
||||
".globl Stub"#n"__14nsXPTCStubBase \n\t" \
|
||||
".type Stub"#n"__14nsXPTCStubBase,@function \n\n" \
|
||||
\
|
||||
"Stub"#n"__14nsXPTCStubBase: \n\t" \
|
||||
"li 11,"#n" \n\t" \
|
||||
"b SharedStub@local \n" \
|
||||
);
|
||||
#else
|
||||
// gcc-3 version
|
||||
//
|
||||
// As G++3 ABI contains the length of the functionname in the mangled
|
||||
@ -256,7 +242,6 @@ __asm__ ( \
|
||||
"li 11,"#n" \n\t" \
|
||||
"b SharedStub@local \n" \
|
||||
);
|
||||
#endif
|
||||
|
||||
#define SENTINEL_ENTRY(n) \
|
||||
nsresult nsXPTCStubBase::Sentinel##n() \
|
||||
|
@ -184,20 +184,7 @@ PrepareAndDispatch(nsXPTCStubBase* self,
|
||||
// however, it's quick, dirty, and'll break when the ABI changes on
|
||||
// us, which is what we want ;-).
|
||||
|
||||
#if __GXX_ABI_VERSION < 100
|
||||
// gcc-2 version
|
||||
# define STUB_ENTRY(n) \
|
||||
__asm__ ( \
|
||||
".section \".text\" \n\t" \
|
||||
".align 2 \n\t" \
|
||||
".globl Stub"#n"__14nsXPTCStubBase \n\t" \
|
||||
".type Stub"#n"__14nsXPTCStubBase,@function \n\n" \
|
||||
\
|
||||
"Stub"#n"__14nsXPTCStubBase: \n\t" \
|
||||
"li 11,"#n" \n\t" \
|
||||
"b SharedStub@local \n" \
|
||||
);
|
||||
#else
|
||||
|
||||
// gcc-3 version
|
||||
//
|
||||
// As G++3 ABI contains the length of the functionname in the mangled
|
||||
@ -236,7 +223,6 @@ __asm__ ( \
|
||||
"li 11,"#n" \n\t" \
|
||||
"b SharedStub@local \n" \
|
||||
);
|
||||
#endif
|
||||
|
||||
#define SENTINEL_ENTRY(n) \
|
||||
nsresult nsXPTCStubBase::Sentinel##n() \
|
||||
|
@ -98,8 +98,6 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__ /* Gnu Compiler. */
|
||||
|
||||
#ifdef KEEP_STACK_16_BYTE_ALIGNED
|
||||
/* Make sure the stack is 16-byte aligned. Do that by aligning to 16 bytes and
|
||||
* then subtracting 4 so the three subsequent pushes result in a 16-byte aligned
|
||||
@ -162,10 +160,6 @@ nsresult nsXPTCStubBase::Stub##n() \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#else
|
||||
#error "can't find a compiler to use"
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#define SENTINEL_ENTRY(n) \
|
||||
nsresult nsXPTCStubBase::Sentinel##n() \
|
||||
{ \
|
||||
|
@ -159,7 +159,7 @@ PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex,
|
||||
}
|
||||
|
||||
// Darwin/x86-64 uses gcc >= 4.2
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 1002
|
||||
|
||||
#define STUB_ENTRY(n) \
|
||||
asm(".section __TEXT,__text\n\t" \
|
||||
".align 3\n\t" \
|
||||
@ -219,7 +219,3 @@ nsresult nsXPTCStubBase::Sentinel##n() \
|
||||
}
|
||||
|
||||
#include "xptcstubsdef.inc"
|
||||
|
||||
#else
|
||||
#error "Unsupported compiler. Use gcc >= 4.2 for Darwin/x86-64."
|
||||
#endif /* __GNUC__ */
|
||||
|
@ -158,7 +158,6 @@ PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex,
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
|
||||
// Linux/x86-64 uses gcc >= 3.1
|
||||
#define STUB_ENTRY(n) \
|
||||
asm(".section \".text\"\n\t" \
|
||||
@ -234,7 +233,3 @@ nsresult nsXPTCStubBase::Sentinel##n() \
|
||||
}
|
||||
|
||||
#include "xptcstubsdef.inc"
|
||||
|
||||
#else
|
||||
#error "Unsupported compiler. Use gcc >= 3.1 for Linux/x86-64."
|
||||
#endif /* __GNUC__ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user