summaryrefslogtreecommitdiff
path: root/lang/ocaml/patches/patch-ac
diff options
context:
space:
mode:
Diffstat (limited to 'lang/ocaml/patches/patch-ac')
-rw-r--r--lang/ocaml/patches/patch-ac152
1 files changed, 114 insertions, 38 deletions
diff --git a/lang/ocaml/patches/patch-ac b/lang/ocaml/patches/patch-ac
index e2cca11e51e..071e6c27e16 100644
--- a/lang/ocaml/patches/patch-ac
+++ b/lang/ocaml/patches/patch-ac
@@ -1,42 +1,118 @@
-$NetBSD: patch-ac,v 1.2 2003/06/29 23:04:19 jtb Exp $
+$NetBSD: patch-ac,v 1.3 2004/04/22 09:18:36 tron Exp $
---- asmrun/signals.c.orig
-+++ asmrun/signals.c
-@@ -162,6 +162,8 @@
- void handle_signal(int sig, struct sigcontext * context)
- #elif defined(TARGET_power) && defined(SYS_rhapsody)
- void handle_signal(int sig, int code, struct sigcontext * context)
-+#elif defined(TARGET_power) && defined(SYS_bsd)
-+void handle_signal(int sig, int code, struct sigcontext * context)
- #else
- void handle_signal(int sig)
- #endif
-@@ -205,6 +207,10 @@
- /* Cached in register 30 */
- CONTEXT_GPR(context, 30) = (unsigned long) young_limit;
- #endif
-+#if defined(TARGET_power) && defined(SYS_bsd)
-+ /* Cached in register 30 */
-+ context->sc_frame.fixreg[30] = (unsigned long) young_limit;
-+#endif
- }
- }
- }
-@@ -443,6 +449,17 @@
- }
- #endif
-
-+#if defined(TARGET_power) && defined(SYS_bsd)
-+static void trap_handler(int sig, int code, struct sigcontext * context)
-+{
-+ /* Recover young_ptr and caml_exception_pointer from registers 31 and 29 */
-+ caml_exception_pointer = (char *) context->sc_frame.fixreg[29];
-+ young_ptr = (char *) context->sc_frame.fixreg[31];
-+ array_bound_error();
-+}
-+#endif
+--- asmcomp/power/emit.mlp.orig Mon Jul 22 18:37:53 2002
++++ asmcomp/power/emit.mlp Thu Apr 22 10:34:38 2004
+@@ -65,7 +65,7 @@
+
+ let emit_symbol =
+ match Config.system with
+- "aix" | "elf" -> (fun s -> Emitaux.emit_symbol '.' s)
++ "aix" | "elf" | "bsd" -> (fun s -> Emitaux.emit_symbol '.' s)
+ | "rhapsody" -> (fun s -> emit_char '_'; Emitaux.emit_symbol '$' s)
+ | _ -> assert false
+
+@@ -78,7 +78,7 @@
+ let label_prefix =
+ match Config.system with
+ "aix" -> "L.."
+- | "elf" -> ".L"
++ | "elf" | "bsd" -> ".L"
+ | "rhapsody" -> "L"
+ | _ -> assert false
+
+@@ -90,21 +90,21 @@
+ let data_space =
+ match Config.system with
+ "aix" -> " .csect .data[RW]\n"
+- | "elf" -> " .section \".data\"\n"
++ | "elf" | "bsd" -> " .section \".data\"\n"
+ | "rhapsody" -> " .data\n"
+ | _ -> assert false
+
+ let code_space =
+ match Config.system with
+ "aix" -> " .csect .text[PR]\n"
+- | "elf" -> " .section \".text\"\n"
++ | "elf" | "bsd" -> " .section \".text\"\n"
+ | "rhapsody" -> " .text\n"
+ | _ -> assert false
+
+ let rodata_space =
+ match Config.system with
+ "aix" -> " .csect .data[RW]\n" (* ?? *)
+- | "elf" -> " .section \".rodata\"\n"
++ | "elf" | "bsd" -> " .section \".rodata\"\n"
+ | "rhapsody" -> " .const\n"
+ | _ -> assert false
+
+@@ -157,7 +157,7 @@
+
+ let emit_upper emit_fun arg =
+ match Config.system with
+- "elf" ->
++ "elf" | "bsd" ->
+ emit_fun arg; emit_string "@ha"
+ | "rhapsody" ->
+ emit_string "ha16("; emit_fun arg; emit_string ")"
+@@ -165,7 +165,7 @@
+
+ let emit_lower emit_fun arg =
+ match Config.system with
+- "elf" ->
++ "elf" | "bsd" ->
+ emit_fun arg; emit_string "@l"
+ | "rhapsody" ->
+ emit_string "lo16("; emit_fun arg; emit_string ")"
+@@ -935,6 +935,30 @@
+ emit_instr i None;
+ emit_all i.next
+
++(* Emission of the profiling prelude *)
+
++let emit_profile () =
++ match Config.system with
++ "bsd" ->
++ ` stwu 1, -32(1)\n`;
++ ` mflr 0\n`;
++ ` stw 0, 4(1)\n`;
++ ` stw 2, 8(1)\n`;
++ ` stw 3, 12(1)\n`;
++ ` stw 4, 16(1)\n`;
++ ` stw 5, 20(1)\n`;
++ ` stw 6, 24(1)\n`;
++ ` stw 7, 28(1)\n`;
++ ` bl {emit_symbol "_mcount"}\n`;
++ ` lwz 2, 8(1)\n`;
++ ` lwz 3, 12(1)\n`;
++ ` lwz 4, 16(1)\n`;
++ ` lwz 5, 20(1)\n`;
++ ` lwz 6, 24(1)\n`;
++ ` lwz 7, 28(1)\n`;
++ ` addic 1, 1, 32\n`;
++ | _ -> () (*unsupported yet*)
+
- /* Machine- and OS-dependent handling of stack overflow */
+ (* Emission of a function declaration *)
+
+ let fundecl fundecl =
+@@ -951,10 +975,11 @@
+ ` .csect {emit_symbol fundecl.fun_name}[DS]\n`;
+ `{emit_symbol fundecl.fun_name}:\n`;
+ ` .long .{emit_symbol fundecl.fun_name}, TOC[tc0], 0\n`
+- | "elf" ->
++ | "elf" | "bsd" ->
+ ` .type {emit_symbol fundecl.fun_name}, @function\n`
+ | _ -> ()
+ end;
++ if !Clflags.gprofile then emit_profile();
+ emit_string code_space;
+ ` .align 2\n`;
+ `{emit_codesymbol fundecl.fun_name}:\n`;
+@@ -996,7 +1021,7 @@
+
+ let declare_global_data s =
+ ` .globl {emit_symbol s}\n`;
+- if Config.system = "elf" then
++ if Config.system = "elf" || Config.system = "bsd" then
+ ` .type {emit_symbol s}, @object\n`
- #ifdef HAS_STACK_OVERFLOW_DETECTION
+ let emit_item = function