diff options
author | is <is@pkgsrc.org> | 2010-12-19 08:27:17 +0000 |
---|---|---|
committer | is <is@pkgsrc.org> | 2010-12-19 08:27:17 +0000 |
commit | 1d4167c29ff95970679a501ab5464a24d32c978b (patch) | |
tree | 45661715be9ebb3e6dc5f0af99b767ffe7c37676 /lang/ocaml | |
parent | d1da0734ee68d7319373fc97934f8a0dd90771ef (diff) | |
download | pkgsrc-1d4167c29ff95970679a501ab5464a24d32c978b.tar.gz |
- Enable native compilation for arm.
- to do this, and make the result runnable on pre-thumb arm, change
upstreams assembler snippets and stubs to use "mov pc,reg" instead
of the return/call-to-thumb-friendly "bx reg", which is not available
in non-thumb-enabled arm CPUs. Whether this is the way to go, or a
seperate "armt" architecture for ocaml is needed, needs to be discussed
with upstream.
Resulting compiler, when running its selftest suite, has 6 errors less than
the same on i386. Unison compiled natively with this passes its self-test.
Diffstat (limited to 'lang/ocaml')
-rw-r--r-- | lang/ocaml/Makefile | 4 | ||||
-rw-r--r-- | lang/ocaml/Makefile.common | 4 | ||||
-rw-r--r-- | lang/ocaml/distinfo | 6 | ||||
-rw-r--r-- | lang/ocaml/patches/patch-at | 36 | ||||
-rw-r--r-- | lang/ocaml/patches/patch-bw | 56 | ||||
-rw-r--r-- | lang/ocaml/patches/patch-bx | 31 |
6 files changed, 118 insertions, 19 deletions
diff --git a/lang/ocaml/Makefile b/lang/ocaml/Makefile index a13c4da3b21..4be2457c7ed 100644 --- a/lang/ocaml/Makefile +++ b/lang/ocaml/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.67 2010/10/28 20:46:07 tonio Exp $ +# $NetBSD: Makefile,v 1.68 2010/12/19 08:27:17 is Exp $ PKG_DESTDIR_SUPPORT= user-destdir @@ -28,6 +28,7 @@ PLIST_SRC+= ${PKGDIR}/PLIST.stub # Optional components built only on certain platforms. .if (${MACHINE_ARCH} == "i386") || (${MACHINE_ARCH} == "powerpc") || \ + (${MACHINE_ARCH} == "arm") || \ (${MACHINE_ARCH} == "sparc") || (${MACHINE_ARCH} == "x86_64") BUILD_TARGET+= opt opt.opt PLIST_SRC+= ${PKGDIR}/PLIST.opt @@ -36,6 +37,7 @@ PLIST_SRC+= ${PKGDIR}/PLIST.opt empty(MACHINE_PLATFORM:MNetBSD-*-powerpc) && \ empty(MACHINE_PLATFORM:MNetBSD-*-x86_64) && \ empty(MACHINE_PLATFORM:MFreeBSD-*-x86_64) && \ + empty(MACHINE_PLATFORM:MNetBSD-*-arm) && \ empty(MACHINE_PLATFORM:MNetBSD-*-sparc) PLIST_SRC+= ${PKGDIR}/PLIST.prof . endif diff --git a/lang/ocaml/Makefile.common b/lang/ocaml/Makefile.common index a922056e8b7..f653e9a7301 100644 --- a/lang/ocaml/Makefile.common +++ b/lang/ocaml/Makefile.common @@ -1,9 +1,9 @@ -# $NetBSD: Makefile.common,v 1.27 2010/11/28 08:41:33 is Exp $ +# $NetBSD: Makefile.common,v 1.28 2010/12/19 08:27:17 is Exp $ # used by x11/labltk/Makefile # used by x11/ocaml-graphics/Makefile DISTNAME= ocaml-3.12.0 -PKGREVISION= 1 +PKGREVISION= 2 CATEGORIES= lang MASTER_SITES= http://caml.inria.fr/pub/distrib/ocaml-3.12/ EXTRACT_SUFX= .tar.bz2 diff --git a/lang/ocaml/distinfo b/lang/ocaml/distinfo index 41cb29d9ad9..9fa2618b67e 100644 --- a/lang/ocaml/distinfo +++ b/lang/ocaml/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.52 2010/11/28 08:41:33 is Exp $ +$NetBSD: distinfo,v 1.53 2010/12/19 08:27:17 is Exp $ SHA1 (ocaml-3.12.0.tar.bz2) = 33ebbfb1115806f117808f37e40d206c8994943d RMD160 (ocaml-3.12.0.tar.bz2) = 3d10d5f7431d8200688fa74122e7ed528126a0fa @@ -11,7 +11,7 @@ SHA1 (patch-ag) = f1b751098d3693b92feb26cda87970426bffcaf1 SHA1 (patch-ah) = 3165bbcdb98d09f5161912e51a3131486aa0b488 SHA1 (patch-aj) = 6fd989f1e5dd1263890c14459dd4ab85d75e86cd SHA1 (patch-an) = 8fb8efecd2b3f0ec6f913a0840f4cfebcbb6161e -SHA1 (patch-at) = b8ca7e6fa643b4dfbd165a5a1187f96834823617 +SHA1 (patch-at) = 2dfd42fb373ad5efedded1a23bf1013d831346fd SHA1 (patch-au) = 1e36bcdf39d40e781273ea51df213db05ff46c89 SHA1 (patch-av) = f56c8924b81a620602bc5a67b0c4459b721701d2 SHA1 (patch-aw) = ce7b09f19f9f086b65b5036b6684c5243e990b8c @@ -34,3 +34,5 @@ SHA1 (patch-bs) = 24788a31a5bdfe502e9586002574fdc077455536 SHA1 (patch-bt) = 400ac1c2935690bd204da116272017ec167f4b0d SHA1 (patch-bu) = 0b3bbe273142ebed3a24e7e92d4cfd9f30a032b6 SHA1 (patch-bv) = 595641bb079174f393e420bdf5c48fe8ca1912cf +SHA1 (patch-bw) = 6214af031d165f7485f5b422262e8a0e0cc95588 +SHA1 (patch-bx) = 3cfcad488901f616a3a2f968247d7915f05891d7 diff --git a/lang/ocaml/patches/patch-at b/lang/ocaml/patches/patch-at index e2b8df554fc..265e0ec2539 100644 --- a/lang/ocaml/patches/patch-at +++ b/lang/ocaml/patches/patch-at @@ -1,8 +1,8 @@ -$NetBSD: patch-at,v 1.19 2010/08/19 08:06:53 asau Exp $ +$NetBSD: patch-at,v 1.20 2010/12/19 08:27:17 is Exp $ ---- configure.orig 2010-07-28 17:18:22.000000000 +0400 -+++ configure 2010-08-12 14:49:14.000000000 +0400 -@@ -520,7 +520,7 @@ +--- configure.orig 2010-07-28 13:18:22.000000000 +0000 ++++ configure +@@ -520,7 +520,7 @@ if test $withsharedlibs = "yes"; then mksharedlib="$flexlink" mkmaindll="$flexlink -maindll" shared_libraries_supported=true;; @@ -11,7 +11,7 @@ $NetBSD: patch-at,v 1.19 2010/08/19 08:06:53 asau Exp $ sharedcccompopts="-fPIC" mksharedlib="$bytecc -shared" bytecclinkopts="$bytecclinkopts -Wl,-E" -@@ -620,7 +620,7 @@ +@@ -620,7 +620,7 @@ if test $withsharedlibs = "yes"; then i[3456]86-*-linux*) natdynlink=true;; x86_64-*-linux*) natdynlink=true;; i[3456]86-*-darwin10.*) @@ -20,7 +20,7 @@ $NetBSD: patch-at,v 1.19 2010/08/19 08:06:53 asau Exp $ natdynlink=true fi;; i[3456]86-*-darwin[89]*) natdynlink=true;; -@@ -653,12 +653,13 @@ +@@ -653,12 +653,13 @@ case "$host" in alpha*-*-netbsd*) arch=alpha; system=netbsd;; alpha*-*-openbsd*) arch=alpha; system=openbsd;; sparc*-*-sunos4.*) arch=sparc; system=sunos;; @@ -35,7 +35,7 @@ $NetBSD: patch-at,v 1.19 2010/08/19 08:06:53 asau Exp $ i[3456]86-*-nextstep*) arch=i386; system=nextstep;; i[3456]86-*-solaris*) if $arch64; then arch=amd64; system=solaris -@@ -667,6 +668,7 @@ +@@ -667,6 +668,7 @@ case "$host" in fi;; i[3456]86-*-beos*) arch=i386; system=beos;; i[3456]86-*-cygwin*) arch=i386; system=cygwin;; @@ -43,7 +43,15 @@ $NetBSD: patch-at,v 1.19 2010/08/19 08:06:53 asau Exp $ i[3456]86-*-darwin*) if $arch64; then arch=amd64; system=macosx else -@@ -693,7 +695,9 @@ +@@ -683,6 +685,7 @@ case "$host" in + powerpc-*-rhapsody*) arch=power; model=ppc; system=rhapsody;; + powerpc-*-darwin*) arch=power; system=rhapsody + if $arch64; then model=ppc64; else model=ppc; fi;; ++ arm*-*-netbsd*) arch=arm; system=netbsd;; + arm*-*-linux*) arch=arm; system=linux;; + arm*-*-gnu*) arch=arm; system=gnu;; + ia64-*-linux*) arch=ia64; system=linux;; +@@ -693,7 +696,9 @@ case "$host" in x86_64-*-freebsd*) arch=amd64; system=freebsd;; x86_64-*-netbsd*) arch=amd64; system=netbsd;; x86_64-*-openbsd*) arch=amd64; system=openbsd;; @@ -53,7 +61,7 @@ $NetBSD: patch-at,v 1.19 2010/08/19 08:06:53 asau Exp $ esac # Some platforms exist both in 32-bit and 64-bit variants, not distinguished -@@ -794,6 +798,7 @@ +@@ -794,6 +799,7 @@ case "$arch,$model,$system" in case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;; amd64,*,linux) profiling='prof';; amd64,*,gnu) profiling='prof';; @@ -61,7 +69,7 @@ $NetBSD: patch-at,v 1.19 2010/08/19 08:06:53 asau Exp $ *) profiling='noprof';; esac -@@ -1198,6 +1203,8 @@ +@@ -1198,6 +1204,8 @@ if test "$pthread_wanted" = "yes"; then pthread_caml_link="-cclib -lpthread -cclib -lposix4";; *-*-freebsd*) pthread_link="-pthread" pthread_caml_link="-cclib -pthread";; @@ -70,7 +78,7 @@ $NetBSD: patch-at,v 1.19 2010/08/19 08:06:53 asau Exp $ *-*-openbsd*) pthread_link="-pthread" pthread_caml_link="-cclib -pthread";; *) pthread_link="-lpthread" -@@ -1249,6 +1256,7 @@ +@@ -1249,6 +1257,7 @@ fi x11_include="not found" x11_link="not found" @@ -78,7 +86,7 @@ $NetBSD: patch-at,v 1.19 2010/08/19 08:06:53 asau Exp $ for dir in \ $x11_include_dir \ \ -@@ -1301,6 +1309,7 @@ +@@ -1301,6 +1310,7 @@ do break fi done @@ -86,7 +94,7 @@ $NetBSD: patch-at,v 1.19 2010/08/19 08:06:53 asau Exp $ if test "$x11_include" = "not found"; then x11_try_lib_dir='' -@@ -1395,31 +1404,8 @@ +@@ -1395,31 +1405,8 @@ dbm_include="not found" dbm_link="not found" use_gdbm_ndbm=no @@ -120,7 +128,7 @@ $NetBSD: patch-at,v 1.19 2010/08/19 08:06:53 asau Exp $ if test "$dbm_include" = "not found" || test "$dbm_link" = "not found"; then echo "NDBM not found, the \"dbm\" library will not be supported." else -@@ -1429,8 +1415,8 @@ +@@ -1429,8 +1416,8 @@ else else dbm_include="-I$dbm_include" fi diff --git a/lang/ocaml/patches/patch-bw b/lang/ocaml/patches/patch-bw new file mode 100644 index 00000000000..2d9fece6a77 --- /dev/null +++ b/lang/ocaml/patches/patch-bw @@ -0,0 +1,56 @@ +$NetBSD: patch-bw,v 1.1 2010/12/19 08:27:17 is Exp $ + +--- asmrun/arm.S.orig 2009-05-04 13:46:46.000000000 +0000 ++++ asmrun/arm.S +@@ -38,7 +38,7 @@ caml_call_gc: + ldr r12, .Lcaml_requested_size + ldr r12, [r12, #0] + sub alloc_ptr, alloc_ptr, r12 +- bx lr ++ mov pc,lr + + .globl caml_alloc1 + caml_alloc1: +@@ -128,7 +128,7 @@ caml_allocN: + ldr alloc_limit, [r12, #0] + /* Return to caller */ + ldr r12, [sp], #4 +- bx r12 ++ mov pc,r12 /* optimize! */ + + /* Call a C function from Caml */ + /* Function to call is in r12 */ +@@ -149,13 +149,13 @@ caml_c_call: + str trap_ptr, [r7, #0] + /* Call the function */ + mov lr, pc +- bx r12 ++ mov pc,r12 + /* Reload alloc ptr and alloc limit */ + ldr r5, .Lcaml_young_limit + ldr alloc_ptr, [r6, #0] /* r6 still points to caml_young_ptr */ + ldr alloc_limit, [r5, #0] + /* Return */ +- bx r4 ++ mov pc,r4 + + /* Start the Caml program */ + +@@ -196,7 +196,7 @@ caml_start_program: + ldr alloc_limit, [r4, #0] + /* Call the Caml code */ + mov lr, pc +- bx r12 ++ mov pc,r12 + .Lcaml_retaddr: + /* Pop the trap frame, restoring caml_exception_pointer */ + ldr r4, .Lcaml_exception_pointer +@@ -220,7 +220,7 @@ caml_start_program: + str alloc_ptr, [r4, #0] + /* Reload callee-save registers and return */ + ldmfd sp!, {r4,r5,r6,r7,r8,r10,r11,lr} +- bx lr ++ mov pc,lr + + /* The trap handler */ + .Ltrap_handler: diff --git a/lang/ocaml/patches/patch-bx b/lang/ocaml/patches/patch-bx new file mode 100644 index 00000000000..013c861b8d7 --- /dev/null +++ b/lang/ocaml/patches/patch-bx @@ -0,0 +1,31 @@ +$NetBSD: patch-bx,v 1.1 2010/12/19 08:27:17 is Exp $ + +--- asmcomp/arm/emit.mlp.orig 2010-04-22 09:33:18.000000000 +0000 ++++ asmcomp/arm/emit.mlp +@@ -285,7 +285,7 @@ let emit_instr i = + ` ldr {emit_reg i.res.(0)}, {emit_label lbl} @ {emit_symbol s}\n`; 1 + | Lop(Icall_ind) -> + ` mov lr, pc\n`; +- `{record_frame i.live} bx {emit_reg i.arg.(0)}\n`; 2 ++ `{record_frame i.live} mov pc, {emit_reg i.arg.(0)}\n`; 2 + | Lop(Icall_imm s) -> + `{record_frame i.live} bl {emit_symbol s}\n`; 1 + | Lop(Itailcall_ind) -> +@@ -293,7 +293,7 @@ let emit_instr i = + if !contains_calls then + ` ldr lr, [sp, #{emit_int (n-4)}]\n`; + let ninstr = emit_stack_adjustment "add" n in +- ` bx {emit_reg i.arg.(0)}\n`; ++ ` mov pc, {emit_reg i.arg.(0)}\n`; + 2 + ninstr + | Lop(Itailcall_imm s) -> + if s = !function_name then begin +@@ -448,7 +448,7 @@ let emit_instr i = + ` ldr lr, [sp, #{emit_int(n-4)}]\n`; 1 + | Lreturn -> + let ninstr = emit_stack_adjustment "add" (frame_size()) in +- ` bx lr\n`; ++ ` mov pc, lr\n`; + ninstr + 1 + | Llabel lbl -> + `{emit_label lbl}:\n`; 0 |