hacl: build system for 32 bits architecture

This commit is contained in:
Marco Stronati 2018-06-05 23:40:15 +02:00 committed by Grégoire Henry
parent e1cdd69b8b
commit 3ff99dfba3
4 changed files with 24 additions and 1 deletions

View File

@ -1,2 +1,3 @@
Tezos binding for Hacl* Tezos binding for Hacl*
https://github.com/mitls/hacl-star/tree/master/snapshots/tezos https://github.com/mitls/hacl-star/tree/master/snapshots/tezos
commit b69319a0d3b71af8042f487d6a5bac8101edf2d0

View File

@ -0,0 +1,11 @@
let () =
(* inspired by https://github.com/vbmithr/ocaml-secp256k1-internal/blob/master/config/discover.ml *)
let ccopts = "-Ofast -march=native -mtune=native -m64 -fwrapv -fomit-frame-pointer -funroll-loops -Wall -Werror -Wfatal-errors" in
(* the important bit is -DKRML_NOUINT128 which enables the verified (but slow) implementation of UInt128 in FStar.c rather than the builtin __int128 which is only available on 64-bit platforms. *)
let ccopts32 = "-Ofast -fwrapv -fomit-frame-pointer -funroll-loops -DKRML_NOUINT128 -Wall -Werror -Wfatal-errors" in
let oc = open_out "c_flags.sexp" in
let sixtyfour = Sys.word_size = 64 in
let flags = if sixtyfour then ccopts else ccopts32 in
Printf.fprintf oc "(%s)%!" flags ;
close_out oc

5
vendors/ocaml-hacl/src/config/jbuild vendored Normal file
View File

@ -0,0 +1,5 @@
(jbuild_version 1)
(executable
((name discover)
(libraries (base stdio))))

View File

@ -22,5 +22,11 @@
Hacl_Salsa20 Hacl_Salsa20
NaCl NaCl
Hacl_Unverified_Random)) Hacl_Unverified_Random))
(c_flags (-O3 -Wall -Werror -Wfatal-errors)) (c_flags (:include c_flags.sexp))
)) ))
; sets flags for 32/64 bits architectures
(rule
((targets (c_flags.sexp))
(deps (config/discover.exe))
(action (run ${<} -ocamlc ${OCAMLC}))))