2009-05-11 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Mon, 11 May 2009 13:49:16 +0000 (13:49 -0000)
committerZoltan Varga <vargaz@gmail.com>
Mon, 11 May 2009 13:49:16 +0000 (13:49 -0000)
* aot-compiler.c (emit_and_reloc_code): Move the implementation of
MONO_PATCH_INFO_GOT_OFFSET to a separate arch-specific function.
(emit_plt): Fix a warning.

svn path=/trunk/mono/; revision=133895

mono/mini/ChangeLog
mono/mini/aot-compiler.c

index eeb086d0d2ece82b15f94872ce17e0bf5d484c66..5fa3e92ee00bf0483267571965996d6c659c6d3f 100644 (file)
@@ -1,3 +1,9 @@
+2009-05-11  Zoltan Varga  <vargaz@gmail.com>
+
+       * aot-compiler.c (emit_and_reloc_code): Move the implementation of
+       MONO_PATCH_INFO_GOT_OFFSET to a separate arch-specific function.
+       (emit_plt): Fix a warning.
+
 2009-05-10  Zoltan Varga  <vargaz@gmail.com>
 
        * aot-compiler.c aot-runtime.c: Fix the build by moving is_shared_got_patch
index 297ca02e63df1e5331e43ef07691d19cf1e41796..2f231bb48780579f7b1b6dfa4b66b69c9efbe87c 100644 (file)
@@ -62,6 +62,7 @@
 #include <mono/utils/mono-logger.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-time.h>
+#include <mono/utils/mono-mmap.h>
 
 #include "mini.h"
 #include "image-writer.h"
@@ -452,6 +453,22 @@ arch_emit_direct_call (MonoAotCompile *acfg, const char *target, int *call_size)
 }
 
 #ifdef MONO_ARCH_AOT_SUPPORTED
+/*
+ * arch_emit_got_offset:
+ *
+ *   The memory pointed to by CODE should hold native code for computing the GOT
+ * address. Emit this code while patching it with the offset between code and
+ * the GOT. CODE_SIZE is set to the number of bytes emitted.
+ */
+static void
+arch_emit_got_offset (MonoAotCompile *acfg, guint8 *code, int *code_size)
+{
+       guint32 offset = mono_arch_get_patch_offset (code);
+       emit_bytes (acfg, code, offset);
+       emit_symbol_diff (acfg, "got", ".", offset);
+
+       *code_size = offset + 4;
+}
 
 /*
  * arch_emit_got_access:
@@ -1771,11 +1788,10 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
                        case MONO_PATCH_INFO_NONE:
                                break;
                        case MONO_PATCH_INFO_GOT_OFFSET: {
-                               guint32 offset = mono_arch_get_patch_offset (code + i);
-                               emit_bytes (acfg, code + i, offset);
-                               emit_symbol_diff (acfg, "got", ".", offset);
-
-                               i += offset + 4 - 1;
+                               int code_size;
+                               arch_emit_got_offset (acfg, code + i, &code_size);
+                               i += code_size - 1;
                                skip = TRUE;
                                break;
                        }