* [Linux-ia64] Fwd: Bug#129641: mozilla illegal instruction fault on IA64 (with a fix)
@ 2002-01-18 2:54 Matt Chapman
2002-01-18 20:32 ` Jim Wilson
0 siblings, 1 reply; 2+ messages in thread
From: Matt Chapman @ 2002-01-18 2:54 UTC (permalink / raw)
To: linux-ia64
It was suggested that I forward this here, for the benefit of others
porting mozilla and any other software that relies on the C++ ABI.
Matt
----- Forwarded message from Matt Chapman <matthewc@cse.unsw.edu.au> -----
Package: mozilla-browser
Version: 0.9.7-4
Severity: important
Symptoms: Installation of package fails with "Illegal instruction" fault from
regxpcom; mozilla dies similarly when executing JavaScript.
This seems to be because in recent versions of g++ - since 3.0.2 according to
the ChangeLog - class vtables are arrays of function descriptors (which are
(code address, gp value) pairs) rather than arrays of function pointers (which
are pointers to function descriptors).
The following fix does the trick for me (it's a little evil, but then this kind
of code is necessarily evil :)).
Cheers,
Matt
--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ffi.old Sun Jan 6 11:03:05 2002
+++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ffi.cpp Thu Jan 17 15:34:56 2002
@@ -83,8 +83,9 @@
long offset; /* offset to beginning of object */
unsigned long rtti; /* address of run-time type info */
#endif
- void (*methods[1]) (); /* method table (variable length) */
+ unsigned long methods[1]; /* method table (variable length) */
} *vtable = *(struct vtable **) that;
+ void (*method)();
ffi_type **arg_types;
void **args;
ffi_status status;
@@ -102,6 +103,13 @@
if (status != FFI_OK)
return NS_ERROR_INVALID_ARG;
- ffi_call (&cif, vtable->methods[methodIndex], &result, args);
+/* As of g++ 3.0.2, IA64 vtables contain function descriptors - matthewc@cse.unsw.edu.au */
+#if defined(__ia64) && __GNUC__ >= 3 && !(__GNUC__ = 3 && __GNUC_MINOR__ = 0 && __GNUC_PATCHLEVEL__ < 2)
+ method = (void (*)())&vtable->methods[2*methodIndex];
+#else
+ method = (void (*)())vtable->methods[methodIndex];
+#endif
+
+ ffi_call (&cif, method, &result, args);
return result;
}
----- End forwarded message -----
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-01-18 20:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-18 2:54 [Linux-ia64] Fwd: Bug#129641: mozilla illegal instruction fault on IA64 (with a fix) Matt Chapman
2002-01-18 20:32 ` Jim Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox