arm changes are huge it seems with this release: * New ARM backend (PR#5433): . Supports both Linux/EABI (armel) and Linux/EABI+VFPv3 (armhf). . Added support for the Thumb-2 instruction set with average code size savings of 28%. . Added support for position-independent code, natdynlink, profiling and exception backtraces. as I don't know much about arm, could you please check if this is fine or if we have something to do because we may support older hardware ?
It builds fine. Here's the system I built it under: 1) cpu = armv7l 2) cpu flags = swp half thumb fastmult vfp edsp neon vfpv3 3) CFLAGS = -march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard I don't know what is meant by "supports" in the changelog blurb you quote. Does it mean that the ocaml compiler makes use of those features when compiling, or that it produces binary with ISA that makes use of those features, eg vfpv3? Or both. (I would think the later.) I'll mark it ~arm, but if you can pass test code my way I'll try building stuff and see how it does. I don't know any ocaml, but I'm sure I can figure out simple "hello worlds". What I really need to see is how to pass ocaml flags like CFLAGS for gcc.
> I'll mark it ~arm, but if you can pass test code my way I'll try building > stuff and see how it does. I don't know any ocaml, but I'm sure I can > figure out simple "hello worlds". What I really need to see is how to pass > ocaml flags like CFLAGS for gcc. Okay some points: 1) it was already marked ~arm. 2) I'm convinced ocamlopt is producing EABI+VFPv3 hardfloat code. Here's how I convinced myself: 2.a) I compared the asm produced by gcc -O2 -pipe -nopie -fno-stack-protector -march=armv7-a -mcpu=cortex-a9 -mfloat-abi=soft -c fib.c gcc -O2 -pipe -nopie -fno-stack-protector -march=armv7-a -mcpu=cortex-a9 -mfloat-abi=hard -c fib.c gcc -O2 -pipe -nopie -fno-stack-protector -march=armv7-a -mcpu=cortex-a9 -mfloat-abi=hard -mfpu=vfpv3 -c fib.c I found that -mfpu=vfpv3 -mfloat-abi=hard gives you instructions like: vmov.f64 d16, d0 with register values above d7. In this case d16. Without vfpv3 you only get to use d0-d7. 2.b) I then looked at disassembled code from ocamlopt on a fib.ml objdump -d a.out | grep vmov and I found lots of "vmov.f64 d16, d0" instructions. Here fib.c and fib.ml calculate the fibonacci sequence but forcing floats with fib_0 = 0.1 and fib_1 = 1.01 3) I'm not sure how to test for Thumb-2 instructions yet. 4) I don't know enought caml to know how to PIC code plays in that, can you make .so shared objects in ocaml? 5) Also not sure about natdynlink, profiling. Nor how to trigger exception backtraces.
> 4) I don't know enought caml to know how to PIC code plays in that, can you > make .so shared objects in ocaml? Following http://caml.inria.fr/pub/docs/manual-ocaml/manual025.html I get PIC code just fine.
First, thank you for all the tests. (In reply to comment #2) > 2) I'm convinced ocamlopt is producing EABI+VFPv3 hardfloat code. Here's > how I convinced myself: is it good or bad ? by the way, ocaml configure has this: arm*-*-linux-gnueabihf) arch=arm; system=linux_eabihf;; armv7*-*-linux-gnueabi) arch=arm; model=armv7; system=linux_eabi;; armv6t2*-*-linux-gnueabi) arch=arm; model=armv6t2; system=linux_eabi;; armv6*-*-linux-gnueabi) arch=arm; model=armv6; system=linux_eabi;; armv5te*-*-linux-gnueabi) arch=arm; model=armv5te; system=linux_eabi;; armv5*-*-linux-gnueabi) arch=arm; model=armv5; system=linux_eabi;; arm*-*-linux-gnueabi) arch=arm; system=linux_eabi;; This is matched uppon your CHOST, so it will be producing EABI+VFPv3 hardfloat code if you CHOST matches arm*-*-linux-gnueabihf. > 3) I'm not sure how to test for Thumb-2 instructions yet. it seems its done with ocamlopt -fthumb / -fno-thumb > 4) I don't know enought caml to know how to PIC code plays in that, can you > make .so shared objects in ocaml? it doesnt make .so but should generate pic code by default, and the equivalent of the .so are the .cmxs that are installed with ocaml (ls /usr/lib/ocaml/*.cmxs); if those have no textrel then all is good :) > 5) Also not sure about natdynlink natdynlink is loading a .cmxs :) i couldnt find a simple example, but you can try www-servers/ocsigen with use=ocamlopt, it makes good use of natdynlink. >, profiling. compile your program with ocamlopt -p, run it, and run gprof (see ocamlopt manpage) > Nor how to trigger exception > backtraces. $ cat foo.ml let _ = failwith "foo";; (failwith will generate an exception) $ ocamlopt foo.ml $ ./a.out Fatal error: exception Failure("foo") (no backtrace) $ ocamlopt -g foo.ml $ OCAMLRUNPARAM=b ./a.out Fatal error: exception Failure("foo") Raised at file "pervasives.ml", line 22, characters 22-33 Called from file "foo.ml", line 1, characters 8-22 (now we have a backtrace :) )
(In reply to comment #4) > First, thank you for all the tests. > > (In reply to comment #2) > > 2) I'm convinced ocamlopt is producing EABI+VFPv3 hardfloat code. Here's > > how I convinced myself: > > is it good or bad ? It is good! > armv7*-*-linux-gnueabi) arch=arm; model=armv7; system=linux_eabi;; This is the system I'm using for testing. > it seems its done with ocamlopt -fthumb / -fno-thumb Yep, I get thumb code. All is good! > > > 4) I don't know enought caml to know how to PIC code plays in that, can you > > make .so shared objects in ocaml? > > it doesnt make .so but should generate pic code by default, and the > equivalent of the .so are the .cmxs that are installed with ocaml (ls > /usr/lib/ocaml/*.cmxs); if those have no textrel then all is good :) No textrels :) Good! > > > 5) Also not sure about natdynlink > > natdynlink is loading a .cmxs :) i couldnt find a simple example, but you > can try www-servers/ocsigen with use=ocamlopt, it makes good use of > natdynlink. ocsigen insists on pulling in ocaml-3. This is the only test I didn't convince myself on > > >, profiling. > > compile your program with ocamlopt -p, run it, and run gprof > (see ocamlopt manpage) > > > Nor how to trigger exception > > backtraces. > > $ cat foo.ml > let _ = failwith "foo";; > > (failwith will generate an exception) > > $ ocamlopt foo.ml > $ ./a.out > Fatal error: exception Failure("foo") > > (no backtrace) > > $ ocamlopt -g foo.ml > $ OCAMLRUNPARAM=b ./a.out > Fatal error: exception Failure("foo") > Raised at file "pervasives.ml", line 22, characters 22-33 > Called from file "foo.ml", line 1, characters 8-22 > > (now we have a backtrace :) ) Works! All is good here!
(In reply to comment #5) > > > > > 5) Also not sure about natdynlink > > > > natdynlink is loading a .cmxs :) i couldnt find a simple example, but you > > can try www-servers/ocsigen with use=ocamlopt, it makes good use of > > natdynlink. > > ocsigen insists on pulling in ocaml-3. This is the only test I didn't > convince myself on USE=-ocamlduce maybe? (this one, when enabled, for sure will bring in ocaml-3)
(In reply to comment #6) > (In reply to comment #5) > > > > > > > > 5) Also not sure about natdynlink > > > > > > natdynlink is loading a .cmxs :) i couldnt find a simple example, but you > > > can try www-servers/ocsigen with use=ocamlopt, it makes good use of > > > natdynlink. > > > > ocsigen insists on pulling in ocaml-3. This is the only test I didn't > > convince myself on > > USE=-ocamlduce maybe? > (this one, when enabled, for sure will bring in ocaml-3) Nope, something in the chain of deps insists on ocaml-3. Is there just a simple hello world alla natdynlink I can try? hardenedmx6 ~ # USE="-ocamlopt -ocamlduce" emerge ocsigen -vp These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild UD ] dev-lang/ocaml-3.12.1 [4.00.0] USE="X gdbm%* latex ncurses -emacs -ocamlopt* -tk (-xemacs)" 2,885 kB [ebuild N *] dev-ml/findlib-1.3.3 USE="-doc -ocamlopt -tk" 226 kB [ebuild N *] dev-ml/pcre-ocaml-6.2.5 USE="-examples -ocamlopt" 60 kB [ebuild N *] dev-ml/ocaml-sqlite3-2.0.2 USE="-debug -doc -ocamlopt -test" 60 kB [ebuild N *] dev-ml/camlzip-1.04 USE="-ocamlopt" 26 kB [ebuild N *] dev-ml/cryptokit-1.6 USE="zlib -debug -doc -ocamlopt" 130 kB [ebuild N *] dev-ml/react-0.9.4 USE="-debug -ocamlopt -test" 82 kB [ebuild N *] dev-ml/ocaml-ssl-0.4.6 USE="-doc" 117 kB [ebuild N *] dev-ml/lablgl-1.04 USE="-doc -glut -ocamlopt -tk" 401 kB [ebuild N ] x11-libs/gtkglarea-2.0.1 USE="-examples" 292 kB [ebuild N ] app-arch/sharutils-4.11.1 USE="nls" 978 kB [ebuild N ] app-text/gtkspell-2.0.16 USE="-doc" 344 kB [ebuild N *] dev-ml/lablgtk-2.14.2 USE="opengl spell svg -debug -examples -glade -gnome -gnomecanvas -ocamlopt -sourceview" 762 kB [ebuild N *] dev-ml/lwt-2.4.0 USE="gtk react ssl -debug -doc -ocamlopt -test" 490 kB [ebuild N *] dev-ml/ocamlnet-3.6 USE="gtk pcre ssl -cryptokit -httpd -ocamlopt -tk -zip" 3,245 kB [ebuild N *] dev-ml/obrowser-1.1.1 1,343 kB [ebuild N *] www-servers/ocsigen-1.3.4 USE="zlib -dbm -debug -doc -ocamlduce -ocamlopt -sqlite" 765 kB
(In reply to comment #7) > (In reply to comment #6) > > (In reply to comment #5) > > > > > > > > > > > 5) Also not sure about natdynlink > > > > > > > > natdynlink is loading a .cmxs :) i couldnt find a simple example, but you > > > > can try www-servers/ocsigen with use=ocamlopt, it makes good use of > > > > natdynlink. > > > > > > ocsigen insists on pulling in ocaml-3. This is the only test I didn't > > > convince myself on > > > > USE=-ocamlduce maybe? > > (this one, when enabled, for sure will bring in ocaml-3) > > Nope, something in the chain of deps insists on ocaml-3. Is there just a > simple hello world alla natdynlink I can try? > thats what i was looking for but didnt find anything > hardenedmx6 ~ # USE="-ocamlopt -ocamlduce" emerge ocsigen -vp err, natdynlink will be used only if you _enable_ ocamlopt > [ebuild N *] www-servers/ocsigen-1.3.4 USE="zlib -dbm -debug -doc > -ocamlduce -ocamlopt -sqlite" 765 kB thats probably because it will try to use dbm bindings removed from ocaml-4; either install dev-ml/camldbm or set USE=sqlite
3 years later and no complain, I assume it's ok :)