[Mono-list] Crash Compiling on x86_64
Paolo Molaro
lupus at ximian.com
Thu Feb 23 12:31:01 EST 2006
On 02/23/06 Jonathan S. Chambers wrote:
> I get the following mcs crash when compiling latest from svn on
> FC4 x86_64. I don't see any problems on my x86 machine. Anyone else
> seeing this?
It seems the amd64 port has a bug dealing with negative offsets in the
new interface call sequence.
The attached patch works around the issue, until someone has the time to
fix it. Note this will slow down execution...
lupus
--
-----------------------------------------------------------------
lupus at debian.org debian/rules
lupus at ximian.com Monkeys do it better
-------------- next part --------------
Index: mono/mini/mini-amd64.c
===================================================================
--- mono/mini/mini-amd64.c (revision 57168)
+++ mono/mini/mini-amd64.c (working copy)
@@ -4764,7 +4764,7 @@
mono_arch_get_vcall_slot_addr (guint8* code, gpointer *regs)
{
guint32 reg;
- guint32 disp;
+ gint32 disp;
guint8 rex = 0;
/* go to the start of the call instruction
@@ -4783,7 +4783,7 @@
*/
if ((code [0] == 0x41) && (code [1] == 0xff) && (code [2] == 0x15)) {
/* call OFFSET(%rip) */
- disp = *(guint32*)(code + 3);
+ disp = *(gint32*)(code + 3);
return (gpointer*)(code + disp + 7);
}
else if ((code [1] == 0xff) && (amd64_modrm_reg (code [2]) == 0x2) && (amd64_modrm_mod (code [2]) == 0x2)) {
@@ -4791,7 +4791,7 @@
if (IS_REX (code [0]))
rex = code [0];
reg = amd64_modrm_rm (code [2]);
- disp = *(guint32*)(code + 3);
+ disp = *(gint32*)(code + 3);
//printf ("B: [%%r%d+0x%x]\n", reg, disp);
}
else if (code [2] == 0xe8) {
@@ -4807,7 +4807,7 @@
if (IS_REX (code [3]))
rex = code [3];
reg = amd64_modrm_rm (code [5]);
- disp = *(guint8*)(code + 6);
+ disp = *(gint8*)(code + 6);
//printf ("B: [%%r%d+0x%x]\n", reg, disp);
}
else if ((code [5] == 0xff) && (amd64_modrm_reg (code [6]) == 0x2) && (amd64_modrm_mod (code [6]) == 0x0)) {
Index: mono/mini/tramp-amd64.c
===================================================================
--- mono/mini/tramp-amd64.c (revision 57168)
+++ mono/mini/tramp-amd64.c (working copy)
@@ -64,6 +64,7 @@
void
mono_arch_patch_callsite (guint8 *code, guint8 *addr)
{
+ return;
if (((code [-13] == 0x49) && (code [-12] == 0xbb)) || (code [-5] == 0xe8)) {
if (code [-5] != 0xe8)
InterlockedExchangePointer ((gpointer*)(code - 11), addr);
@@ -75,7 +76,7 @@
}
else if ((code [-7] == 0x41) && (code [-6] == 0xff) && (code [-5] == 0x15)) {
/* call *<OFFSET>(%rip) */
- gpointer *got_entry = (gpointer*)((guint8*)code + (*(guint32*)(code - 4)));
+ gpointer *got_entry = (gpointer*)((guint8*)code + (*(gint32*)(code - 4)));
InterlockedExchangePointer (got_entry, addr);
}
}
@@ -85,6 +86,7 @@
{
code -= 3;
+ return;
/*
* A given byte sequence can match more than case here, so we have to be
* really careful about the ordering of the cases. Longer sequences
@@ -142,14 +144,15 @@
{
guint8 rex = 0;
guint32 reg;
- guint32 disp;
+ gint32 disp;
+ return;
if ((code [-3] == 0xff) && (amd64_modrm_reg (code [-2]) == 0x2) && (amd64_modrm_mod (code [-2]) == 0x1)) {
/* call *[reg+disp8] */
if (IS_REX (code [-4]))
rex = code [-4];
reg = amd64_modrm_rm (code [-2]);
- disp = *(guint8*)(code - 1);
+ disp = *(gint8*)(code - 1);
//printf ("B: [%%r%d+0x%x]\n", reg, disp);
}
else {
More information about the Mono-list
mailing list