rpms/ocaml/devel ocaml-3.10.1-ppc64.patch,NONE,1.1
David Woodhouse (dwmw2)
fedora-extras-commits at redhat.com
Fri Feb 29 18:52:26 UTC 2008
Author: dwmw2
Update of /cvs/pkgs/rpms/ocaml/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11975
Added Files:
ocaml-3.10.1-ppc64.patch
Log Message:
add ppc64 port patch
ocaml-3.10.1-ppc64.patch:
--- NEW FILE ocaml-3.10.1-ppc64.patch ---
diff -uNr ocaml-3.10.1/asmcomp/power64/arch.ml ocaml-3.10.1.ppc64/asmcomp/power64/arch.ml
--- ocaml-3.10.1/asmcomp/power64/arch.ml 1969-12-31 19:00:00.000000000 -0500
+++ ocaml-3.10.1.ppc64/asmcomp/power64/arch.ml 2008-02-29 08:37:45.000000000 -0500
@@ -0,0 +1,84 @@
+(***********************************************************************)
+(* *)
+(* Objective Caml *)
+(* *)
+(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
+(* *)
+(* Copyright 1996 Institut National de Recherche en Informatique et *)
+(* en Automatique. All rights reserved. This file is distributed *)
+(* under the terms of the Q Public License version 1.0. *)
+(* *)
+(***********************************************************************)
+
+(* $Id: arch.ml,v 1.11 2004/06/19 16:13:32 xleroy Exp $ *)
+
+(* Specific operations for the PowerPC processor *)
+
+open Misc
+open Format
+
+(* Machine-specific command-line options *)
+
+let command_line_options = []
+
+(* Specific operations *)
+
+type specific_operation =
+ Imultaddf (* multiply and add *)
+ | Imultsubf (* multiply and subtract *)
+ | Ialloc_far of int (* allocation in large functions *)
+
+(* Addressing modes *)
+
+type addressing_mode =
+ Ibased of string * int (* symbol + displ *)
+ | Iindexed of int (* reg + displ *)
+ | Iindexed2 (* reg + reg *)
+
+(* Sizes, endianness *)
+
+let big_endian = true
+
+let size_addr = 8
+let size_int = 8
+let size_float = 8
+
+(* Operations on addressing modes *)
+
+let identity_addressing = Iindexed 0
+
+let offset_addressing addr delta =
+ match addr with
+ Ibased(s, n) -> Ibased(s, n + delta)
+ | Iindexed n -> Iindexed(n + delta)
+ | Iindexed2 -> assert false
+
+let num_args_addressing = function
+ Ibased(s, n) -> 0
+ | Iindexed n -> 1
+ | Iindexed2 -> 2
+
+(* Printing operations and addressing modes *)
+
+let print_addressing printreg addr ppf arg =
+ match addr with
+ | Ibased(s, n) ->
+ let idx = if n <> 0 then Printf.sprintf " + %i" n else "" in
+ fprintf ppf "\"%s\"%s" s idx
+ | Iindexed n ->
+ let idx = if n <> 0 then Printf.sprintf " + %i" n else "" in
+ fprintf ppf "%a%s" printreg arg.(0) idx
+ | Iindexed2 ->
+ fprintf ppf "%a + %a" printreg arg.(0) printreg arg.(1)
+
+let print_specific_operation printreg op ppf arg =
+ match op with
+ | Imultaddf ->
+ fprintf ppf "%a *f %a +f %a"
+ printreg arg.(0) printreg arg.(1) printreg arg.(2)
+ | Imultsubf ->
+ fprintf ppf "%a *f %a -f %a"
+ printreg arg.(0) printreg arg.(1) printreg arg.(2)
+ | Ialloc_far n ->
+ fprintf ppf "alloc_far %d" n
+
diff -uNr ocaml-3.10.1/asmcomp/power64/emit.mlp ocaml-3.10.1.ppc64/asmcomp/power64/emit.mlp
--- ocaml-3.10.1/asmcomp/power64/emit.mlp 1969-12-31 19:00:00.000000000 -0500
+++ ocaml-3.10.1.ppc64/asmcomp/power64/emit.mlp 2008-02-29 08:37:45.000000000 -0500
@@ -0,0 +1,989 @@
+(***********************************************************************)
+(* *)
+(* Objective Caml *)
+(* *)
+(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
+(* *)
+(* Copyright 1996 Institut National de Recherche en Informatique et *)
+(* en Automatique. All rights reserved. This file is distributed *)
+(* under the terms of the Q Public License version 1.0. *)
+(* *)
+(***********************************************************************)
+
+(* $Id: emit.mlp,v 1.21 2004/06/19 17:39:34 xleroy Exp $ *)
+
+(* Emission of PowerPC assembly code *)
+
+module StringSet = Set.Make(struct type t = string let compare = compare end)
+
+open Location
+open Misc
+open Cmm
+open Arch
+open Proc
+open Reg
+open Mach
+open Linearize
+open Emitaux
+
+(* Layout of the stack. The stack is kept 16-aligned. *)
+
+let stack_size_lbl = ref 0
+let stack_slot_lbl = ref 0
+let stack_args_size = ref 0
+let stack_traps_size = ref 0
+
+(* We have a stack frame of our own if we call other functions (including
+ use of exceptions, or if we need more than the red zone *)
+let has_stack_frame () =
+ if !contains_calls or (num_stack_slots.(0) + num_stack_slots.(1)) > (288-16)/8 then
+ true
+ else
+ false
+
+let frame_size_sans_args () =
+ let size = 8 * num_stack_slots.(0) + 8 * num_stack_slots.(1) + 48 in
+ Misc.align size 16
+
+let slot_offset loc cls =
+ match loc with
+ Local n ->
+ if cls = 0
+ then (!stack_slot_lbl, num_stack_slots.(1) * 8 + n * 8)
+ else (!stack_slot_lbl, n * 8)
+ | Incoming n -> ((if has_stack_frame() then !stack_size_lbl else 0), 48 + n)
+ | Outgoing n -> (0, n)
+
+(* Output a symbol *)
+
+let emit_symbol =
+ match Config.system with
+ | "elf" | "bsd" -> (fun s -> Emitaux.emit_symbol '.' s)
+ | "rhapsody" -> (fun s -> emit_char '_'; Emitaux.emit_symbol '$' s)
+ | _ -> assert false
+
+(* Output a label *)
+
+let label_prefix =
+ match Config.system with
+ | "elf" | "bsd" -> ".L"
+ | "rhapsody" -> "L"
+ | _ -> assert false
+
+let emit_label lbl =
+ emit_string label_prefix; emit_int lbl
+
+(* Section switching *)
+
+let toc_space =
+ match Config.system with
+ | "elf" | "bsd" -> " .section \".toc\",\"aw\"\n"
+ | "rhapsody" -> " .toc\n"
+ | _ -> assert false
+
+let data_space =
+ match Config.system with
+ | "elf" | "bsd" -> " .section \".data\"\n"
+ | "rhapsody" -> " .data\n"
+ | _ -> assert false
+
+let code_space =
+ match Config.system with
+ | "elf" | "bsd" -> " .section \".text\"\n"
+ | "rhapsody" -> " .text\n"
+ | _ -> assert false
+
+let rodata_space =
+ match Config.system with
+ | "elf" | "bsd" -> " .section \".rodata\"\n"
+ | "rhapsody" -> " .const\n"
+ | _ -> assert false
+
+(* Output a pseudo-register *)
+
+let emit_reg r =
+ match r.loc with
+ Reg r -> emit_string (register_name r)
+ | _ -> fatal_error "Emit.emit_reg"
[...1683 lines suppressed...]
+ std 1, 16(29)
+ std 2, 24(29)
+ Loadglobal(11, caml_exception_pointer, 11)
+ std 11, 0(29)
+ /* Reload allocation pointers */
+ Loadglobal(31, caml_young_ptr, 11)
+ Loadglobal(30, caml_young_limit, 11)
+ /* Say we are back into Caml code */
+ li 0, 0
+ Storeglobal(0, caml_last_return_address, 11)
+ /* Call the Caml code */
+ std 2,40(1)
+ ld 2,8(12)
+ ld 12,0(12)
+ mtlr 12
+.L105:
+ blrl
+ ld 2,40(1)
+ /* Pop the trap frame, restoring caml_exception_pointer */
+ ld 9, 0x170(1)
+ Storeglobal(9, caml_exception_pointer, 11)
+ /* Pop the callback link, restoring the global variables */
+.L106:
+ ld 9, 0x150(1)
+ ld 10, 0x158(1)
+ ld 11, 0x160(1)
+ Storeglobal(9, caml_bottom_of_stack, 12)
+ Storeglobal(10, caml_last_return_address, 12)
+ Storeglobal(11, caml_gc_regs, 12)
+ /* Update allocation pointer */
+ Storeglobal(31, caml_young_ptr, 11)
+ /* Restore callee-save registers */
+ addi 11, 1, 48-8
+ ldu 14, 8(11)
+ ldu 15, 8(11)
+ ldu 16, 8(11)
+ ldu 17, 8(11)
+ ldu 18, 8(11)
+ ldu 19, 8(11)
+ ldu 20, 8(11)
+ ldu 21, 8(11)
+ ldu 22, 8(11)
+ ldu 23, 8(11)
+ ldu 24, 8(11)
+ ldu 25, 8(11)
+ ldu 26, 8(11)
+ ldu 27, 8(11)
+ ldu 28, 8(11)
+ ldu 29, 8(11)
+ ldu 30, 8(11)
+ ldu 31, 8(11)
+ lfdu 14, 8(11)
+ lfdu 15, 8(11)
+ lfdu 16, 8(11)
+ lfdu 17, 8(11)
+ lfdu 18, 8(11)
+ lfdu 19, 8(11)
+ lfdu 20, 8(11)
+ lfdu 21, 8(11)
+ lfdu 22, 8(11)
+ lfdu 23, 8(11)
+ lfdu 24, 8(11)
+ lfdu 25, 8(11)
+ lfdu 26, 8(11)
+ lfdu 27, 8(11)
+ lfdu 28, 8(11)
+ lfdu 29, 8(11)
+ lfdu 30, 8(11)
+ lfdu 31, 8(11)
+ /* Return */
+ ld 1,0(1)
+ /* Reload return address */
+ ld 0, 16(1)
+ mtlr 0
+ blr
+
+ /* The trap handler: */
+.L104:
+ /* Update caml_exception_pointer */
+ Storeglobal(29, caml_exception_pointer, 11)
+ /* Encode exception bucket as an exception result and return it */
+ ori 3, 3, 2
+ b .L106
+ .size .L.caml_start_program,.-.L.caml_start_program
+
+/* Callback from C to Caml */
+
+ .globl caml_callback_exn
+ .type caml_callback_exn, @function
+ .section ".opd","aw"
+ .align 3
+caml_callback_exn:
+ .quad .L.caml_callback_exn,.TOC. at tocbase
+ .previous
+ .align 2
+.L.caml_callback_exn:
+ /* Initial shuffling of arguments */
+ mr 0, 3 /* Closure */
+ mr 3, 4 /* Argument */
+ mr 4, 0
+ ld 12, 0(4) /* Code pointer */
+ b .L102
+ .size .L.caml_callback_exn,.-.L.caml_callback_exn
+
+
+ .globl caml_callback2_exn
+ .type caml_callback2_exn, @function
+ .section ".opd","aw"
+ .align 3
+caml_callback2_exn:
+ .quad .L.caml_callback2_exn,.TOC. at tocbase
+ .previous
+ .align 2
+.L.caml_callback2_exn:
+ mr 0, 3 /* Closure */
+ mr 3, 4 /* First argument */
+ mr 4, 5 /* Second argument */
+ mr 5, 0
+ Addrglobal(12, caml_apply2)
+ b .L102
+ .size .L.caml_callback2_exn,.-.L.caml_callback2_exn
+
+
+ .globl caml_callback3_exn
+ .type caml_callback3_exn, @function
+ .section ".opd","aw"
+ .align 3
+caml_callback3_exn:
+ .quad .L.caml_callback3_exn,.TOC. at tocbase
+ .previous
+ .align 2
+.L.caml_callback3_exn:
+ mr 0, 3 /* Closure */
+ mr 3, 4 /* First argument */
+ mr 4, 5 /* Second argument */
+ mr 5, 6 /* Third argument */
+ mr 6, 0
+ Addrglobal(12, caml_apply3)
+ b .L102
+ .size .L.caml_callback3_exn,.-.L.caml_callback3_exn
+
+/* Frame table */
+
+ .section ".data"
+ .globl caml_system__frametable
+ .type caml_system__frametable, @object
+caml_system__frametable:
+ .quad 1 /* one descriptor */
+ .quad .L105 + 4 /* return address into callback */
+ .short -1 /* negative size count => use callback link */
+ .short 0 /* no roots here */
+ .align 3
+
diff -uNr ocaml-3.10.1/asmrun/stack.h ocaml-3.10.1.ppc64/asmrun/stack.h
--- ocaml-3.10.1/asmrun/stack.h 2007-02-15 13:35:20.000000000 -0500
+++ ocaml-3.10.1.ppc64/asmrun/stack.h 2008-02-29 08:37:45.000000000 -0500
@@ -65,6 +65,15 @@
#define Callback_link(sp) ((struct caml_context *)((sp) + Trap_frame_size))
#endif
+#ifdef TARGET_power64
+#define Saved_return_address(sp) *((intnat *)((sp) +16))
+#define Already_scanned(sp, retaddr) ((retaddr) & 1)
+#define Mark_scanned(sp, retaddr) (Saved_return_address(sp) = (retaddr) | 1)
+#define Mask_already_scanned(retaddr) ((retaddr) & ~1)
+#define Trap_frame_size 0x150
+#define Callback_link(sp) ((struct caml_context *)((sp) + Trap_frame_size))
+#endif
+
#ifdef TARGET_m68k
#define Saved_return_address(sp) *((intnat *)((sp) - 4))
#define Callback_link(sp) ((struct caml_context *)((sp) + 8))
diff -uNr ocaml-3.10.1/configure ocaml-3.10.1.ppc64/configure
--- ocaml-3.10.1/configure 2008-01-04 08:26:38.000000000 -0500
+++ ocaml-3.10.1.ppc64/configure 2008-02-29 09:07:05.000000000 -0500
@@ -590,6 +590,7 @@
hppa*-*-linux*) arch=hppa; system=linux;;
hppa*-*-gnu*) arch=hppa; system=gnu;;
+ powerpc64-*-linux*) arch=power64; model=ppc64; system=elf;;
powerpc*-*-linux*) arch=power; model=ppc; system=elf;;
powerpc-*-netbsd*) arch=power; model=ppc; system=elf;;
powerpc-*-rhapsody*) arch=power; model=ppc; system=rhapsody;;
powerpc-*-darwin*) arch=power; system=rhapsody
@@ -612,7 +613,7 @@
if $arch64; then
case "$arch,$model" in
- sparc,default|mips,default|hppa,default|power,ppc)
+ sparc,default|mips,default|hppa,default)
arch=none; model=default; system=unknown;;
esac
fi
@@ -670,6 +671,7 @@
i386,*,*) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
hppa,*,*) aspp="$cc"; asppflags='-traditional -c -DSYS_$(SYSTEM)';;
power,*,elf) aspp='gcc'; asppflags='-c';;
+ power64,*,elf) aspp='gcc'; asppflags='-c';;
power,*,bsd) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
power,*,rhapsody) aspp="$bytecc"; asppflags='-c';;
arm,*,linux) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
More information about the fedora-extras-commits
mailing list