Index: files/patch-asmcomp-amd64-emit.mlp.diff
===================================================================
--- files/patch-asmcomp-amd64-emit.mlp.diff	(revision 0)
+++ files/patch-asmcomp-amd64-emit.mlp.diff	(revision 0)
@@ -0,0 +1,83 @@
+--- asmcomp/amd64/emit.mlp.orig	2009-03-29 00:10:04.000000000 +0900
++++ asmcomp/amd64/emit.mlp	2009-10-01 19:29:16.000000000 +0900
+@@ -10,7 +10,7 @@
+ (*                                                                     *)
+ (***********************************************************************)
+ 
+-(* $Id: emit.mlp,v 1.16.2.4 2009/03/28 15:10:04 xleroy Exp $ *)
++(* $Id: emit.mlp,v 1.16.2.7 2009-09-18 13:49:21 xleroy Exp $ *)
+ 
+ (* Emission of x86-64 (AMD 64) assembly code *)
+ 
+@@ -576,33 +576,26 @@
+             end
+     | Lswitch jumptbl ->
+         let lbl = new_label() in
+-        if !pic_code || !Clflags.dlcode then begin
+-          (* PR#4424: r11 is known to be clobbered by the Lswitch,
+-             meaning that no variable that is live across the Lswitch
+-             is assigned to r11.  However, the argument to Lswitch
+-             can still be assigned to r11, so we need to special-case 
+-             this situation. *)
+-          if i.arg.(0).loc = Reg 9 (* ie r11, cf amd64/proc.ml *) then begin
+-            `	salq	$3, %r11\n`;
+-            `	pushq	%r11\n`;
+-            `	leaq	{emit_label lbl}(%rip), %r11\n`;
+-            `	addq	0(%rsp), %r11\n`;
+-            `	addq	$8, %rsp\n`;
+-            `	jmp	*(%r11)\n`
+-          end else begin
+-            `	leaq	{emit_label lbl}(%rip), %r11\n`;
+-            `	jmp	*(%r11, {emit_reg i.arg.(0)}, 8)\n`
+-          end
+-        end else begin
+-          `	jmp	*{emit_label lbl}(, {emit_reg i.arg.(0)}, 8)\n`
+-        end;
++        (* rax and rdx are clobbered by the Lswitch,
++           meaning that no variable that is live across the Lswitch
++           is assigned to rax or rdx.  However, the argument to Lswitch
++           can still be assigned to one of these two registers, so
++           we must be careful not to clobber it before use. *)
++        let (tmp1, tmp2) =
++          if i.arg.(0).loc = Reg 0 (* rax *)
++          then (phys_reg 4 (*rdx*), phys_reg 0 (*rax*))
++          else (phys_reg 0 (*rax*), phys_reg 4 (*rdx*)) in
++        `	leaq	{emit_label lbl}(%rip), {emit_reg tmp1}\n`;
++        `	movslq	({emit_reg tmp1}, {emit_reg i.arg.(0)}, 4), {emit_reg tmp2}\n`;
++        `	addq	{emit_reg tmp2}, {emit_reg tmp1}\n`;
++        `	jmp	*{emit_reg tmp1}\n`;
+         if macosx
+         then `	.const\n`
+         else `	.section .rodata\n`;
+-        emit_align 8;
++        emit_align 4;
+         `{emit_label lbl}:`;
+         for i = 0 to Array.length jumptbl - 1 do
+-          `	.quad	{emit_label jumptbl.(i)}\n`
++          `	.long	{emit_label jumptbl.(i)} - {emit_label lbl}\n`
+         done;
+         `	.text\n`
+     | Lsetuptrap lbl ->
+@@ -668,7 +661,9 @@
+   bound_error_call := 0;
+   `	.text\n`;
+   emit_align 16;
+-  if macosx && is_generic_function fundecl.fun_name
++  if macosx
++  && not !Clflags.output_c_object
++  && is_generic_function fundecl.fun_name
+   then (* PR#4690 *)
+     `	.private_extern	{emit_symbol fundecl.fun_name}\n`
+   else
+@@ -713,9 +708,9 @@
+   | Cint n ->
+       `	.quad	{emit_nativeint n}\n`
+   | Csingle f ->
+-      `	.float	{emit_string f}\n`
++      emit_float32_directive ".long" f
+   | Cdouble f ->
+-      `	.double	{emit_string f}\n`
++      emit_float64_directive ".quad" f
+   | Csymbol_address s ->
+       `	.quad	{emit_symbol s}\n`
+   | Clabel_address lbl ->
Index: files/patch-asmcomp-amd64-proc.ml.diff
===================================================================
--- files/patch-asmcomp-amd64-proc.ml.diff	(revision 0)
+++ files/patch-asmcomp-amd64-proc.ml.diff	(revision 0)
@@ -0,0 +1,28 @@
+--- asmcomp/amd64/proc.ml.orig	2009-03-29 00:52:13.000000000 +0900
++++ asmcomp/amd64/proc.ml	2009-10-01 19:29:29.000000000 +0900
+@@ -10,7 +10,7 @@
+ (*                                                                     *)
+ (***********************************************************************)
+ 
+-(* $Id: proc.ml,v 1.5.4.1 2009/03/28 15:52:13 xleroy Exp $ *)
++(* $Id: proc.ml,v 1.5.4.2 2009-09-18 13:49:21 xleroy Exp $ *)
+ 
+ (* Description of the AMD64 processor *)
+ 
+@@ -92,7 +92,6 @@
+ let rax = phys_reg 0
+ let rcx = phys_reg 5
+ let rdx = phys_reg 4
+-let r11 = phys_reg 9
+ let rxmm15 = phys_reg 115
+ 
+ let stack_slot slot ty =
+@@ -170,7 +169,7 @@
+   | Iop(Istore(Single, _)) -> [| rxmm15 |]
+   | Iop(Ialloc _ | Iintop(Icomp _) | Iintop_imm((Idiv|Imod|Icomp _), _))
+         -> [| rax |]
+-  | Iswitch(_, _) when !pic_code || !Clflags.dlcode -> [| r11 |]
++  | Iswitch(_, _) -> [| rax; rdx |]
+   | _ -> [||]
+ 
+ let destroyed_at_raise = all_phys_regs
Index: files/patch-asmcomp-emitaux.ml.diff
===================================================================
--- files/patch-asmcomp-emitaux.ml.diff	(revision 0)
+++ files/patch-asmcomp-emitaux.ml.diff	(revision 0)
@@ -0,0 +1,39 @@
+--- asmcomp/emitaux.ml.orig	2009-01-27 02:06:10.000000000 +0900
++++ asmcomp/emitaux.ml	2009-10-01 20:03:55.000000000 +0900
+@@ -10,7 +10,7 @@
+ (*                                                                     *)
+ (***********************************************************************)
+ 
+-(* $Id: emitaux.ml,v 1.12.12.1 2009/01/26 17:06:10 xleroy Exp $ *)
++(* $Id: emitaux.ml,v 1.12.12.2 2009-07-15 12:14:39 xleroy Exp $ *)
+ 
+ (* Common functions for emitting assembly code *)
+ 
+@@ -93,6 +93,27 @@
+    done;
+    if !pos > 0 then emit_char '\n'
+ 
++(* PR#4813: assemblers do strange things with float literals indeed,
++   so we convert to IEEE representation ourselves and emit float
++   literals as 32- or 64-bit integers. *)
++
++let emit_float64_directive directive f =
++  let x = Int64.bits_of_float (float_of_string f) in
++  emit_printf "\t%s\t0x%Lx\n" directive x
++
++let emit_float64_split_directive directive f =
++  let x = Int64.bits_of_float (float_of_string f) in
++  let lo = Int64.logand x 0xFFFF_FFFFL
++  and hi = Int64.shift_right_logical x 32 in
++  emit_printf "\t%s\t0x%Lx, 0x%Lx\n"
++    directive
++    (if Arch.big_endian then hi else lo)
++    (if Arch.big_endian then lo else hi)
++
++let emit_float32_directive directive f =
++  let x = Int32.bits_of_float (float_of_string f) in
++  emit_printf "\t%s\t0x%lx\n" directive x
++
+ (* Record live pointers at call points *)
+ 
+ type frame_descr =
Index: files/patch-configure.diff
===================================================================
--- files/patch-configure.diff	(revision 0)
+++ files/patch-configure.diff	(revision 0)
@@ -0,0 +1,11 @@
+--- configure.orig	2009-05-21 00:33:09.000000000 +0900
++++ configure	2009-10-01 19:35:54.000000000 +0900
+@@ -373,7 +373,7 @@
+ echo "#define SIZEOF_PTR $3" >> m.h
+ echo "#define SIZEOF_SHORT $4" >> m.h
+ 
+-if test $2 = 8; then
++if test $2 = 8 && $system != macosx; then
+      echo "#define ARCH_INT64_TYPE long" >> m.h
+      echo "#define ARCH_UINT64_TYPE unsigned long" >> m.h
+      echo '#define ARCH_INT64_PRINTF_FORMAT "l"' >> m.h
Index: files/patch-asmcomp-emitaux.mli.diff
===================================================================
--- files/patch-asmcomp-emitaux.mli.diff	(revision 0)
+++ files/patch-asmcomp-emitaux.mli.diff	(revision 0)
@@ -0,0 +1,21 @@
+--- asmcomp/emitaux.mli.orig	2009-01-27 02:06:10.000000000 +0900
++++ asmcomp/emitaux.mli	2009-10-01 20:03:59.000000000 +0900
+@@ -10,7 +10,7 @@
+ (*                                                                     *)
+ (***********************************************************************)
+ 
+-(* $Id: emitaux.mli,v 1.12.12.1 2009/01/26 17:06:10 xleroy Exp $ *)
++(* $Id: emitaux.mli,v 1.12.12.2 2009-07-15 12:14:39 xleroy Exp $ *)
+ 
+ (* Common functions for emitting assembly code *)
+ 
+@@ -25,6 +25,9 @@
+ val emit_string_literal: string -> unit
+ val emit_string_directive: string -> string -> unit
+ val emit_bytes_directive: string -> string -> unit
++val emit_float64_directive: string -> string -> unit
++val emit_float64_split_directive: string -> string -> unit
++val emit_float32_directive: string -> string -> unit
+ 
+ type frame_descr =
+   { fd_lbl: int;                        (* Return address *)
Index: files/patch-asmcomp-i386-emit.mlp.diff
===================================================================
--- files/patch-asmcomp-i386-emit.mlp.diff	(revision 0)
+++ files/patch-asmcomp-i386-emit.mlp.diff	(revision 0)
@@ -0,0 +1,34 @@
+--- asmcomp/i386/emit.mlp.orig	2009-03-29 00:10:04.000000000 +0900
++++ asmcomp/i386/emit.mlp	2009-10-01 19:30:07.000000000 +0900
+@@ -10,7 +10,7 @@
+ (*                                                                     *)
+ (***********************************************************************)
+ 
+-(* $Id: emit.mlp,v 1.41.2.4 2009/03/28 15:10:04 xleroy Exp $ *)
++(* $Id: emit.mlp,v 1.41.2.6 2009-09-13 16:48:19 xleroy Exp $ *)
+ 
+ (* Emission of Intel 386 assembly code *)
+ 
+@@ -888,7 +888,9 @@
+   bound_error_call := 0;
+   `	.text\n`;
+   emit_align 16;
+-  if macosx && is_generic_function fundecl.fun_name
++  if macosx
++  && not !Clflags.output_c_object
++  && is_generic_function fundecl.fun_name
+   then (* PR#4690 *)
+     `	.private_extern	{emit_symbol fundecl.fun_name}\n`
+   else
+@@ -928,9 +930,9 @@
+   | Cint n ->
+       `	.long	{emit_nativeint n}\n`
+   | Csingle f ->
+-      `	.float	{emit_string f}\n`
++      emit_float32_directive ".long" f
+   | Cdouble f ->
+-      `	.double	{emit_string f}\n`
++      emit_float64_split_directive ".long" f
+   | Csymbol_address s ->
+       `	.long	{emit_symbol s}\n`
+   | Clabel_address lbl ->
Index: Portfile
===================================================================
--- Portfile	(revision 58392)
+++ Portfile	(working copy)
@@ -4,6 +4,7 @@
 
 name 			ocaml
 version			3.11.1
+revision 		1
 set major_vers	[join [lrange [split ${version} .] 0 1] .]
 platforms		darwin
 maintainers		kallisys.net:pguyot openmaintainer
@@ -32,6 +33,14 @@
 set doc_distname	${name}-${major_vers}-refman
 set docdir			${prefix}/share/doc/${name}-${version}
 
+# Patchfiles.
+patchfiles		   patch-asmcomp-amd64-emit.mlp.diff \
+	patch-asmcomp-amd64-proc.ml.diff \
+	patch-asmcomp-emitaux.ml.diff \
+	patch-asmcomp-emitaux.mli.diff \
+	patch-asmcomp-i386-emit.mlp.diff \
+	patch-configure.diff
+
 # Configure.
 configure.pre_args	-prefix ${prefix}
 configure.args		-no-tk -cc ${configure.cc} -aspp \"${configure.cc} -c\"
